MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / parseArguments

Function parseArguments

src/tools/partition.cpp:73–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73return_code parseArguments(int argc,
74 char *argv[],
75 std::string &verbosity,
76 partitioner::PartitionerConfig &config)
77{
78 // declare a group of options that will be allowed only on command line
79 boost::program_options::options_description generic_options("Options");
80 generic_options.add_options()("version,v", "Show version")("help,h", "Show this help message")(
81 "list-inputs", "List required and optional input file extensions")(
82 "verbosity,l",
83 boost::program_options::value<std::string>(&verbosity)->default_value("INFO"),
84 std::string("Log verbosity level: " + util::LogPolicy::GetLevels()).c_str());
85
86 // declare a group of options that will be allowed both on command line
87 boost::program_options::options_description config_options("Configuration");
88 config_options.add_options()
89 //
90 ("threads,t",
91 boost::program_options::value<unsigned int>(&config.requested_num_threads)
92 ->default_value(std::thread::hardware_concurrency()),
93 "Number of threads to use")
94 //
95 ("balance",
96 boost::program_options::value<double>(&config.balance)->default_value(config.balance),
97 "Balance for left and right side in single bisection")
98 //
99 ("boundary",
100 boost::program_options::value<double>(&config.boundary_factor)
101 ->default_value(config.boundary_factor),
102 "Percentage of embedded nodes to contract as sources and sinks")
103 //
104 ("optimizing-cuts",
105 boost::program_options::value<std::size_t>(&config.num_optimizing_cuts)
106 ->default_value(config.num_optimizing_cuts),
107 "Number of cuts to use for optimizing a single bisection")
108 //
109 ("small-component-size",
110 boost::program_options::value<std::size_t>(&config.small_component_size)
111 ->default_value(config.small_component_size),
112 "Size threshold for small components.")
113 //
114 ("max-cell-sizes",
115 boost::program_options::value<MaxCellSizesArgument>()->default_value(
116 MaxCellSizesArgument{config.max_cell_sizes}),
117 "Maximum cell sizes starting from the level 1. The first cell size value is a bisection "
118 "termination citerion");
119
120 // hidden options, will be allowed on command line, but will not be
121 // shown to the user
122 boost::program_options::options_description hidden_options("Hidden options");
123 hidden_options.add_options()(
124 "input,i",
125 boost::program_options::value<std::filesystem::path>(&config.base_path),
126 "Input base file path");
127
128 // positional option
129 boost::program_options::positional_options_description positional_options;
130 positional_options.add("input", 1);

Callers 1

mainFunction · 0.70

Calls 8

LogClass · 0.85
addMethod · 0.80
whatMethod · 0.80
containsMethod · 0.80
ListInputFilesMethod · 0.80
runMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected