![]() |
FlowSieve
3.4.0
FlowSieve Coarse-Graining Documentation
|
Class to process command-line arguments. More...
#include <functions.hpp>
Public Member Functions | |
| InputParser (int &argc, char **argv) | |
| const std::string | getCmdOption (const std::string &option, const std::string &default_value="", const bool help=false, const std::string &description="") const |
| bool | cmdOptionExists (const std::string &option) const |
| void | getFilterScales (std::vector< double > &filter_scales, const std::string &argname, const bool help=false) const |
| void | getListofStrings (std::vector< std::string > &list_of_strings, const std::string &argname, const bool help=false, const std::string &description="") const |
Class to process command-line arguments.
This parser tool was provided by StackOverflow user 'iain' at the following post. mild modifications have been made to adapt the code to our purposes.
https://stackoverflow.com/questions/865668/how-to-parse-command-line-arguments-in-c
| bool InputParser::cmdOptionExists | ( | const std::string & | option | ) | const |
Check if command-line option <option> was passed at run-time
| const std::string InputParser::getCmdOption | ( | const std::string & | option, |
| const std::string & | default_value = "", |
||
| const bool | help = false, |
||
| const std::string & | description = "" |
||
| ) | const |
If command-line option <option> was passed at run-time, return the value, otherwise return the default

| void InputParser::getFilterScales | ( | std::vector< double > & | filter_scales, |
| const std::string & | argname, | ||
| const bool | help = false |
||
| ) | const |
Extract, parse, and format, the string of filter scales that was provided at run-time. Assumes a string of space-delimited numbers (e.g. "1.3e3 2.4e5 8.9e9")

| void InputParser::getListofStrings | ( | std::vector< std::string > & | list_of_strings, |
| const std::string & | argname, | ||
| const bool | help = false, |
||
| const std::string & | description = "" |
||
| ) | const |
Extract, parse, and format, a list of strings. This is typically a list of variable names. Assumes a string of space-delimited strings (e.g. "rho u v")
