My Project
Loading...
Searching...
No Matches
FluidStatePressureModules.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_PRESSURE_MODULES_HPP
29#define OPM_FLUID_STATE_PRESSURE_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(pressure_); }
50
54 const Scalar& pressure(unsigned phaseIdx) const
55 { return pressure_[phaseIdx]; }
56
57
61 void setPressure(unsigned phaseIdx, const Scalar& value)
62 { pressure_[phaseIdx] = value; }
63
68 template <class FluidState>
69 void assign(const FluidState& fs)
70 {
71 for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
72 pressure_[phaseIdx] = decay<Scalar>(fs.pressure(phaseIdx));
73 }
74 }
75
84 void checkDefined() const
85 {
86 Valgrind::CheckDefined(pressure_);
87 }
88
89protected:
90 Scalar pressure_[numPhases];
91};
92
97template <class Scalar>
99{
100public:
102 { }
103
107 const Scalar& pressure(unsigned /* phaseIdx */) const
108 { throw std::logic_error("Pressure is not provided by this fluid state"); }
109
110
115 template <class FluidState>
116 void assign(const FluidState& /* fs */)
117 { }
118
127 void checkDefined() const
128 { }
129};
130
131} // namespace Opm
132
133#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 pressures explicitly.
Definition FluidStatePressureModules.hpp:46
const Scalar & pressure(unsigned phaseIdx) const
The pressure of a fluid phase [Pa].
Definition FluidStatePressureModules.hpp:54
void assign(const FluidState &fs)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStatePressureModules.hpp:69
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStatePressureModules.hpp:84
void setPressure(unsigned phaseIdx, const Scalar &value)
Set the pressure of a phase [Pa].
Definition FluidStatePressureModules.hpp:61
Module for the modular fluid state which does not the pressures but throws std::logic_error instead.
Definition FluidStatePressureModules.hpp:99
const Scalar & pressure(unsigned) const
The pressure of a fluid phase [Pa].
Definition FluidStatePressureModules.hpp:107
void assign(const FluidState &)
Retrieve all parameters from an arbitrary fluid state.
Definition FluidStatePressureModules.hpp:116
void checkDefined() const
Make sure that all attributes are defined.
Definition FluidStatePressureModules.hpp:127
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30