Classes | |
class | options |
Runtime config options provider. More... | |
Functions | |
int | get_rank () |
Get MPI rank during initialization. More... | |
template<typename T > | |
T | get_value (const string &name) |
get value of specific type T More... | |
template<typename T > | |
T | get_value (const string &name, const T &default_val) |
Get value of specific type T with default value. More... | |
static string | print_help (bool if_no_params=false) |
Compile basic help and usage information. More... | |
static void | read_config_file (const string &file_name) |
Read config parameters from file. More... | |
static void | read_commandline (int argc, char *argv[], bool exit_on_help=true) |
Read and parse command line parameters. More... | |
static void | init () |
Initialize options detection and parsing. More... | |
int pfasst::config::get_rank | ( | ) |
Get MPI rank during initialization.
When running without MPI (ie, without using mpirun/mpiexec), returns 0. When running with MPI, returns the MPI rank.
If the user is running with MPI and MPI_Init hasn't been called yet, this will return 0. I hope this is rare.
Definition at line 40 of file config.hpp.
References pfasst::log::initialized.
Referenced by pfasst::log::format_mpi_rank(), and read_commandline().
|
inline |
get value of specific type T
T | type of the retreived value |
[in] | name | Name of the (long) option as defined with option in options::add_option() |
T
of desired option. boost::bad_any_cast | if option is not given. |
Definition at line 150 of file config.hpp.
|
inline |
Get value of specific type T
with default value.
T | type of the retreived value |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 163 of file config.hpp.
|
inlinestatic |
Initialize options detection and parsing.
Prepopulates following groups and parameters:
Group | Parameter | Type |
---|---|---|
Global | h , help | bool |
Global | q , quiet | bool |
Global | input | string |
Global | log_prefix | string |
Global | c ,nocolor | bool |
Duration | dt | double |
Duration | tend | double |
Duration | num_iters | size_t |
Tolerances | abs_res_tol | double |
Tolerances | rel_res_tol | double |
Definition at line 300 of file config.hpp.
|
static |
Compile basic help and usage information.
Depending on if_no_params
and presence of given command line parameters the help and usage information is compiled. In case if_no_params
is true
and there are no parameters given on the command line or if_no_params
is false
no matter whether parameters are given, the help message is generated.
[in] | if_no_params | flag governing compilation of help and usage information |
Definition at line 181 of file config.hpp.
Referenced by read_commandline().
|
inlinestatic |
Read and parse command line parameters.
[in] | argc | Number of command line arguments as provided by main(int, char**) . |
[in] | argv | List of command line arguments as provided by main(int, char**) . |
[in] | exit_on_help | Whether to exit the program after displaying help and usage information. |
std::exit
in case the help
parameter has been provided and exit_on_help
is true
. Definition at line 253 of file config.hpp.
References get_rank(), print_help(), and read_config_file().
Referenced by pfasst::init().
|
inlinestatic |
Read config parameters from file.
A potential INI file might look like the following:
[in] | file_name | name of the INI-like file containing config parameters; path/name may be relative |
invalid_argument | if the given file could not be opened |
Definition at line 230 of file config.hpp.
Referenced by read_commandline().