本文整理汇总了C++中Lattice::angleCompareWith方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::angleCompareWith方法的具体用法?C++ Lattice::angleCompareWith怎么用?C++ Lattice::angleCompareWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lattice
的用法示例。
在下文中一共展示了Lattice::angleCompareWith方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int n, char* argv[])
{
//used to keep track of failure of all tests and so determines program's exit code
bool test1 =true;
bool test2=true;
if(n!=5)
{
cerr << "Usage: " << argv[0] <<
" <width> <height> <state> <absolute_error>\n\n" <<
"<state> - Enum (LatticeConfig::latticeState) corresponding to state.\n" <<
"<absolute_error> - The maximum acceptible absolute error." << endl;
exit(TH_BAD_ARGUMENT);
}
LatticeConfig configuration;
configuration.width = atoi(argv[1]);
configuration.height= atoi(argv[2]);
//set lattice state
LatticeConfig::latticeState state = (LatticeConfig::latticeState) atoi(argv[3]);
//set maximum acceptible absolute error
double acceptibleAE = atof(argv[4]);
//set initial director alignment
configuration.initialState = state;
//set boundary conditions (top and bottom will change depending on which analytical situation we wish to compare)
if(state == LatticeConfig::PARALLEL_X)
{
configuration.topBoundary = LatticeConfig::BOUNDARY_PARALLEL;
configuration.bottomBoundary = LatticeConfig::BOUNDARY_PARALLEL;
}
if(state == LatticeConfig::PARALLEL_Y)
{
configuration.topBoundary = LatticeConfig::BOUNDARY_PERPENDICULAR;
configuration.bottomBoundary = LatticeConfig::BOUNDARY_PERPENDICULAR;
}
if(state == LatticeConfig::K1_EQUAL_K3 || state == LatticeConfig::K1_DOMINANT || state == LatticeConfig::K3_DOMINANT)
{
configuration.topBoundary = LatticeConfig::BOUNDARY_PERPENDICULAR;
configuration.bottomBoundary = LatticeConfig::BOUNDARY_PARALLEL;
}
configuration.leftBoundary = LatticeConfig::BOUNDARY_PERIODIC;
configuration.rightBoundary = LatticeConfig::BOUNDARY_PERIODIC;
//set lattice beta value (assume k_1*beta = k_3)
if(state == LatticeConfig::K1_DOMINANT)
{
configuration.beta = 0;
}
else if(state == LatticeConfig::K3_DOMINANT)
{
//can't set beta to infinity so pick very large number
configuration.beta=1e10;
}
else
{
//assume k_1 = k_3
configuration.beta=1;
}
//create lattice object
Lattice nSystem = Lattice(configuration);
//run tests
test1 = nSystem.energyCompareWith(state, std::cout, acceptibleAE);
std::cout << endl;
//Need to restrict angular range to do next test (it is done internally)
test2 = nSystem.angleCompareWith(state, std::cout, acceptibleAE);
return (test1 && test2)?TH_SUCCESS:TH_FAIL;
}