当前位置: 首页>>代码示例>>C++>>正文


C++ Lattice::angleCompareWith方法代码示例

本文整理汇总了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;
}
开发者ID:delcypher,项目名称:lc,代码行数:80,代码来源:ea-test.cpp


注:本文中的Lattice::angleCompareWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。