mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
intermediate state of reimplementing the splice functionality
This commit is contained in:
parent
6d6ba6909c
commit
5fe2bc0aa9
@ -54,7 +54,13 @@ BEGIN_PROPERTIES
|
||||
NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, VtkTemperature));
|
||||
|
||||
//! Specify the splices of the MultiPhaseBaseModel type tag
|
||||
//NEW_PROP_TAG(SpatialDiscretizationSplice);
|
||||
//SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice);
|
||||
template<class TypeTag>
|
||||
struct Splices<TypeTag, TTag::MultiPhaseBaseModel>
|
||||
{
|
||||
using tuple = std::tuple<GetPropType<TypeTag, Properties::SpatialDiscretizationSplice>>;
|
||||
};
|
||||
|
||||
//! Set the default spatial discretization
|
||||
//!
|
||||
|
@ -100,7 +100,7 @@ NEW_PROP_TAG(ThreadManager);
|
||||
NEW_PROP_TAG(NewtonMethod);
|
||||
NEW_PROP_TAG(SolutionVector);
|
||||
NEW_PROP_TAG(GlobalEqVector);
|
||||
NEW_PROP_TAG(VtkOutputFormat);
|
||||
//NEW_PROP_TAG(VtkOutputFormat);
|
||||
|
||||
//! Specifies the type of a solution for a single degee of freedom
|
||||
NEW_PROP_TAG(PrimaryVariables);
|
||||
@ -261,7 +261,6 @@ NEW_PROP_TAG(EnableExperiments);
|
||||
NEW_PROP_TAG(EnableIntensiveQuantityCache);
|
||||
NEW_PROP_TAG(EnableThermodynamicHints);
|
||||
NEW_PROP_TAG(NonwettingPhase);
|
||||
NEW_PROP_TAG(SpatialDiscretizationSplice);
|
||||
NEW_PROP_TAG(WettingPhase);
|
||||
|
||||
NEW_PROP_TAG(OverlappingMatrix);
|
||||
|
@ -36,6 +36,26 @@ namespace Properties {
|
||||
//! a tag to mark properties as undefined
|
||||
struct UndefinedProperty {};
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct SpatialDiscretizationSplice { using type = UndefinedProperty; };
|
||||
|
||||
namespace TTag {
|
||||
struct MyTTag {};
|
||||
struct MySDTTag {};
|
||||
}
|
||||
|
||||
template<class TypeTag>
|
||||
struct SpatialDiscretizationSplice<TypeTag, TTag::MyTTag>
|
||||
{ using type = TTag::MySDTTag; };
|
||||
|
||||
template<class TypeTag, class MyTypeTag>
|
||||
struct VtkOutputFormat { using type = UndefinedProperty; };
|
||||
|
||||
template<class TypeTag>
|
||||
struct VtkOutputFormat<TypeTag, TTag::MySDTTag>
|
||||
{ static constexpr auto value = 2; };
|
||||
|
||||
|
||||
//! implementation details for template meta programming
|
||||
namespace Detail {
|
||||
|
||||
@ -69,7 +89,7 @@ using ConCatTuples = decltype(std::tuple_cat(std::declval<Tuples>()...));
|
||||
template<class TypeTag, template<class,class> class Property, class TTagList>
|
||||
struct GetDefined;
|
||||
|
||||
//! helper struct to iteratre over the TypeTag hierarchy
|
||||
//! helper struct to iterate over the TypeTag hierarchy
|
||||
template<class TypeTag, template<class,class> class Property, class TTagList, class Enable>
|
||||
struct GetNextTypeTag;
|
||||
|
||||
@ -129,7 +149,23 @@ struct GetDefined<TypeTag, Property, std::tuple<FirstTypeTag, Args...>>
|
||||
template<class TypeTag, template<class,class> class Property>
|
||||
struct GetPropImpl
|
||||
{
|
||||
using type = typename Detail::GetDefined<TypeTag, Property, std::tuple<TypeTag>>::type;
|
||||
using PType = Properties::SpatialDiscretizationSplice<TypeTag, TTag::MyTTag>;
|
||||
using testtype = std::conditional_t<isDefinedProperty<PType>(int{}), PType, UndefinedProperty>;
|
||||
static_assert(!std::is_same<testtype, UndefinedProperty>::value, "SpatialDiscretizationSplice is undefined in MyTTag!");
|
||||
|
||||
using QType = Properties::VtkOutputFormat<TypeTag, TTag::MySDTTag>;
|
||||
using testtype2 = std::conditional_t<isDefinedProperty<QType>(int{}), QType, UndefinedProperty>;
|
||||
static_assert(!std::is_same<testtype2, UndefinedProperty>::value, "VtkOutputFormat is undefined in MySDTTag!");
|
||||
|
||||
// using testtype = typename Detail::GetDefined<TTag::MyTTag,
|
||||
// Properties::SpatialDiscretizationSplice,
|
||||
// std::tuple<TTag::MyTTag>
|
||||
// >::type;
|
||||
|
||||
using type = typename Detail::GetDefined<TypeTag,
|
||||
Property,
|
||||
std::tuple<TypeTag, TTag::MySDTTag>
|
||||
>::type;
|
||||
static_assert(!std::is_same<type, UndefinedProperty>::value, "Property is undefined!");
|
||||
};
|
||||
|
||||
|
@ -316,7 +316,7 @@ struct GetTypeTagInheritance<std::tuple<FirstTypeTag, OtherTypeTags...>>
|
||||
* NEW_TYPE_TAG(ProblemTypeTag, INHERITS_FROM(ModelTypeTag));
|
||||
* SET_TAG_PROP(ProblemTypeTag, LinearSolver, SuperLUSolver);
|
||||
* \endcode
|
||||
*/
|
||||
*/
|
||||
|
||||
// template class to revert the order or a std::tuple's arguments. This is required to
|
||||
// make the properties of children defined on the right overwrite the properties of the
|
||||
@ -345,25 +345,18 @@ struct GetTypeTagInheritance<std::tuple<FirstTypeTag, OtherTypeTags...>>
|
||||
typedef typename RevertedTupleOuter<sizeof...(Args)>::template RevertedTupleInner<Args...>::type type;
|
||||
};
|
||||
|
||||
namespace PTag {
|
||||
// this class needs to be located in the PTag namespace for reasons
|
||||
// you don't really want to know...
|
||||
template <class TypeTag>
|
||||
template <class TypeTag, class MyTypeTag>
|
||||
struct Splices
|
||||
{
|
||||
typedef typename std::tuple<> tuple;
|
||||
using tuple = std::tuple<>;
|
||||
};
|
||||
} // namespace PTag
|
||||
|
||||
#define SET_SPLICES(TypeTagName, ...) \
|
||||
namespace PTag { \
|
||||
template<> \
|
||||
struct Splices<TTAG(TypeTagName)> \
|
||||
template<class TypeTag> \
|
||||
struct Splices<TypeTag, TTAG(TypeTagName)> \
|
||||
{ \
|
||||
typedef RevertedTuple<__VA_ARGS__>::type tuple; \
|
||||
}; \
|
||||
SPLICE_INFO_(TypeTagName, __VA_ARGS__) \
|
||||
} \
|
||||
extern int semicolonHack_
|
||||
|
||||
#define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \
|
||||
|
Loading…
Reference in New Issue
Block a user