BlackoilPhases.hpp
Go to the documentation of this file.
1 /*
2  Copyright 2010, 2011, 2012 SINTEF ICT, Applied Mathematics.
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 3 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 
20 #ifndef OPM_BLACKOILPHASES_HEADER_INCLUDED
21 #define OPM_BLACKOILPHASES_HEADER_INCLUDED
22 
23 
24 namespace Opm
25 {
26 
28  {
29  public:
30  static const int MaxNumPhases = 3;
31  // enum ComponentIndex { Water = 0, Oil = 1, Gas = 2 };
32  enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2 };
33 
34  };
35 
36  struct PhaseUsage : public BlackoilPhases
37  {
41  };
42 
49  {
50  public:
52  : present_(0)
53  {}
54 
55  bool hasFreeWater() const { return present(BlackoilPhases::Aqua ); }
56  bool hasFreeOil () const { return present(BlackoilPhases::Liquid); }
57  bool hasFreeGas () const { return present(BlackoilPhases::Vapour); }
58 
59  void setFreeWater() { insert(BlackoilPhases::Aqua ); }
60  void setFreeOil () { insert(BlackoilPhases::Liquid); }
61  void setFreeGas () { insert(BlackoilPhases::Vapour); }
62 
63  private:
64  unsigned char present_;
65 
66  bool present(const BlackoilPhases::PhaseIndex i) const
67  {
68  return present_ & (1 << i);
69  }
70 
71  void insert(const BlackoilPhases::PhaseIndex i)
72  {
73  present_ |= (1 << i);
74  }
75  };
76 
77 } // namespace Opm
78 
79 #endif // OPM_BLACKOILPHASES_HEADER_INCLUDED
Definition: BlackoilPhases.hpp:48
Definition: AnisotropicEikonal.hpp:43
Definition: BlackoilPhases.hpp:27
Definition: BlackoilPhases.hpp:32
bool hasFreeGas() const
Definition: BlackoilPhases.hpp:57
int phase_used[MaxNumPhases]
Definition: BlackoilPhases.hpp:39
bool hasFreeWater() const
Definition: BlackoilPhases.hpp:55
int phase_pos[MaxNumPhases]
Definition: BlackoilPhases.hpp:40
bool hasFreeOil() const
Definition: BlackoilPhases.hpp:56
int num_phases
Definition: BlackoilPhases.hpp:38
void setFreeOil()
Definition: BlackoilPhases.hpp:60
PhasePresence()
Definition: BlackoilPhases.hpp:51
PhaseIndex
Definition: BlackoilPhases.hpp:32
Definition: BlackoilPhases.hpp:32
void setFreeGas()
Definition: BlackoilPhases.hpp:61
static const int MaxNumPhases
Definition: BlackoilPhases.hpp:30
Definition: BlackoilPhases.hpp:32
Definition: BlackoilPhases.hpp:36
void setFreeWater()
Definition: BlackoilPhases.hpp:59