|
My Project
|
This file provides the infrastructure to retrieve run-time parameters. More...
#include <config.h>#include <opm/models/utils/parametersystem.hpp>#include <dune/common/parametertree.hh>#include <opm/models/utils/terminal.hpp>#include <charconv>#include <fstream>#include <memory>#include <stdexcept>#include <sys/ioctl.h>#include <unistd.h>Namespaces | |
| namespace | Opm |
| This file contains a set of helper functions used by VFPProd / VFPInj. | |
Functions | |
| template<class ParamType > | |
| ParamType | Opm::Parameters::detail::Get_ (const std::string ¶mName, ParamType defaultValue, bool errorIfNotRegistered) |
| Private implementation. | |
| void | Opm::Parameters::detail::Hide_ (const std::string ¶mName) |
| Private implementation. | |
| bool | Opm::Parameters::detail::IsSet_ (const std::string ¶mName, bool errorIfNotRegistered) |
| Private implementation. | |
| void | Opm::Parameters::detail::Register_ (const std::string ¶mName, const std::string ¶mTypeName, const std::string &defaultValue, const char *usageString) |
| Private implementation. | |
| void | Opm::Parameters::detail::SetDefault_ (const std::string ¶mName, const std::string ¶mValue) |
| Private implementation. | |
| void | Opm::Parameters::reset () |
| Reset parameter system. | |
| bool | Opm::Parameters::IsRegistrationOpen () |
| Query whether parameter registration is open or not. | |
| void | Opm::Parameters::endRegistration () |
| Indicate that all parameters are registered for a given type tag. | |
| void | Opm::Parameters::getLists (std::vector< Parameter > &usedParams, std::vector< Parameter > &unusedParams) |
| Retrieves the lists of parameters specified at runtime and their values. | |
| void | Opm::Parameters::printUsage (const std::string &helpPreamble, std::ostream &os, const std::string &errorMsg="", const bool showAll=false) |
| Print a usage message for all run-time parameters. | |
| bool | Opm::Parameters::parseParameterFile (const std::string &fileName, bool overwrite=true) |
| Read the parameters from an INI-style file. | |
| std::string | Opm::Parameters::parseCommandLineOptions (int argc, const char **argv, const PositionalArgumentCallback &posArgCallback, const std::string &helpPreamble="") |
| Parse the parameters provided on the command line. | |
| void | Opm::Parameters::printValues (std::ostream &os) |
| Print values of the run-time parameters. | |
| bool | Opm::Parameters::printUnused (std::ostream &os) |
| Print the list of unused run-time parameters. | |
| template bool | Opm::Parameters::detail::Get_ (const std::string &, bool, bool) |
| template double | Opm::Parameters::detail::Get_ (const std::string &, double, bool) |
| template float | Opm::Parameters::detail::Get_ (const std::string &, float, bool) |
| template int | Opm::Parameters::detail::Get_ (const std::string &, int, bool) |
| template long | Opm::Parameters::detail::Get_ (const std::string &, long, bool) |
| template std::string | Opm::Parameters::detail::Get_ (const std::string &, std::string, bool) |
| template unsigned | Opm::Parameters::detail::Get_ (const std::string &, unsigned, bool) |
This file provides the infrastructure to retrieve run-time parameters.
Internally, runtime parameters are implemented using Dune::ParameterTree with the default value taken from the parameter definition.
| void Opm::Parameters::endRegistration | ( | ) |
Indicate that all parameters are registered for a given type tag.
If registerParam is called after the invocation of endParamRegistration, a std::logic_error exception will be thrown.
| void Opm::Parameters::getLists | ( | std::vector< Parameter > & | usedParams, |
| std::vector< Parameter > & | unusedParams | ||
| ) |
Retrieves the lists of parameters specified at runtime and their values.
The two arguments besides the TypeTag are assumed to be STL containers which store std::pair<std::string, std::string>.
| bool Opm::Parameters::IsRegistrationOpen | ( | ) |
Query whether parameter registration is open or not.
| std::string Opm::Parameters::parseCommandLineOptions | ( | int | argc, |
| const char ** | argv, | ||
| const PositionalArgumentCallback & | posArgCallback, | ||
| const std::string & | helpPreamble = "" |
||
| ) |
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 |
| helpPreamble | If non-empty, the –help and -h parameters will be recognized and the content of the string will be printed before the list of command line parameters |
Read the parameters from an INI-style file.
This function does some basic syntax checks.
| bool Opm::Parameters::printUnused | ( | std::ostream & | os | ) |
Print the list of unused run-time parameters.
| os | The std::ostream on which the message should be printed |
| void Opm::Parameters::printUsage | ( | const std::string & | helpPreamble, |
| std::ostream & | os, | ||
| const std::string & | errorMsg = "", |
||
| const bool | showAll = false |
||
| ) |
Print a usage message for all run-time parameters.
| helpPreamble | The string that is printed after the error message and before the list of parameters. |
| errorMsg | The error message to be printed, if any |
| os | The std::ostream which should be used. |
| void Opm::Parameters::printValues | ( | std::ostream & | os | ) |
Print values of the run-time parameters.
| os | The std::ostream on which the message should be printed |