27 #ifndef OPM_SAT_CURVE_MULTIPLEXER_PARAMS_HPP 28 #define OPM_SAT_CURVE_MULTIPLEXER_PARAMS_HPP 41 #include <type_traits> 45 enum class SatCurveMultiplexerApproach {
50 template <SatCurveMultiplexerApproach ApproachArg>
53 static constexpr
auto approach = ApproachArg;
57 template <
typename ...Args>
59 template <SatCurveMultiplexerApproach Value,
typename ...Args>
61 template <
typename ...Args>
73 template <
class TraitsT>
77 using Traits = TraitsT;
78 using Scalar =
typename TraitsT::Scalar;
79 enum { numPhases = 2 };
85 using LETParams =
typename LETTwoPhaseLaw::Params;
88 template <
class ParamT>
91 inline void operator () (
void* ptr )
93 delete static_cast< ParamT*
> (ptr);
97 using ParamPointerType = std::shared_ptr<void>;
111 setApproach( other.approach() );
117 setApproach( other.approach() );
121 void setApproach(SatCurveMultiplexerApproach newApproach)
123 assert(realParams_ == 0);
124 approach_ = newApproach;
126 switch (approach()) {
127 case SatCurveMultiplexerApproach::LET:
128 realParams_ = ParamPointerType(
new LETParams, Deleter< LETParams > () );
131 case SatCurveMultiplexerApproach::PiecewiseLinear:
132 realParams_ = ParamPointerType(
new PLParams, Deleter< PLParams > () );
137 SatCurveMultiplexerApproach approach()
const 138 {
return approach_; }
141 template <SatCurveMultiplexerApproach approachV>
142 typename std::enable_if<approachV == SatCurveMultiplexerApproach::LET, LETParams>::type&
145 assert(approach() == approachV);
146 return this->
template castTo<LETParams>();
149 template <SatCurveMultiplexerApproach approachV>
150 typename std::enable_if<approachV == SatCurveMultiplexerApproach::LET, const LETParams>::type&
151 getRealParams()
const 153 assert(approach() == approachV);
154 return this->
template castTo<LETParams>();
158 template <SatCurveMultiplexerApproach approachV>
159 typename std::enable_if<approachV == SatCurveMultiplexerApproach::PiecewiseLinear, PLParams>::type&
162 assert(approach() == approachV);
163 return this->
template castTo<PLParams>();
166 template <SatCurveMultiplexerApproach approachV>
167 typename std::enable_if<approachV == SatCurveMultiplexerApproach::PiecewiseLinear, const PLParams>::type&
168 getRealParams()
const 170 assert(approach() == approachV);
171 return this->
template castTo<PLParams>();
174 template<
class Serializer>
175 void serializeOp(Serializer& serializer)
177 switch (approach()) {
178 case SatCurveMultiplexerApproach::LET:
179 serializer(castTo<LETParams>());
182 case SatCurveMultiplexerApproach::PiecewiseLinear:
183 serializer(castTo<PLParams>());
188 Scalar SnTrapped([[maybe_unused]]
bool maximumTrapping)
const 190 throw std::logic_error(
"SatCurveMultiplexerParams::SnTrapped() not implemented");
193 Scalar SnStranded([[maybe_unused]] Scalar sg, [[maybe_unused]] Scalar krg)
const 195 throw std::logic_error(
"SatCurveMultiplexerParams::SnStranded() not implemented");
198 Scalar SwTrapped()
const 200 throw std::logic_error(
"SatCurveMultiplexerParams::SwTrapped() not implemented");
205 template <
class ParamT>
208 return *(
static_cast<ParamT *
> (realParams_.operator->()));
211 template <
class ParamT>
212 const ParamT& castTo()
const 214 return *(
static_cast<const ParamT *
> (realParams_.operator->()));
217 SatCurveMultiplexerApproach approach_{SatCurveMultiplexerApproach::PiecewiseLinear};
218 ParamPointerType realParams_;
223 #endif // OPM_SAT_CURVE_MULTIPLEXER_PARAMS_HPP SatCurveMultiplexerParams()
The multiplexer constructor.
Definition: SatCurveMultiplexerParams.hpp:104
ParamsT Params
The type of the parameter objects for this law.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:61
Implementation of a tabulated, piecewise linear capillary pressure law.
Specification of the material parameters for the saturation function multiplexer. ...
Definition: SatCurveMultiplexerParams.hpp:74
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Implementation of a tabulated, piecewise linear capillary pressure law.
Definition: PiecewiseLinearTwoPhaseMaterial.hpp:52
Specification of the material parameters for a two-phase material law which uses a table and piecewis...
Default implementation for asserting finalization of parameter objects.
Implementation of the LET curve saturation functions.
Definition: TwoPhaseLETCurves.hpp:49
Definition: SatCurveMultiplexerParams.hpp:58
Definition: SatCurveMultiplexerParams.hpp:51
Default implementation for asserting finalization of parameter objects.
Definition: EnsureFinalized.hpp:48