36#ifndef OPM_PARAMETERGROUP_HEADER
37#define OPM_PARAMETERGROUP_HEADER
44#include <opm/common/utility/parameters/ParameterMapItem.hpp>
45#include <opm/common/utility/parameters/ParameterRequirement.hpp>
92 const bool enable_output);
96 std::string
getTag()
const override;
114 template <
typename StringArray>
115 ParameterGroup(
int argc, StringArray argv,
const bool verify_syntax =
true,
116 const bool enabled_output=
true);
124 bool has(
const std::string& name)
const;
136 T
get(
const std::string& name)
const;
138 template<
typename T,
class Requirement>
139 T
get(
const std::string& name,
const Requirement&)
const;
158 const T& default_value)
const;
160 template<
typename T,
class Requirement>
162 const T& default_value,
163 const Requirement& r)
const;
200 void readParam(
const std::string& param_filename);
206 void writeParam(
const std::string& param_filename)
const;
216 void get(
const char* name, T& value,
const T& default_value)
const {
217 value = this->getDefault<T>(name, default_value);
222 void get(
const char* name, T& value)
const {
223 value = this->get<T>(name);
233 std::string
path()
const;
236 void insert(
const std::string& name,
237 const std::shared_ptr<ParameterMapItem>& data);
240 void insertParameter(
const std::string& name,
const std::string& value);
246 typedef std::shared_ptr<ParameterMapItem> data_type;
247 typedef std::pair<std::string, data_type> pair_type;
248 typedef std::map<std::string, data_type> map_type;
253 bool output_is_enabled_;
254 std::vector<std::string> unhandled_arguments_;
256 template<
typename T,
class Requirement>
257 T translate(
const pair_type& data,
const Requirement& chk)
const;
258 template <
typename StringArray>
259 void parseCommandLineArguments(
int argc, StringArray argv,
bool verify_syntax);
260 void recursiveSetIsOutputEnabled(
bool output_is_enabled);
263 template <
typename T>
264 static std::string to_string(
const T& val);
265 static std::pair<std::string, std::string>
266 filename_split(
const std::string& filename);
270#include <opm/common/utility/parameters/ParameterGroup_impl.hpp>
ParameterGroup is a class that is used to provide run-time parameters.
Definition ParameterGroup.hpp:81
std::string path() const
Returns the path of the parameter group.
Definition ParameterGroup.cpp:82
void insert(const std::string &name, const std::shared_ptr< ParameterMapItem > &data)
Insert a new item into the group.
Definition ParameterGroup.cpp:168
void get(const char *name, T &value, const T &default_value) const
vki param interface - deprecated
Definition ParameterGroup.hpp:216
bool anyUnused() const
Return true if any parameters are unused.
Definition ParameterGroup.cpp:265
ParameterGroup getGroup(const std::string &name) const
This method returns the parameter group given by name, i.e.
Definition ParameterGroup.cpp:94
const std::vector< std::string > & unhandledArguments() const
Unhandled arguments from command line parsing.
Definition ParameterGroup.cpp:326
void writeParam(const std::string ¶m_filename) const
Writes this ParameterGroup into a param file specified by param_filename.
Definition ParameterGroup.cpp:138
void disableOutput()
Disables the output from get, getDefault and getGroup.
Definition ParameterGroup.cpp:303
void insertParameter(const std::string &name, const std::string &value)
Insert a new parameter item into the group.
Definition ParameterGroup.cpp:200
void writeParamToStream(std::ostream &stream) const
Writes this ParameterGroup to a stream.
Definition ParameterGroup.cpp:148
void enableOutput()
Enables the output from get, getDefault and getGroup.
Definition ParameterGroup.cpp:307
std::string getTag() const override
This function returns a string describing the ParameterMapItem.
Definition ParameterGroup.cpp:63
void get(const char *name, T &value) const
vki param interface - deprecated
Definition ParameterGroup.hpp:222
void displayUsage(bool used_params=false) const
Shows which parameters which are used or unused.
Definition ParameterGroup.cpp:285
bool has(const std::string &name) const
This method checks if there is something with name name in the parameter gropup.
Definition ParameterGroup.cpp:68
bool isOutputEnabled() const
Returs true if and only if output from get, getDefault and getGroup is enabled.
Definition ParameterGroup.cpp:311
T getDefault(const std::string &name, const T &default_value) const
This method is used to read a parameter from the parameter group.
Definition ParameterGroup_impl.hpp:219
void readParam(const std::string ¶m_filename)
Reads the contents of the param file specified by param_filename into this ParameterGroup.
Definition ParameterGroup.cpp:106
T get(const std::string &name) const
This method is used to read a parameter from the parameter group.
Definition ParameterGroup_impl.hpp:175
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition ParameterGroup.hpp:85
Definition ParameterGroup.hpp:83
Definition ParameterGroup.hpp:88
Definition ParameterGroup.hpp:84
The parameter handlig system is structured as a tree, where each node inhertis from ParameterMapItem.
Definition ParameterMapItem.hpp:47