24#ifndef DUMUX_PARAMETERS_HH
25#define DUMUX_PARAMETERS_HH
30#include <unordered_map>
34#include <dune/common/parametertree.hh>
48 using DefaultParams = std::function<void (Dune::ParameterTree&)>;
49 using Usage = std::function<void (
const char *,
const std::string &)>;
54 static void init(
int argc,
char **argv,
const Usage& usage);
57 static void init(
int argc,
char **argv,
58 std::string parameterFileName,
59 const Usage& usage = [](
const char *,
const std::string &){});
62 static void init(
int argc,
char **argv,
63 const DefaultParams& defaultParams,
82 static void init(
int argc,
char **argv,
83 const DefaultParams& defaultParams = [] (Dune::ParameterTree&) {},
84 std::string parameterFileName =
"",
85 const Usage& usage = [](
const char *,
const std::string &){});
94 static void init(
const DefaultParams& params = [] (Dune::ParameterTree&) {},
95 const DefaultParams& defaultParams = [] (Dune::ParameterTree&) {});
108 static void init(
const std::string& parameterFileName,
109 const DefaultParams& params = [] (Dune::ParameterTree&) {},
110 bool inputFileOverwritesParams =
true,
111 const DefaultParams& defaultParams = [] (Dune::ParameterTree&) {});
128 static Dune::ParameterTree& paramTree_();
131 static Dune::ParameterTree& defaultParamTree_();
135 static void applyGlobalDefaults_(Dune::ParameterTree& params);
138 static void mergeTree_(Dune::ParameterTree& target,
const Dune::ParameterTree& source,
bool overwrite =
true);
141 static void mergeTreeImpl_(Dune::ParameterTree& target,
const Dune::ParameterTree& source,
bool overwrite,
const std::string& group);
150template<
typename T,
typename... Args>
160template<
typename T,
typename... Args>
185inline std::vector<std::string>
getParamSubGroups(
const std::string& subGroupName,
const std::string& paramGroup)
Function printing a default usage message.
A parameter tree that logs which parameters have been used.
std::vector< std::string > getParamSubGroups(const std::string &subGroupName, const std::string ¶mGroup)
Get a list of sub groups from the parameter tree sorted by relevance.
Definition: parameters.hh:185
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition: parameters.hh:161
bool hasParamInGroup(const std::string ¶mGroup, const std::string ¶m)
Check whether a key exists in the parameter tree with a model group prefix.
Definition: parameters.hh:177
bool hasParam(const std::string ¶m)
Check whether a key exists in the parameter tree.
Definition: parameters.hh:169
T getParam(Args &&... args)
A free function to get a parameter from the parameter tree singleton.
Definition: parameters.hh:151
A parameter tree that logs which parameters have been used.
Definition: loggingparametertree.hh:43
std::vector< std::string > getSubGroups(const std::string &subGroupName, std::string groupPrefix) const
obtain a vector of all full group names for a specified subgroup name
Definition: loggingparametertree.hh:133
bool hasKeyInGroup(const std::string &key, const std::string &groupPrefix) const
test for key in group
Definition: loggingparametertree.hh:90
bool hasKey(const std::string &key) const
test for key
Definition: loggingparametertree.hh:72
Parameter class managing runtime input parameters.
Definition: parameters.hh:46
static const LoggingParameterTree & getTree()
Get the parameter tree.
Definition: parameters.cc:223
static void print()
prints all used and unused parameters
Definition: parameters.cc:176
static void init(int argc, char **argv, const Usage &usage)
Initialize the parameter tree singletons.
Definition: parameters.cc:45
static Dune::ParameterTree parseCommandLine(int argc, char **argv)
Parse command line arguments into a parameter tree.
Definition: parameters.cc:182