dune-fem 2.8.0
|
Container for User Specified Parameters. More...
#include <dune/fem/io/parameter.hh>
Static Public Member Functions | |
static ParameterContainer & | container () |
static void | append (int &argc, char **argv) |
add parameters from the command line RangeType gRight; | |
static void | append (const std::string &key, const std::string &value, const bool force=false) |
add a single parameter to the container | |
template<class NumberType > | |
static void | append (const std::string &key, const NumberType &value, const bool force=false) |
add a single parameter to the container | |
static void | append (const std::string &filename) |
add parameters from a file to the container | |
static void | appendDGF (const std::string &filename) |
add parameters from a DGF file to the container | |
static bool | exists (const std::string &key) |
find out, whether a parameter is defined in the container | |
template<class T > | |
static void | get (const std::string &key, T &value) |
get a mandatory parameter from the container | |
template<class T > | |
static void | get (const std::string &key, const T &defaultValue, T &value) |
get an optional parameter from the container | |
static void | get (const std::string &key, const char *defaultValue, std::string &value) |
get an optional parameter from the container special case for string | |
template<class T , class Validator > | |
static void | getValid (const std::string &key, const Validator &validator, T &value) |
get a mandatory parameter from the container | |
template<class T , class Validator > | |
static void | getValid (const std::string &key, const T &defaultValue, const Validator &validator, T &value) |
get an optional parameter from the container | |
template<class T > | |
static T | getValue (const std::string &key) |
get a mandatory parameter from the container | |
template<class T > | |
static T | getValue (const std::string &key, const T &defaultValue) |
get an optional parameter from the container | |
template<class T , class Validator > | |
static T | getValidValue (const std::string &key, const Validator &validator) |
get an optional parameter from the container | |
template<class T , class Validator > | |
static T | getValidValue (const std::string &key, const T &defaultValue, const Validator &validator) |
get an optional parameter from the container | |
template<int n> | |
static int | getEnum (const std::string &key, const std::string(&values)[n]) |
template<int n> | |
static int | getEnum (const std::string &key, const std::string(&values)[n], int defaultValue) |
static std::string | commonOutputPath () |
obtain common output path | |
static std::string | outputPath () |
obtain unique output path for this process | |
static std::string | commonInputPath () |
obtain common input path | |
static bool | verbose () |
obtain the cached value for fem.verbose | |
static void | write (const std::string &filename, const std::string &fileextension="", bool writeAll=true) |
write the parameter database to a file | |
static void | write (std::ostream &out, bool writeAll=true) |
write the parameter database to a stream | |
Static Protected Member Functions | |
static void | write (const std::string &path, const std::string &filename, const std::string &fileextension, bool writeAll=true) |
write the parameter database to a file | |
Container for User Specified Parameters.
The class Parameter provides parameters collected from given parameter files or the command line in a unified and easy to use way.
This class adheres to the singleton concept, i.e., all methods are static and internally use a single instance of this object to store all data.
|
inlinestatic |
add parameters from a file to the container
[in] | filename | name of the file containing the parameters |
|
inlinestatic |
add a single parameter to the container
[in] | key | key of the parameter to add |
[in] | value | value of the parameter to add |
|
inlinestatic |
add a single parameter to the container
[in] | key | key of the parameter to add |
[in] | value | value of the parameter to add |
|
inlinestatic |
add parameters from the command line RangeType gRight;
This mehtod adds all parameters (strings containing a colon) in the command line to the container. The parameters are then removed from the command line.
[in] | argc | number of arguments (as given to main) |
[in] | argv | vector of arguments (as given to main) |
|
inlinestatic |
add parameters from a DGF file to the container
Parameters can also be read from a DGF file containing a 'FemParameter' block.
[in] | filename | name of the DGF file containing the parameters |
|
inlinestatic |
obtain common input path
This common input path could for example be used for the determination of the location of parameter and grid files
|
inlinestatic |
obtain common output path
For parallel jobs you need two different output paths:
|
inlinestatic |
|
inlinestatic |
find out, whether a parameter is defined in the container
[in] | key | name of the parameter to check |
|
inlinestatic |
get an optional parameter from the container special case for string
[in] | key | name of the parameter to get |
[in] | defaultValue | default value for this parameter |
[out] | value | value of the parameter |
|
inlinestatic |
get an optional parameter from the container
[in] | key | name of the parameter to get |
[in] | defaultValue | default value for this parameter |
[out] | value | value of the parameter |
|
inlinestatic |
get a mandatory parameter from the container
[in] | key | name of the parameter to get |
[out] | value | value of the parameter |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
get an optional parameter from the container
[in] | key | name of the parameter to get |
[in] | defaultValue | default value for this parameter |
[in] | validator | validator for the parameter value |
[out] | value | value of the parameter |
|
inlinestatic |
get a mandatory parameter from the container
[in] | key | name of the parameter to get |
[in] | validator | validator for the parameter value |
[out] | value | value of the parameter |
|
inlinestatic |
get an optional parameter from the container
[in] | key | name of the parameter to get |
[in] | defaultValue | default value for this parameter |
[in] | validator | validator for the parameter value |
|
inlinestatic |
get an optional parameter from the container
[in] | key | name of the parameter to get |
[in] | validator | validator for the parameter value |
|
inlinestatic |
get a mandatory parameter from the container
[in] | key | name of the parameter to get |
|
inlinestatic |
get an optional parameter from the container
[in] | key | name of the parameter to get |
[in] | defaultValue | default value for this parameter |
|
inlinestatic |
obtain unique output path for this process
For parallel jobs you need two different output paths:
|
inlinestatic |
obtain the cached value for fem.verbose
|
inlinestatic |
write the parameter database to a file
This method writes paramters to the given file. If the second parameter is true all parameters are written; otherwise only used parameters which do not coincide with the default value are written.
[in] | filename | name of the file to store the parameters in; prefix() is used. |
[in] | fileextension | file extension if you want to have time stemps in the log files, ! must contain the "." dot for fileextensions ! |
[in] | writeAll | default is true |
|
inlinestaticprotected |
write the parameter database to a file
This method writes paramters to the given file. If the second parameter is true all parameters are written; otherwise only used parameters which do not coincide with the default value are written.
[in] | path | path where filename is stored (for parallel writing) |
[in] | filename | name of the file to store the parameters in; prefix() is used. |
[in] | fileextension | chosen fileextension |
[in] | writeAll | default is true |
|
inlinestatic |
write the parameter database to a stream
This method writes paramters to the given stream. If the second parameter is true all parameters are written; otherwise only used parameters which do not coincide with the default value are written.
[in] | out | stream for the parameters. |
[in] | writeAll | default is true |