本文整理汇总了C++中ProgramOptions::write方法的典型用法代码示例。如果您正苦于以下问题:C++ ProgramOptions::write方法的具体用法?C++ ProgramOptions::write怎么用?C++ ProgramOptions::write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProgramOptions
的用法示例。
在下文中一共展示了ProgramOptions::write方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CaledoniaDriver
void CaledoniaDriver(ProgramOptions& options, int& argc, char* argv[])
{
// Get basic MPI information
MPI_Struct world;
world = MPI_Struct::world();
# ifdef USE_MPI
MPI_Comm_rank(world.comm,&world.iproc);
MPI_Comm_size(world.comm,&world.nproc);
# endif
bool verbose = options.get_value<bool>("verbose") && (world.iproc==0);
if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Construction objects" << std::endl;
// Construct a hamiltonian object
HAMILTON hamilton;
hamilton.add_options(options);
// Construct the sampling object
SIMULATION simulation;
simulation.add_options(options);
typedef WALKER<typename HAMILTON::Config,typename HAMILTON::Observables> Walker;
std::vector<Walker> walkerpool(1);
// The measurement object
// EMX_Measure measure_obj;
MEASURE measure_obj;
// Get parameters
if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Parsing parameters" << std::endl;
options.parse_command_line(argc,argv);
if( options.get_value<bool>("help") ) return;
// seed the random number geneator
if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Creating random number generator" << std::endl;
simulation.urng.seed( ParallelSeed(SeedFromClock()) );
bool rng_output = false;
bool rng_failed = RNGTestMoments(simulation.urng,rng_output,std::cout);
if( false && rng_failed )
std::cout << __FILE__ << ":" << __LINE__ << "Problem detected with random number generator (returns 1?)" << std::endl;
// Initialize objects based on ProgramOptions
if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Call Init routines" << std::endl;
hamilton.init(verbose);
hamilton.initial(walkerpool[0].sigma);
simulation.init(hamilton,walkerpool,verbose);
measure_obj.init(simulation);
// Construct a representation of the model
// This includes the "microscopic" configuration sigma_i
// and the macroscopic quantities like magnetization and energy
if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Beginning simulation" << std::endl;
simulation.DoCalculate(hamilton,walkerpool,measure_obj);
if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Saving options" << std::endl;
options.write();
}