73 #ifndef commandline_parser_hpp
74 #define commandline_parser_hpp
82 typedef std::map<std::string, std::string>
arg_map;
109 for (
size_t i = 1; i < argc; i++) {
110 std::string arg(argv[i]);
115 size_t eqpos = arg.find(
'=');
116 if (eqpos != std::string::npos) {
117 std::string key = arg.substr(0, eqpos);
118 std::string value = arg.substr(eqpos + 1, std::string::npos);
146 bool is_set(
const std::string &key)
const {
156 template<
typename TYPE>
157 TYPE
get(
const std::string &key)
const {
162 std::stringstream value_stream(
commands.at(key));
164 value_stream >> temp;
174 std::cout <<
" " << std::endl;
175 std::cout <<
" SIESTA TEST " << std::endl;
176 std::cout <<
" " << std::endl;
177 std::cout <<
"Usage: xsiesta_test [-arg][=option] ... " << std::endl;
178 std::cout <<
" " << std::endl;
179 std::cout <<
"Options: " << std::endl;
180 std::cout <<
"All options are displayes as [arg][takesoption][Discription] " << std::endl;
181 std::cout <<
" -h N Display this information. " << std::endl;
182 std::cout <<
" " << std::endl;
183 std::cout <<
" -wout_file Y Path to the VMEC wout file. " << std::endl;
184 std::cout <<
" " << std::endl;
185 std::cout <<
" -restart_file Y Path to the SIESTA restart file. " << std::endl;
186 std::cout <<
" " << std::endl;
187 std::cout <<
" -test_name Y Name of the test to run. " << std::endl;
188 std::cout <<
" " << std::endl;
189 std::cout <<
" -tol Y Tolarance value. " << std::endl;
190 std::cout <<
" " << std::endl;
191 std::cout <<
" -min Y Minimum radial value. " << std::endl;
192 std::cout <<
" " << std::endl;
193 std::cout <<
" -max Y Maximum radial value. " << std::endl;
194 std::cout <<
" " << std::endl;
195 std::cout <<
" -relative N Use relative error. " << std::endl;
196 std::cout <<
" " << std::endl;
197 std::cout <<
" -dump N Dump values to the screen. " << std::endl;
198 std::cout <<
" " << std::endl;
199 std::cout <<
" -u Y Poloidal angle to dump. " << std::endl;
200 std::cout <<
" " << std::endl;
201 std::cout <<
" -v Y Toroidal angle to dump.. " << std::endl;
202 std::cout <<
" " << std::endl;
203 std::cout << std::endl;
static arg_map parse_commands(const size_t argc, const char *argv[])
Factory method to parse the commandline and produce the arguments.
Definition: commandline_parser.hpp:101
bool is_set(const std::string &key) const
Check if command arg was set.
Definition: commandline_parser.hpp:146
commandline_parser(const size_t argc, const char *argv[])
Construct a commandline_parser object by pasring command line arguments.
Definition: commandline_parser.hpp:137
TYPE get(const std::string &key) const
Get the value of the agument.
Definition: commandline_parser.hpp:157
static void help()
Display help.
Definition: commandline_parser.hpp:172
const arg_map commands
Parsed commands.
Definition: commandline_parser.hpp:92
std::pair< std::string, std::string > arg_element
Type for a key value pair.
Definition: commandline_parser.hpp:84
std::map< std::string, std::string > arg_map
Type for the argument map.
Definition: commandline_parser.hpp:82
Defines the base class of the type commandline_parser_class.
Definition: commandline_parser.f:65