26#ifndef OPM_PROPERTY_SYSTEM_HH
27#define OPM_PROPERTY_SYSTEM_HH
29#include <dune/common/classname.hh>
42template <
class TypeTag,
class MyTypeTag>
45 using type = std::tuple<>;
54->
decltype(std::integral_constant<bool, !std::is_same<typename P::type, UndefinedProperty>::value>{})
64->
decltype(std::declval<typename T::InheritsFrom>(), std::true_type{})
72template<
class ...Tuples>
73using ConCatTuples =
decltype(std::tuple_cat(std::declval<Tuples>()...));
76template<
class TypeTag,
template<
class,
class>
class Property,
class TTagList>
80template<
class TypeTag,
template<
class,
class>
class Property,
class TTagList,
class Enable>
83template<
class TypeTag,
template<
class,
class>
class Property,
class LastTypeTag>
84struct GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>, std::enable_if_t<hasParentTypeTag<LastTypeTag>(int{}), void>>
87template<
class TypeTag,
template<
class,
class>
class Property,
class LastTypeTag>
88struct GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>, std::enable_if_t<!hasParentTypeTag<LastTypeTag>(int{}), void>>
91template<
class TypeTag,
template<
class,
class>
class Property,
class FirstTypeTag,
class ...Args>
92struct GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<hasParentTypeTag<FirstTypeTag>(int{}), void>>
93{
using type =
typename GetDefined<TypeTag, Property,
ConCatTuples<
typename FirstTypeTag::InheritsFrom, std::tuple<Args...>>>::type; };
95template<
class TypeTag,
template<
class,
class>
class Property,
class FirstTypeTag,
class ...Args>
96struct GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<!hasParentTypeTag<FirstTypeTag>(int{}), void>>
97{
using type =
typename GetDefined<TypeTag, Property, std::tuple<Args...>>::type; };
99template<
class TypeTag,
template<
class,
class>
class Property,
class LastTypeTag>
108#pragma clang diagnostic push
109#pragma clang diagnostic ignored "-Wdeprecated-declarations"
111 using LastType = Property<TypeTag, LastTypeTag>;
113#pragma clang diagnostic pop
115 using type = std::conditional_t<isDefinedProperty<LastType>(
int{}), LastType,
116 typename GetNextTypeTag<TypeTag, Property, std::tuple<LastTypeTag>,
void>::type>;
119template<
class TypeTag,
template<
class,
class>
class Property,
class FirstTypeTag,
class ...Args>
120struct GetDefined<TypeTag, Property, std::tuple<FirstTypeTag, Args...>>
124#pragma clang diagnostic push
125#pragma clang diagnostic ignored "-Wdeprecated-declarations"
127 using FirstType = Property<TypeTag, FirstTypeTag>;
129#pragma clang diagnostic pop
131 using type = std::conditional_t<isDefinedProperty<FirstType>(
int{}), FirstType,
132 typename GetNextTypeTag<TypeTag, Property, std::tuple<FirstTypeTag, Args...>,
void>::type>;
137template<
class TypeTag,
class TTagList>
141template<
class TypeTag,
class TTagList,
class Enable>
144template<
class TypeTag,
class LastTypeTag>
145struct GetNextSpliceTypeTag<TypeTag, std::tuple<LastTypeTag>, std::enable_if_t<hasParentTypeTag<LastTypeTag>(int{}), void>>
148template<
class TypeTag,
class LastTypeTag>
149struct GetNextSpliceTypeTag<TypeTag, std::tuple<LastTypeTag>, std::enable_if_t<!hasParentTypeTag<LastTypeTag>(int{}), void>>
150{
using type = std::tuple<>; };
152template<
class TypeTag,
class FirstTypeTag,
class ...Args>
153struct GetNextSpliceTypeTag<TypeTag, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<hasParentTypeTag<FirstTypeTag>(int{}), void>>
156template<
class TypeTag,
class FirstTypeTag,
class ...Args>
157struct GetNextSpliceTypeTag<TypeTag, std::tuple<FirstTypeTag, Args...>, std::enable_if_t<!hasParentTypeTag<FirstTypeTag>(int{}), void>>
158{
using type =
typename GetDefinedSplice<TypeTag, std::tuple<Args...>>::type; };
163->
decltype(std::integral_constant<bool, !std::is_same<typename S::type, std::tuple<>>::value>{})
170template<
class TypeTag,
class LastTypeTag>
176 std::tuple<LastTypeTag>,
177 typename LastSplice::type
181 using type = std::conditional_t<isDefinedSplice<LastSplice>(
int{}),
186template<
class TypeTag,
class FirstTypeTag,
class ...Args>
192 std::tuple<FirstTypeTag, Args...>,
193 typename FirstSplice::type
197 using type = std::conditional_t<isDefinedSplice<FirstSplice>(
int{}),
203template<
class TypeTag,
template<
class,
class>
class Property>
211 static_assert(!std::is_same<type, UndefinedProperty>::value,
"Property is undefined!");
214template<
class TypeTag,
class SpliceTypeTag,
template<
class,
class>
class Property>
218 static_assert(!std::is_same<type, std::tuple<>>::value,
"Splice is undefined!");
225template<
class TypeTag,
template<
class,
class>
class Property>
226using GetProp =
typename Properties::Detail::GetPropImpl<TypeTag, Property>::type;
230#pragma clang diagnostic push
231#pragma clang diagnostic ignored "-Wdeprecated-declarations"
234template<
class TypeTag,
template<
class,
class>
class Property>
237template<
class TypeTag,
class SpliceTypeTag,
template<
class,
class>
class Property>
241template<
class TypeTag,
template<
class,
class>
class Property>
245#pragma clang diagnostic pop
constexpr auto hasParentTypeTag(int) -> decltype(std::declval< typename T::InheritsFrom >(), std::true_type{})
check if a TypeTag inherits from other TypeTags
Definition propertysystem.hh:63
constexpr auto isDefinedProperty(int) -> decltype(std::integral_constant< bool, !std::is_same< typename P::type, UndefinedProperty >::value >{})
check if a property P is defined
Definition propertysystem.hh:53
constexpr auto isDefinedSplice(int) -> decltype(std::integral_constant< bool, !std::is_same< typename S::type, std::tuple<> >::value >{})
check if a splice S is defined
Definition propertysystem.hh:162
decltype(std::tuple_cat(std::declval< Tuples >()...)) ConCatTuples
helper alias to concatenate multiple tuples
Definition propertysystem.hh:73
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition propertysystem.hh:235
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition propertysystem.hh:226
helper struct to get the first property that is defined in the TypeTag hierarchy
Definition propertysystem.hh:138
helper struct to get the first property that is defined in the TypeTag hierarchy
Definition propertysystem.hh:77
helper struct to iterate over the TypeTag hierarchy
Definition propertysystem.hh:142
helper struct to iterate over the TypeTag hierarchy
Definition propertysystem.hh:81
helper struct to extract get the Property specilization given a TypeTag, asserts that the property is...
Definition propertysystem.hh:205
Definition propertysystem.hh:216
Definition propertysystem.hh:44
a tag to mark properties as undefined
Definition propertysystem.hh:40