The parameters system. More...
Macros | |
#define | EWOMS_REGISTER_PARAM(TypeTag, ParamType, ParamName, Description) |
Register a run-time parameter. More... | |
#define | EWOMS_END_PARAM_REGISTRATION(TypeTag) ::Ewoms::Parameters::endParamRegistration<TypeTag>() |
Indicate that all parameters are registered for a given type tag. More... | |
#define | EWOMS_GET_PARAM(TypeTag, ParamType, ParamName) |
Retrieve a runtime parameter. More... | |
Functions | |
template<class TypeTag > | |
void | printUsage (const std::string &progName, const std::string &errorMsg="", bool handleHelp=true, std::ostream &os=std::cerr) |
Print a usage message for all run-time parameters. More... | |
template<class TypeTag > | |
std::string | parseCommandLineOptions (int argc, char **argv, bool handleHelp=true) |
Parse the parameters provided on the command line. More... | |
template<class TypeTag > | |
void | printValues (std::ostream &os=std::cout) |
Print values of the run-time parameters. More... | |
template<class TypeTag > | |
bool | printUnused (std::ostream &os=std::cout) |
Print the list of unused run-time parameters. More... | |
The parameters system.
Parameters allow to specify values at runtime (either via command line arguments or by means of a .INI file) and thus cannot be used to specify types as properties can. Also all parameters fall back to the value of the property of the same as the parameter, so this property must exist and be defined.
#define EWOMS_END_PARAM_REGISTRATION | ( | TypeTag | ) | ::Ewoms::Parameters::endParamRegistration<TypeTag>() |
Indicate that all parameters are registered for a given type tag.
If EWOMS_REGISTER_PARAM
is called after the invokation of END_PARAM_REGISTRATION
, a std::logic_error
exception will be thrown.
#define EWOMS_GET_PARAM | ( | TypeTag, | |
ParamType, | |||
ParamName | |||
) |
Retrieve a runtime parameter.
The default value is specified via the property system.
Example:
#define EWOMS_REGISTER_PARAM | ( | TypeTag, | |
ParamType, | |||
ParamName, | |||
Description | |||
) |
Register a run-time parameter.
In OPM, parameters can only be used after they have been registered.
Example:
std::string parseCommandLineOptions | ( | int | argc, |
char ** | argv, | ||
bool | handleHelp = true |
||
) |
Parse the parameters provided on the command line.
This function does some basic syntax checks.
argc | The number of parameters passed by the operating system to the main() function |
argv | The array of strings passed by the operating system to the main() function |
handleHelp | Set to true if the function should deal with the -h and –help parameters |
bool printUnused | ( | std::ostream & | os = std::cout | ) |
Print the list of unused run-time parameters.
os | The std::ostream on which the message should be printed |
void printUsage | ( | const std::string & | progName, |
const std::string & | errorMsg = "" , |
||
bool | handleHelp = true , |
||
std::ostream & | os = std::cerr |
||
) |
Print a usage message for all run-time parameters.
os | The std::ostream which should be used. |
progName | The name of the program |
void printValues | ( | std::ostream & | os = std::cout | ) |
Print values of the run-time parameters.
os | The std::ostream on which the message should be printed |