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


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

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


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

示例1: if


//.........这里部分代码省略.........
                    }
                    // 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") {
                        if (p.size() == 1)
                            solver = new FIM<grid_t>(p[0].c_str());
                        else if (p.size() == 2)
                            solver = new FIM<grid_t>(p[0].c_str(), boost::lexical_cast<double>(p[1]));
                    }
                    // UFMM
                    else if (name == "ufmm") {
                        if (p.size() == 1)
                            solver = new UFMM<grid_t>(p[0].c_str());
                        else if (p.size() == 2)
                            solver = new UFMM<grid_t>(p[0].c_str(), boost::lexical_cast<unsigned>(p[1]));
                        else if (p.size() == 3)
                            solver = new UFMM<grid_t>(p[0].c_str(), boost::lexical_cast<unsigned>(p[1]), boost::lexical_cast<double>(p[2]));
                    }
                    // FSM
                    else if (name == "fsm") {
                        if (p.size() == 1)
                            solver = new FSM<grid_t>(p[0].c_str());
                        else if (p.size() == 2)
                            solver = new FSM<grid_t>(p[0].c_str(), boost::lexical_cast<unsigned>(p[1]));
                    }
                    // LSM
                    else if (name == "lsm") {
                        if (p.size() == 1)
                            solver = new LSM<grid_t>(p[0].c_str());
                        else if (p.size() == 2)
                            solver = new LSM<grid_t>(p[0].c_str(), boost::lexical_cast<unsigned>(p[1]));
                    }
                    // DDQM
                    else if (name == "ddqm") {
                        solver = new LSM<grid_t>(p[0].c_str());
                    }
                    // Add solver here.

                    else
                        continue;
                }

                b.addSolver(solver);
            }

            constexpr size_t N = grid_t::getNDims();
            grid_t * grid = new grid_t();
            if (options_.find("grid.file") != options_.end())
                MapLoader::loadMapFromImg(options_.find("grid.file")->second.c_str(), *grid);
            else if (options_.find("grid.text") != options_.end()) {
                if(!MapLoader::loadMapFromText(options_.find("grid.text")->second.c_str(), *grid))
                    exit(1);
            }
            else {
                const std::string & strToSplit = options_.find("grid.dimsize")->second;
                std::array<unsigned int, N> dimSize = splitAndCast<unsigned int, N>(strToSplit);
                grid->resize(dimSize);
            }

            grid->setLeafSize(getValue<double>("grid.leafsize"));

            const std::string & strToSplit2 = options_.find("problem.start")->second;
            std::array<unsigned int, N> startCoords = splitAndCast<unsigned int, N>(strToSplit2);
            unsigned int startIdx;
            std::vector<unsigned int> startIndices;
            grid->coord2idx(startCoords, startIdx);
            startIndices.push_back(startIdx);

            const std::string & strToSplit3 = options_.find("problem.goal")->second;
            if (strToSplit3 != "nan")
            {
                unsigned int goalIdx;
                std::array<unsigned int, N> goalCoords = splitAndCast<unsigned int, N>(strToSplit3);
                grid->coord2idx(goalCoords, goalIdx);
                b.setInitialAndGoalPoints(startIndices, goalIdx);
            }
            else
                b.setInitialPoints(startIndices);

            b.setEnvironment(grid);
        }
开发者ID:ImaduddinAMajid,项目名称:fastmarching,代码行数:101,代码来源:benchmarkcfg.hpp


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