mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[properties] fix macros that are used in opm-simulators, change include order
This commit is contained in:
parent
58182fe379
commit
2fe69dfd9b
@ -27,7 +27,7 @@
|
||||
#ifndef EWOMS_BASE_VANGUARD_HH
|
||||
#define EWOMS_BASE_VANGUARD_HH
|
||||
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
#include <opm/models/utils/basicproperties.hh>
|
||||
#include <opm/models/utils/parametersystem.hh>
|
||||
|
||||
#include <dune/common/version.hh>
|
||||
|
@ -30,22 +30,7 @@
|
||||
|
||||
#include <dune/common/parametertree.hh>
|
||||
|
||||
// explicitly guard the include so that the property system
|
||||
// header doesn't need to be opened and checked all the time
|
||||
#ifndef OPM_PROPERTY_SYSTEM_HH
|
||||
#include <opm/models/utils/propertysystem.hh>
|
||||
|
||||
// remove this after release 2020.10 to disable macros per default
|
||||
#ifndef OPM_ENABLE_OLD_PROPERTY_MACROS
|
||||
#define OPM_ENABLE_OLD_PROPERTY_MACROS 1
|
||||
#endif
|
||||
|
||||
// remove this after release 2021.04 to remove macros completely
|
||||
#if OPM_ENABLE_OLD_PROPERTY_MACROS
|
||||
#include <opm/models/utils/propertysystemmacros.hh>
|
||||
#endif // OPM_ENABLE_OLD_PROPERTY_MACROS
|
||||
#endif // OPM_PROPERTY_SYSTEM_HH
|
||||
|
||||
#include <opm/models/utils/parametersystem.hh>
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
|
@ -85,7 +85,7 @@
|
||||
* This allows to deal with unused parameters
|
||||
*/
|
||||
#define EWOMS_HIDE_PARAM(TypeTag, ParamName) \
|
||||
::Opm::Parameters::hideParam<TypeTag, PTAG_(ParamName)>(#ParamName)
|
||||
::Opm::Parameters::hideParam<TypeTag>(#ParamName, GET_PROP_VALUE(TypeTag, ParamName))
|
||||
|
||||
/*!
|
||||
* \ingroup Parameter
|
||||
@ -148,8 +148,7 @@
|
||||
* If the parameter in question has not been registered, this throws an exception.
|
||||
*/
|
||||
#define EWOMS_PARAM_IS_SET(TypeTag, ParamType, ParamName) \
|
||||
(::Opm::Parameters::isSet<TypeTag, ParamType, PTAG_(ParamName)>(#ParamName, \
|
||||
#ParamName))
|
||||
(::Opm::Parameters::isSet<TypeTag, ParamType>(#ParamName, #ParamName))
|
||||
|
||||
namespace Opm {
|
||||
namespace Parameters {
|
||||
@ -969,7 +968,7 @@ public:
|
||||
ParamsMeta::clear();
|
||||
}
|
||||
|
||||
template <class ParamType, class PropTag>
|
||||
template <class ParamType>
|
||||
static bool isSet(const char *propTagName OPM_OPTIM_UNUSED,
|
||||
const char *paramName OPM_OPTIM_UNUSED,
|
||||
bool errorIfNotRegistered = true)
|
||||
@ -1130,12 +1129,12 @@ void reset()
|
||||
return Param<TypeTag>::clear();
|
||||
}
|
||||
|
||||
template <class TypeTag, class ParamType, class PropTag>
|
||||
template <class TypeTag, class ParamType>
|
||||
bool isSet(const char *propTagName, const char *paramName, bool errorIfNotRegistered = true)
|
||||
{
|
||||
return Param<TypeTag>::template isSet<ParamType, PropTag>(propTagName,
|
||||
paramName,
|
||||
errorIfNotRegistered);
|
||||
return Param<TypeTag>::template isSet<ParamType>(propTagName,
|
||||
paramName,
|
||||
errorIfNotRegistered);
|
||||
}
|
||||
|
||||
template <class TypeTag, class ParamType>
|
||||
@ -1172,13 +1171,9 @@ void registerParam(const char *paramName, const char *propertyName, const ParamT
|
||||
ParamsMeta::mutableRegistry()[paramName] = paramInfo;
|
||||
}
|
||||
|
||||
template <class TypeTag, class PropTag>
|
||||
void hideParam(const char *paramName)
|
||||
template <class TypeTag, class ParamType>
|
||||
void hideParam(const char *paramName, const ParamType& defaultValue)
|
||||
{
|
||||
// make sure that a property with the parameter name exists. we cannot check if a
|
||||
// parameter exists at compile time, so this will only be caught at runtime
|
||||
static const auto defaultValue OPM_UNUSED = getPropValue<TypeTag, PropTag>;
|
||||
|
||||
typedef typename GET_PROP(TypeTag, ParameterMetaData) ParamsMeta;
|
||||
if (!ParamsMeta::registrationOpen())
|
||||
throw std::logic_error("Parameter '"+std::string(paramName)+"' declared as hidden"
|
||||
|
@ -268,4 +268,14 @@ void printValues(std::ostream& os = std::cout)
|
||||
|
||||
} // end namespace Opm
|
||||
|
||||
// remove this after release 2020.10 to disable macros per default
|
||||
#ifndef OPM_ENABLE_OLD_PROPERTY_MACROS
|
||||
#define OPM_ENABLE_OLD_PROPERTY_MACROS 1
|
||||
#endif
|
||||
|
||||
// remove this after release 2021.04 to remove macros completely
|
||||
#if OPM_ENABLE_OLD_PROPERTY_MACROS
|
||||
#include <opm/models/utils/propertysystemmacros.hh>
|
||||
#endif // OPM_ENABLE_OLD_PROPERTY_MACROS
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user