mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
[properties] recover splice mechanism
This commit is contained in:
parent
4f890ed379
commit
54d665a532
@ -56,16 +56,10 @@ struct FiniteDifferenceLocalLinearizer;
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! The generic type tag for problems using the immiscible multi-phase model
|
//! The generic type tag for problems using the immiscible multi-phase model
|
||||||
NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(NumericModel, VtkMultiPhase, VtkTemperature));
|
NEW_TYPE_TAG(MultiPhaseBaseModel, INHERITS_FROM(VtkMultiPhase, VtkTemperature));
|
||||||
|
|
||||||
//! Specify the splices of the MultiPhaseBaseModel type tag
|
//! Specify the splices of the MultiPhaseBaseModel type tag
|
||||||
//NEW_PROP_TAG(SpatialDiscretizationSplice);
|
SET_SPLICE(MultiPhaseBaseModel, SpatialDiscretizationSplice);
|
||||||
//SET_SPLICES(MultiPhaseBaseModel, SpatialDiscretizationSplice);
|
|
||||||
template<class TypeTag>
|
|
||||||
struct Splices<TypeTag, TTag::MultiPhaseBaseModel>
|
|
||||||
{
|
|
||||||
using type = std::tuple<GetSplicePropType<TypeTag, Properties::SpatialDiscretizationSplice>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Set the default spatial discretization
|
//! Set the default spatial discretization
|
||||||
//!
|
//!
|
||||||
|
@ -48,17 +48,7 @@ NEW_TYPE_TAG(FvBaseDiscretization,
|
|||||||
|
|
||||||
|
|
||||||
//! set the splices for the finite volume discretizations
|
//! set the splices for the finite volume discretizations
|
||||||
|
SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice);
|
||||||
|
|
||||||
//SET_SPLICES(FvBaseDiscretization, LinearSolverSplice, LocalLinearizerSplice);
|
|
||||||
template<class TypeTag>
|
|
||||||
struct Splices<TypeTag, TTag::FvBaseDiscretization>
|
|
||||||
{
|
|
||||||
// using type = std::tuple<GetSplicePropType<TypeTag, Properties::LinearSolverSplice>,
|
|
||||||
// GetSplicePropType<TypeTag, Properties::LocalLinearizerSplice>>;
|
|
||||||
using type = std::tuple<TTag::ParallelBiCGStabLinearSolver,
|
|
||||||
TTag::FiniteDifferenceLocalLinearizer>;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! use a parallel BiCGStab linear solver by default
|
//! use a parallel BiCGStab linear solver by default
|
||||||
SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSolver);
|
SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSolver);
|
||||||
@ -66,6 +56,7 @@ SET_TAG_PROP(FvBaseDiscretization, LinearSolverSplice, ParallelBiCGStabLinearSol
|
|||||||
//! by default, use finite differences to linearize the system of PDEs
|
//! by default, use finite differences to linearize the system of PDEs
|
||||||
SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalLinearizer);
|
SET_TAG_PROP(FvBaseDiscretization, LocalLinearizerSplice, FiniteDifferenceLocalLinearizer);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Representation of a function evaluation and all necessary derivatives with
|
* \brief Representation of a function evaluation and all necessary derivatives with
|
||||||
* regard to the intensive quantities of the primary variables.
|
* regard to the intensive quantities of the primary variables.
|
||||||
|
@ -126,10 +126,6 @@ private:
|
|||||||
static int numThreads_;
|
static int numThreads_;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Properties {
|
|
||||||
SET_TYPE_PROP(NumericModel, ThreadManager, Opm::ThreadManager<TypeTag>);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class TypeTag>
|
template <class TypeTag>
|
||||||
int ThreadManager<TypeTag>::numThreads_ = 1;
|
int ThreadManager<TypeTag>::numThreads_ = 1;
|
||||||
} // namespace Opm
|
} // namespace Opm
|
||||||
|
@ -41,7 +41,6 @@ struct Splices
|
|||||||
{
|
{
|
||||||
using type = std::tuple<>;
|
using type = std::tuple<>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//! implementation details for template meta programming
|
//! implementation details for template meta programming
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
@ -171,7 +170,12 @@ template<class TypeTag, class LastTypeTag>
|
|||||||
struct GetDefinedSplice<TypeTag, std::tuple<LastTypeTag>>
|
struct GetDefinedSplice<TypeTag, std::tuple<LastTypeTag>>
|
||||||
{
|
{
|
||||||
using LastSplice = Splices<TypeTag, LastTypeTag>;
|
using LastSplice = Splices<TypeTag, LastTypeTag>;
|
||||||
using nexttuple = typename GetNextSpliceTypeTag<TypeTag, std::tuple<LastTypeTag>, void>::type;
|
using nexttuple = typename GetNextSpliceTypeTag<TypeTag,
|
||||||
|
ConCatTuples<
|
||||||
|
std::tuple<LastTypeTag>,
|
||||||
|
typename LastSplice::type
|
||||||
|
>,
|
||||||
|
void>::type;
|
||||||
|
|
||||||
using type = std::conditional_t<isDefinedSplice<LastSplice>(int{}),
|
using type = std::conditional_t<isDefinedSplice<LastSplice>(int{}),
|
||||||
ConCatTuples<nexttuple, typename LastSplice::type>,
|
ConCatTuples<nexttuple, typename LastSplice::type>,
|
||||||
@ -182,7 +186,12 @@ template<class TypeTag, class FirstTypeTag, class ...Args>
|
|||||||
struct GetDefinedSplice<TypeTag, std::tuple<FirstTypeTag, Args...>>
|
struct GetDefinedSplice<TypeTag, std::tuple<FirstTypeTag, Args...>>
|
||||||
{
|
{
|
||||||
using FirstSplice = Splices<TypeTag, FirstTypeTag>;
|
using FirstSplice = Splices<TypeTag, FirstTypeTag>;
|
||||||
using nexttuple = typename GetNextSpliceTypeTag<TypeTag, std::tuple<FirstTypeTag, Args...>, void>::type;
|
using nexttuple = typename GetNextSpliceTypeTag<TypeTag,
|
||||||
|
ConCatTuples<
|
||||||
|
std::tuple<FirstTypeTag, Args...>,
|
||||||
|
typename FirstSplice::type
|
||||||
|
>,
|
||||||
|
void>::type;
|
||||||
|
|
||||||
using type = std::conditional_t<isDefinedSplice<FirstSplice>(int{}),
|
using type = std::conditional_t<isDefinedSplice<FirstSplice>(int{}),
|
||||||
ConCatTuples<typename FirstSplice::type, nexttuple>,
|
ConCatTuples<typename FirstSplice::type, nexttuple>,
|
||||||
@ -193,8 +202,7 @@ struct GetDefinedSplice<TypeTag, std::tuple<FirstTypeTag, Args...>>
|
|||||||
template<class TypeTag, template<class,class> class Property>
|
template<class TypeTag, template<class,class> class Property>
|
||||||
struct GetPropImpl
|
struct GetPropImpl
|
||||||
{
|
{
|
||||||
using splice = typename Detail::GetDefinedSplice<TypeTag, std::tuple<TypeTag>>::type;
|
using tuple = typename Detail::GetDefinedSplice<TypeTag, std::tuple<TypeTag>>::type;
|
||||||
using tuple = std::conditional_t<std::is_same<splice, std::tuple<>>::value, std::tuple<>, splice>;
|
|
||||||
using type = typename Detail::GetDefined<TypeTag,
|
using type = typename Detail::GetDefined<TypeTag,
|
||||||
Property,
|
Property,
|
||||||
ConCatTuples<std::tuple<TypeTag>, tuple>
|
ConCatTuples<std::tuple<TypeTag>, tuple>
|
||||||
@ -202,10 +210,10 @@ struct GetPropImpl
|
|||||||
static_assert(!std::is_same<type, UndefinedProperty>::value, "Property is undefined!");
|
static_assert(!std::is_same<type, UndefinedProperty>::value, "Property is undefined!");
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class TypeTag, template<class,class> class Property>
|
template<class TypeTag, class SpliceTypeTag, template<class,class> class Property>
|
||||||
struct GetSplicePropImpl
|
struct GetSplicePropImpl
|
||||||
{
|
{
|
||||||
using type = typename Detail::GetDefined<TypeTag, Property, std::tuple<TypeTag>>::type;
|
using type = typename Detail::GetDefined<TypeTag, Property, std::tuple<TypeTag, SpliceTypeTag>>::type;
|
||||||
static_assert(!std::is_same<type, std::tuple<>>::value, "Splice is undefined!");
|
static_assert(!std::is_same<type, std::tuple<>>::value, "Splice is undefined!");
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -225,8 +233,8 @@ using GetProp = typename Properties::Detail::GetPropImpl<TypeTag, Property>::typ
|
|||||||
template<class TypeTag, template<class,class> class Property>
|
template<class TypeTag, template<class,class> class Property>
|
||||||
using GetPropType = typename Properties::Detail::GetPropImpl<TypeTag, Property>::type::type;
|
using GetPropType = typename Properties::Detail::GetPropImpl<TypeTag, Property>::type::type;
|
||||||
|
|
||||||
template<class TypeTag, template<class,class> class Property>
|
template<class TypeTag, class SpliceTypeTag, template<class,class> class Property>
|
||||||
using GetSplicePropType = typename Properties::Detail::GetSplicePropImpl<TypeTag, Property>::type::type;
|
using GetSplicePropType = typename Properties::Detail::GetSplicePropImpl<TypeTag, SpliceTypeTag, Property>::type::type;
|
||||||
|
|
||||||
//! get the value data member of a property
|
//! get the value data member of a property
|
||||||
template<class TypeTag, template<class,class> class Property>
|
template<class TypeTag, template<class,class> class Property>
|
||||||
|
@ -345,14 +345,24 @@ struct GetTypeTagInheritance<std::tuple<FirstTypeTag, OtherTypeTags...>>
|
|||||||
typedef typename RevertedTupleOuter<sizeof...(Args)>::template RevertedTupleInner<Args...>::type type;
|
typedef typename RevertedTupleOuter<sizeof...(Args)>::template RevertedTupleInner<Args...>::type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SET_SPLICES(TypeTagName, ...) \
|
#define SET_SPLICE(TypeTagName, SpliceName) \
|
||||||
template<class TypeTag> \
|
template<class TypeTag> \
|
||||||
struct Splices<TypeTag, TTAG(TypeTagName)> \
|
struct Splices<TypeTag, TTag::TypeTagName> \
|
||||||
{ \
|
{ \
|
||||||
typedef RevertedTuple<__VA_ARGS__>::type tuple; \
|
using type = std::tuple<GetSplicePropType<TypeTag, TTag::TypeTagName, Properties::SpliceName>>; \
|
||||||
}; \
|
}; \
|
||||||
extern int semicolonHack_
|
extern int semicolonHack_
|
||||||
|
|
||||||
|
#define SET_SPLICES(TypeTagName, SpliceName1, SpliceName2) \
|
||||||
|
template<class TypeTag> \
|
||||||
|
struct Splices<TypeTag, TTag::TypeTagName> \
|
||||||
|
{ \
|
||||||
|
using type = std::tuple<GetSplicePropType<TypeTag, TTag::TypeTagName, Properties::SpliceName1>, \
|
||||||
|
GetSplicePropType<TypeTag, TTag::TypeTagName, Properties::SpliceName2>>; \
|
||||||
|
}; \
|
||||||
|
extern int semicolonHack_
|
||||||
|
|
||||||
|
|
||||||
#define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \
|
#define SET_PROP_(EffTypeTagName, PropKind, PropTagName, ...) \
|
||||||
template <class TypeTag> \
|
template <class TypeTag> \
|
||||||
struct PropTagName<TypeTag, TTAG(EffTypeTagName)>
|
struct PropTagName<TypeTag, TTAG(EffTypeTagName)>
|
||||||
|
Loading…
Reference in New Issue
Block a user