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_;
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30