Skip to content
Snippets Groups Projects
Commit 50af2587 authored by Andreas Lauser's avatar Andreas Lauser
Browse files

keep track of which parameter comes from where in the GET_PARAM mechanism

this works by pushing parameters which come out of the property system
and runtime parameters into separate sub-structures of the parameter
tree

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@6471 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent d9d8827a
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,8 @@
#include <dune/common/parametertree.hh>
#include <sstream>
#include "propertysystem.hh"
#define GET_PARAM(TypeTag, ParamType, ParamName) \
......@@ -52,8 +54,27 @@ class Param
public:
static const ParamType &get(const char *name)
{
static ParamType defaultValue = GET_PROP_VALUE(TypeTag, PropTag);
static const ParamType &value = retrieve_(name);
return value;
}
private:
static const ParamType &retrieve_(const char *name)
{
ParamType defaultValue = GET_PROP_VALUE(TypeTag, PropTag);
static ParamType value = Params::tree().template get<ParamType>(name, defaultValue);
Dune::ParameterTree &rt = Params::tree().sub("RunTimeParams");
Dune::ParameterTree &ct = Params::tree().sub("DefaultParams");
if (Params::tree().hasKey(name)) {
rt[name] = Params::tree()[name];
}
else {
std::string s;
std::ostringstream oss(s);
oss << defaultValue;
ct[name] = oss.str();
}
return value;
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment