My Project
MaterialTraits.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 */
31 #ifndef OPM_MATERIAL_TRAITS_HPP
32 #define OPM_MATERIAL_TRAITS_HPP
33 
34 namespace Opm {
35 
43 template <class ScalarT, int numPhasesV>
45 {
46 public:
48  using Scalar = ScalarT;
49 
51  static constexpr int numPhases = numPhasesV;
52 };
53 
59 template <class ScalarT, int wettingPhaseIdxV, int nonWettingPhaseIdxV>
61 {
62 public:
64  using Scalar = ScalarT;
65 
67  static constexpr int numPhases = 2;
68 
70  static constexpr int wettingPhaseIdx = wettingPhaseIdxV;
71 
73  static constexpr int nonWettingPhaseIdx = nonWettingPhaseIdxV;
74 
75  // some safety checks...
76  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
77  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
78 };
79 
85 template <class ScalarT, int wettingPhaseIdxV, int nonWettingasPhaseIdxV, int gasPhaseIdxV>
87 {
88 public:
90  using Scalar = ScalarT;
91 
93  static constexpr int numPhases = 3;
94 
96  static constexpr int wettingPhaseIdx = wettingPhaseIdxV;
97 
99  static constexpr int nonWettingPhaseIdx = nonWettingasPhaseIdxV;
100 
102  static constexpr int gasPhaseIdx = gasPhaseIdxV;
103 
104  // some safety checks...
105  static_assert(0 <= wettingPhaseIdx && wettingPhaseIdx < numPhases,
106  "wettingPhaseIdx is out of range");
107  static_assert(0 <= nonWettingPhaseIdx && nonWettingPhaseIdx < numPhases,
108  "nonWettingPhaseIdx is out of range");
109  static_assert(0 <= gasPhaseIdx && gasPhaseIdx < numPhases,
110  "gasPhaseIdx is out of range");
111 
112  static_assert(wettingPhaseIdx != nonWettingPhaseIdx,
113  "wettingPhaseIdx and nonWettingPhaseIdx must be different");
114  static_assert(wettingPhaseIdx != gasPhaseIdx,
115  "wettingPhaseIdx and gasPhaseIdx must be different");
116  static_assert(nonWettingPhaseIdx != gasPhaseIdx,
117  "nonWettingPhaseIdx and gasPhaseIdx must be different");
118 };
119 
120 } // namespace Opm
121 
122 #endif
A generic traits class which does not provide any indices.
Definition: MaterialTraits.hpp:45
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:48
static constexpr int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:51
A generic traits class for three-phase material laws.
Definition: MaterialTraits.hpp:87
static constexpr int wettingPhaseIdx
The index of the wetting liquid phase.
Definition: MaterialTraits.hpp:96
static constexpr int nonWettingPhaseIdx
The index of the non-wetting liquid phase.
Definition: MaterialTraits.hpp:99
static constexpr int gasPhaseIdx
The index of the gas phase (i.e., the least wetting phase)
Definition: MaterialTraits.hpp:102
static constexpr int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:93
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:90
A generic traits class for two-phase material laws.
Definition: MaterialTraits.hpp:61
static constexpr int nonWettingPhaseIdx
The index of the non-wetting phase.
Definition: MaterialTraits.hpp:73
static constexpr int wettingPhaseIdx
The index of the wetting phase.
Definition: MaterialTraits.hpp:70
ScalarT Scalar
The type used for scalar floating point values.
Definition: MaterialTraits.hpp:64
static constexpr int numPhases
The number of fluid phases.
Definition: MaterialTraits.hpp:67