28 #ifndef OPM_FLUID_STATE_SATURATION_MODULES_HPP
29 #define OPM_FLUID_STATE_SATURATION_MODULES_HPP
31 #include <opm/common/ErrorMacros.hpp>
32 #include <opm/common/Exceptions.hpp>
35 #include <opm/common/Valgrind.hpp>
45 template <
class Scalar,
52 { Valgrind::SetUndefined(saturation_); }
58 {
return saturation_[phaseIdx]; }
64 {
return saturation_[phaseIdx] > 0.0; }
70 { saturation_[phaseIdx] = value; }
76 template <
class Flu
idState>
79 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
80 saturation_[phaseIdx] = Opm::decay<Scalar>(fs.saturation(phaseIdx));
94 Valgrind::CheckDefined(saturation_);
98 Scalar saturation_[numPhases];
105 template <
class Scalar>
116 { OPM_THROW(std::runtime_error,
"Saturation is not provided by this fluid state"); }
122 { OPM_THROW(std::runtime_error,
"phaseIsPresent() is not provided by this fluid state"); }
128 template <
class Flu
idState>
bool phaseIsPresent(unsigned phaseIdx) const
Returns true iff a fluid phase shall be assumed to be present.
Definition: FluidStateSaturationModules.hpp:63
const Scalar & saturation(unsigned) const
The saturation of a fluid phase [-].
Definition: FluidStateSaturationModules.hpp:115
bool phaseIsPresent(unsigned) const
Returns true iff a fluid phase shall be assumed to be present.
Definition: FluidStateSaturationModules.hpp:121
void checkDefined() const
Make sure that all attributes are defined.
Definition: FluidStateSaturationModules.hpp:140
void assign(const FluidState &)
Retrieve all parameters from an arbitrary fluid state.
Definition: FluidStateSaturationModules.hpp:129
void setSaturation(unsigned phaseIdx, const Scalar &value)
Set the saturation of a phase [-].
Definition: FluidStateSaturationModules.hpp:69
Module for the modular fluid state which does not the saturations but throws std::logic_error instead...
Definition: FluidStateSaturationModules.hpp:106
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition: FluidStateSaturationModules.hpp:77
void checkDefined() const
Make sure that all attributes are defined.
Definition: FluidStateSaturationModules.hpp:92
Module for the modular fluid state which stores the saturations explicitly.
Definition: FluidStateSaturationModules.hpp:48
const Scalar & saturation(unsigned phaseIdx) const
The saturation of a fluid phase [-].
Definition: FluidStateSaturationModules.hpp:57