Skip to content
Snippets Groups Projects
Commit 04894362 authored by Timo Koch's avatar Timo Koch
Browse files

[parameters] Don't check consistent type for parameter macro

The check was turned on for debug purposes and exited with an error
if the same parameter was read into object of different type. This
is not an error. For reading vectors it is even an important feature
that it's possible to read it into different types of containers
depending on the usage.

Reviewed by martins
parent 8cb87079
No related branches found
No related tags found
1 merge request!31Feature/colebrookwhiteboundarylayer
......@@ -267,24 +267,6 @@ public:
static const ParamType &getRuntime(const char *groupOrParamName,
const char *paramNameOrNil = 0)
{
#ifndef NDEBUG
// make sure that the parameter is used consistently. since
// this is potentially quite expensive, it is only done if
// debugging code is not explicitly turned off.
const char *paramName, *groupName;
static const std::string propertyName("");
if (paramNameOrNil && strlen(paramNameOrNil) > 0) {
groupName = groupOrParamName;
paramName = paramNameOrNil;
}
else {
groupName = "";
paramName = groupOrParamName;
}
check_(Dune::className<ParamType>(), propertyName, groupName, paramName);
#endif
return retrieveRuntime_<ParamType>(groupOrParamName, paramNameOrNil);
}
......@@ -303,36 +285,6 @@ private:
}
};
static void check_(const std::string &paramTypeName,
const std::string &propertyName,
const char *groupName,
const char *paramName)
{
typedef std::unordered_map<std::string, Blubb> StaticData;
static StaticData staticData;
typename StaticData::iterator it = staticData.find(paramName);
Blubb *b;
if (it == staticData.end())
{
Blubb a;
a.propertyName = propertyName;
a.paramTypeName = paramTypeName;
a.groupName = groupName;
staticData[paramName] = a;
b = &staticData[paramName];
}
else
b = &(it->second);
if (b->paramTypeName != paramTypeName && b->groupName == groupName) {
DUNE_THROW(Dune::InvalidStateException,
"GET_*_PARAM for parameter '" << paramName << "' in group '"
<< groupName << "' called with at least two different types ("
<< b->paramTypeName << " and " << paramTypeName << ")");
}
}
template <class ParamType, class PropTag>
static const ParamType &retrieve_(const char *propertyName,
const char *groupOrParamName,
......@@ -348,13 +300,6 @@ private:
paramName = groupOrParamName;
}
#ifndef NDEBUG
// make sure that the parameter is used consistently. since
// this is potentially quite expensive, it is only done if
// debugging code is not explicitly turned off.
check_(Dune::className<ParamType>(), propertyName, groupName, paramName);
#endif
// prefix the parameter name by 'GroupName.'. E.g. 'Newton'
// and 'WriteConvergence' becomes 'Newton.WriteConvergence'
// with the default value specified by the
......
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