EclTwoPhaseMaterialParams.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  Copyright (C) 2013 by Andreas Lauser
5 
6  This file is part of the Open Porous Media project (OPM).
7 
8  OPM is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 2 of the License, or
11  (at your option) any later version.
12 
13  OPM is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with OPM. If not, see <http://www.gnu.org/licenses/>.
20 */
25 #ifndef OPM_ECL_TWO_PHASE_MATERIAL_PARAMS_HPP
26 #define OPM_ECL_TWO_PHASE_MATERIAL_PARAMS_HPP
27 
28 #include <type_traits>
29 #include <cassert>
30 #include <memory>
31 
32 namespace Opm {
37 };
38 
46 template<class Traits, class GasOilParamsT, class OilWaterParamsT>
48 {
49  typedef typename Traits::Scalar Scalar;
50  enum { numPhases = 3 };
51 public:
52  typedef GasOilParamsT GasOilParams;
53  typedef OilWaterParamsT OilWaterParams;
54 
59  {
60 #ifndef NDEBUG
61  finalized_ = false;
62 #endif
63  }
64 
68  void finalize()
69  {
70 #ifndef NDEBUG
71  finalized_ = true;
72 #endif
73  }
74 
75  void setApproach(EclTwoPhaseApproach newApproach)
76  { approach_ = newApproach; }
77 
79  { return approach_; }
80 
84  const GasOilParams& gasOilParams() const
85  { assertFinalized_(); return *gasOilParams_; }
86 
90  GasOilParams& gasOilParams()
91  { assertFinalized_(); return *gasOilParams_; }
92 
96  void setGasOilParams(std::shared_ptr<GasOilParams> val)
97  { gasOilParams_ = val; }
98 
102  const OilWaterParams& oilWaterParams() const
103  { assertFinalized_(); return *oilWaterParams_; }
104 
108  OilWaterParams& oilWaterParams()
109  { assertFinalized_(); return *oilWaterParams_; }
110 
114  void setOilWaterParams(std::shared_ptr<OilWaterParams> val)
115  { oilWaterParams_ = val; }
116 
117 private:
118 #ifndef NDEBUG
119  void assertFinalized_() const
120  { assert(finalized_); }
121 
122  bool finalized_;
123 #else
124  void assertFinalized_() const
125  { }
126 #endif
127 
128  EclTwoPhaseApproach approach_;
129 
130  std::shared_ptr<GasOilParams> gasOilParams_;
131  std::shared_ptr<OilWaterParams> oilWaterParams_;
132 };
133 } // namespace Opm
134 
135 #endif
EclTwoPhaseApproach approach() const
Definition: EclTwoPhaseMaterialParams.hpp:78
Definition: EclTwoPhaseMaterialParams.hpp:35
Definition: Air_Mesitylene.hpp:31
const GasOilParams & gasOilParams() const
The parameter object for the gas-oil twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:84
Implementation for the parameters required by the material law for two-phase simulations.
Definition: EclTwoPhaseMaterialParams.hpp:47
EclTwoPhaseMaterialParams()
The default constructor.
Definition: EclTwoPhaseMaterialParams.hpp:58
EclTwoPhaseApproach
Definition: EclTwoPhaseMaterialParams.hpp:33
Definition: EclTwoPhaseMaterialParams.hpp:34
GasOilParamsT GasOilParams
Definition: EclTwoPhaseMaterialParams.hpp:52
GasOilParams & gasOilParams()
The parameter object for the gas-oil twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:90
void finalize()
Finish the initialization of the parameter object.
Definition: EclTwoPhaseMaterialParams.hpp:68
void setGasOilParams(std::shared_ptr< GasOilParams > val)
Set the parameter object for the gas-oil twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:96
void setOilWaterParams(std::shared_ptr< OilWaterParams > val)
Set the parameter object for the oil-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:114
void setApproach(EclTwoPhaseApproach newApproach)
Definition: EclTwoPhaseMaterialParams.hpp:75
OilWaterParams & oilWaterParams()
The parameter object for the oil-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:108
OilWaterParamsT OilWaterParams
Definition: EclTwoPhaseMaterialParams.hpp:53
Definition: EclTwoPhaseMaterialParams.hpp:36
const OilWaterParams & oilWaterParams() const
The parameter object for the oil-water twophase law.
Definition: EclTwoPhaseMaterialParams.hpp:102