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


C++ Benchmark::fromCFG方法代码示例

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


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

示例1: if

        void configure
        (Benchmark<grid_t> & b) {
            b.setSaveLog(true);
            b.setName(getValue<std::string>("benchmark.name"));
            b.setSaveGrid(getValue<unsigned int>("benchmark.savegrid"));
            b.setNRuns(getValue<unsigned int>("benchmark.runs"));
            b.setPath(boost::filesystem::path("results"));
            b.fromCFG(true);

            for (size_t i = 0; i < solverNames_.size(); ++i)
            {
                const std::string & name = solverNames_[i];

                bool defaultCtor = true;
                if (!ctorParams_[i].empty())
                    defaultCtor = false;

                Solver<grid_t> * solver;

                if (defaultCtor) {
                    if (name == "fmm")
                        solver = new FMM<grid_t>();
                    else if (name == "fmmstar")
                        solver = new FMMStar<grid_t>();
                    else if (name == "fmmfib")
                        solver = new FMM<grid_t, FMFibHeap<cell_t> >("FMMFib");
                    else if (name == "fmmfibstar")
                        solver = new FMMStar<grid_t,  FMFibHeap<cell_t> >("FMMFib*");
                    else if (name == "sfmm")
                        solver = new SFMM<grid_t>("SFMM");
                    else if (name == "sfmmstar")
                        solver = new SFMMStar<grid_t>("SFMM*");
                    else if (name == "gmm")
                        solver = new GMM<grid_t>();
                    else if (name == "fim")
                        solver = new FIM<grid_t>();
                    else if (name == "ufmm")
                        solver = new UFMM<grid_t>();
                    else if (name == "fsm")
                        solver = new FSM<grid_t>();
                    else if (name == "lsm")
                        solver = new LSM<grid_t>();
                    else if (name == "ddqm")
                        solver = new DDQM<grid_t>();
                    // Add solver here.

                    else
                        continue;
                }
                else { // Create solvers with specified constructor parameters.
                    std::vector<std::string> p(split(ctorParams_[i]));

                    // FMM and FMM*
                    if (name == "fmm")
                        solver = new FMM<grid_t>(ctorParams_[i].c_str());
                    else if (name == "fmmstar") {
                        if (p.size() == 1)
                            solver = new FMMStar<grid_t>(p[0].c_str());
                        else if (p.size() == 2) {
                            if (p[1] == "TIME")
                                solver = new FMMStar<grid_t>(p[0].c_str(), TIME);
                            else if (p[1] == "DISTANCE")
                                solver = new FMMStar<grid_t>(p[0].c_str(), DISTANCE);
                        }
                    }
                    // FMMFib and FMMFib*
                    else if (name == "fmmfib")
                        solver = new FMM<grid_t, FMFibHeap<cell_t> >(ctorParams_[i].c_str());
                    else if (name == "fmmfibstar") {
                        if (p.size() == 1)
                            solver = new FMMStar<grid_t, FMFibHeap<cell_t>>(p[0].c_str());
                        else if (p.size() == 2) {
                            if (p[1] == "TIME")
                                solver = new FMMStar<grid_t, FMFibHeap<cell_t>>(p[0].c_str(), TIME);
                            else if (p[1] == "DISTANCE")
                                solver = new FMMStar<grid_t, FMFibHeap<cell_t>>(p[0].c_str(), DISTANCE);
                        }
                    }
                    // SFMM and SFMM*
                    else if (name == "sfmm")
                        solver = new SFMM<grid_t, cell_t>(ctorParams_[i].c_str());
                    else if (name == "sfmmstar") {
                        if (p.size() == 1)
                            solver = new SFMMStar<grid_t, cell_t>(p[0].c_str());
                        else if (p.size() == 2) {
                            if (p[1] == "TIME")
                                solver = new SFMMStar<grid_t, cell_t>(p[0].c_str(), TIME);
                            else if (p[1] == "DISTANCE")
                                solver = new SFMMStar<grid_t, cell_t>(p[0].c_str(), DISTANCE);
                        }
                    }
                    // GMM
                    else if (name == "gmm") {
                        if (p.size() == 1)
                            solver = new GMM<grid_t>(p[0].c_str());
                        else if (p.size() == 2)
                            solver = new GMM<grid_t>(p[0].c_str(), boost::lexical_cast<double>(p[1]));
                    }
                    // FIM
                    else if (name == "fim") {
//.........这里部分代码省略.........
开发者ID:ImaduddinAMajid,项目名称:fastmarching,代码行数:101,代码来源:benchmarkcfg.hpp


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