version 3.11-dev
Loading...
Searching...
No Matches

Parameter class managing runtime input parameters. More...

#include <dumux/common/parameters.hh>

Description

Static Public Member Functions

static void init (int argc, char **argv, const Usage &usage)
 Initialize the parameter tree singletons.
static void init (int argc, char **argv, std::string parameterFileName, const Usage &usage=[](const char *, const std::string &){})
 Initialize the parameter tree singletons.
static void init (int argc, char **argv, const DefaultParams &defaultParams, const Usage &usage)
 Initialize the parameter tree singletons.
static void init (int argc, char **argv, const DefaultParams &defaultParams=[](Dune::ParameterTree &) {}, std::string parameterFileName="", const Usage &usage=[](const char *, const std::string &){})
 Initialize the parameter tree.
static void init (const DefaultParams &params=[](Dune::ParameterTree &) {}, const DefaultParams &defaultParams=[](Dune::ParameterTree &) {})
 Initialize the parameter tree.
static void init (const std::string &parameterFileName, const DefaultParams &params=[](Dune::ParameterTree &) {}, bool inputFileOverwritesParams=true, const DefaultParams &defaultParams=[](Dune::ParameterTree &) {})
 Initialize the parameter tree.
static void reset ()
 Discard all parameters and the record of which parameters have been used.
static void print ()
 prints all used and unused parameters
static Dune::ParameterTree parseCommandLine (int argc, char **argv)
 Parse command line arguments into a parameter tree.
static const LoggingParameterTree & getTree ()
 Get the parameter tree.

Member Function Documentation

◆ getTree()

const LoggingParameterTree & Dumux::Parameters::getTree ( )
static

The logging parameter tree recording which parameters are used during the simulation

◆ init() [1/6]

void Dumux::Parameters::init ( const DefaultParams & params = [] (Dune::ParameterTree&) {},
const DefaultParams & defaultParams = [] (Dune::ParameterTree&) {} )
static
Parameters
paramsa function that sets parameters of the runtime parameter tree
defaultParamsa function that sets parameters of the default runtim parameter tree
Note
if a parameter is looked up without explicitly providing a default, the default tree is consulted if the parameter could not be found in the parameter tree

◆ init() [2/6]

void Dumux::Parameters::init ( const std::string & parameterFileName,
const DefaultParams & params = [] (Dune::ParameterTree&) {},
bool inputFileOverwritesParams = true,
const DefaultParams & defaultParams = [] (Dune::ParameterTree&) {} )
static
Parameters
parameterFileNamean input parameter file name
paramsa parameter tree with runtime parameters
inputFileOverwritesParamsif set to true (default) the parameters from the input file have precedence, if set to false the input the parameters provided via params have precedence
defaultParamsa parameter tree with default parameters
Note
the params function overwrites
if a parameter is looked up without explicitly providing a default, the default tree is consulted if the parameter could not be found in the parameter tree

◆ init() [3/6]

void Dumux::Parameters::init ( int argc,
char ** argv,
const DefaultParams & defaultParams,
const Usage & usage )
static

◆ init() [4/6]

void Dumux::Parameters::init ( int argc,
char ** argv,
const DefaultParams & defaultParams = [] (Dune::ParameterTree&) {},
std::string parameterFileName = "",
const Usage & usage = [](const char *, const std::string &){} )
static
Parameters
argcnumber of command line argument (forwarded from main)
argvcommand line argument (forwarded from main)
defaultParamsa function that sets parameters of the default runtime parameter tree
parameterFileNamethe file name of the input file
usagethe usage function to print if the help option was passed on the command line
Note
the default parameter tree is initialized in the following way 1) global defaults (see member function applyGlobalDefaults_) 2) user provided defaults (overwrite global defaults) the parameter tree is initialized in the following way 1) parameters from the input file 2) parameters from the command line (overwrite input file parameters)
if a parameter is looked up without explicitly providing a default, the default tree is consulted if the parameter could not be found in the parameter tree

◆ init() [5/6]

void Dumux::Parameters::init ( int argc,
char ** argv,
const Usage & usage )
static

◆ init() [6/6]

void Dumux::Parameters::init ( int argc,
char ** argv,
std::string parameterFileName,
const Usage & usage = [](const char *, const std::string &){} )
static

◆ parseCommandLine()

Dune::ParameterTree Dumux::Parameters::parseCommandLine ( int argc,
char ** argv )
static

◆ print()

void Dumux::Parameters::print ( )
static

◆ reset()

void Dumux::Parameters::reset ( )
static

The parameter tree is a singleton and init merges into it rather than replacing it, so parameters set by one init are still visible after the next one. A program that initializes repeatedly, e.g. a Python binding running a model many times, otherwise inherits every parameter ever set, including ones the current run leaves out. Call this before init to start from an empty parameter tree.

Note
Parameter values that were read into static variables keep their values.

The documentation for this class was generated from the following files: