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


C++ options::process_options方法代码示例

本文整理汇总了C++中options::process_options方法的典型用法代码示例。如果您正苦于以下问题:C++ options::process_options方法的具体用法?C++ options::process_options怎么用?C++ options::process_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在options的用法示例。


在下文中一共展示了options::process_options方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: hpx_main

int hpx_main(int argc, char* argv[]) {
	printf("Running\n");
// 	auto test_fut = hpx::async([]() {
//		while(1){hpx::this_thread::yield();}
// 	});
// 	test_fut.get();

	try {
		if (opts.process_options(argc, argv)) {

			auto all_locs = hpx::find_all_localities();
			std::vector<hpx::future<void>> futs;
            futs.reserve(all_locs.size());
			for (auto i = all_locs.begin(); i != all_locs.end(); ++i) {
				futs.push_back(hpx::async < initialize_action > (*i, opts));
			}
            hpx::when_all(futs).get();

			node_client root_id = hpx::new_ < node_server > (hpx::find_here());
			node_client root_client(root_id);

			if (opts.found_restart_file) {
				set_problem(null_problem);
				const std::string fname = opts.restart_filename;
				printf("Loading from %s...\n", fname.c_str());
				if (opts.output_only) {
					const std::string oname = opts.output_filename;
					root_client.get_ptr().get()->load_from_file_and_output(fname, oname);
				} else {
					root_client.get_ptr().get()->load_from_file(fname);
					root_client.regrid(root_client.get_gid(), true).get();
				}
				printf("Done. \n");
			} else {
				for (integer l = 0; l < opts.max_level; ++l) {
					root_client.regrid(root_client.get_gid(), false).get();
					printf("---------------Created Level %i---------------\n\n", int(l + 1));
				}
				root_client.regrid(root_client.get_gid(), false).get();
				printf("---------------Regridded Level %i---------------\n\n", int(opts.max_level));
			}

			std::vector < hpx::id_type > null_sibs(geo::direction::count());
			printf("Forming tree connections------------\n");
			root_client.form_tree(root_client.get_gid(), hpx::invalid_id, null_sibs).get();
			if (gravity_on) {
				//real tstart = MPI_Wtime();
				root_client.solve_gravity(false).get();
				//	printf("Gravity Solve Time = %e\n", MPI_Wtime() - tstart);
			}
			printf("...done\n");

			if (!opts.output_only) {
				//	set_problem(null_problem);
				root_client.start_run(opts.problem == DWD && !opts.found_restart_file).get();
			}
            root_client.report_timing();
		}
	} catch (...) {
        throw;
	}
	printf("Exiting...\n");
	return hpx::finalize();
}
开发者ID:sithhell,项目名称:octotiger,代码行数:64,代码来源:main.cpp


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