My Project
Loading...
Searching...
No Matches
FluidStateSaturationModules.hpp
Go to the documentation of this file.
1// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2// vi: set et ts=4 sw=4 sts=4:
3/*
4 This file is part of the Open Porous Media project (OPM).
5
6 OPM is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 2 of the License, or
9 (at your option) any later version.
10
11 OPM is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
19 Consult the COPYING file in the top-level source directory of this
20 module for the precise wording of the license and the list of
21 copyright holders.
22*/
28#ifndef OPM_FLUID_STATE_SATURATION_MODULES_HPP
29#define OPM_FLUID_STATE_SATURATION_MODULES_HPP
30
33
34#include <algorithm>
35
36namespace Opm {
37
42template <class Scalar,
43 unsigned numPhases,
44 class Implementation>
46{
47public:
49 { Valgrind::SetUndefined(saturation_); }
50
54 const Scalar& saturation(unsigned phaseIdx) const
55 { return saturation_[phaseIdx]; }
56
60 void setSaturation(unsigned phaseIdx, const Scalar& value)
61 { saturation_[phaseIdx] = value; }
62
67 template <class FluidState>
68 void assign(const FluidState& fs)
69 {
70 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
71 saturation_[phaseIdx] = decay<Scalar>(fs.saturation(phaseIdx));
72 }
73 }
74
83 void checkDefined() const
84 {
85 Valgrind::CheckDefined(saturation_);
86 }
87
88protected:
89 Scalar saturation_[numPhases];
90};
91
96template <class Scalar>
98{
99public:
101 { }
102
106 const Scalar& saturation(unsigned /* phaseIdx */) const
107 { throw std::runtime_error("Saturation is not provided by this fluid state"); }
108
113 template <class FluidState>
114 void assign(const FluidState& /* fs */)
115 { }
116
125 void checkDefined() const
126 { }
127};
128
129} // namespace Opm
130
131#endif
A traits class which provides basic mathematical functions for arbitrary scalar floating point values...
Some templates to wrap the valgrind client request macros.
Module for the modular fluid state which stores the saturations explicitly.
Definition FluidStateSaturationModules.hpp:46
const Scalar & saturation(unsigned phaseIdx) const
The saturation of a fluid phase [-].
Definition FluidStateSaturationModules.hpp:54
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStateSaturationModules.hpp:83
void setSaturation(unsigned phaseIdx, const Scalar &value)
Set the saturation of a phase [-].
Definition FluidStateSaturationModules.hpp:60
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStateSaturationModules.hpp:68
Module for the modular fluid state which does not the saturations but throws std::logic_error instead...
Definition FluidStateSaturationModules.hpp:98
void assign(const FluidState &)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStateSaturationModules.hpp:114
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStateSaturationModules.hpp:125
const Scalar & saturation(unsigned) const
The saturation of a fluid phase [-].
Definition FluidStateSaturationModules.hpp:106
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30