My Project
Loading...
Searching...
No Matches
GrupSlav.hpp
1/*
2 Copyright 2024 Equinor ASA.
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#ifndef OPM_RESERVOIR_COUPLING_GRUPSLAV_HPP
20#define OPM_RESERVOIR_COUPLING_GRUPSLAV_HPP
21
22#include <iostream>
23#include <map>
24#include <stdexcept>
25#include <string>
26
27namespace Opm {
28
29class HandlerContext;
30
31namespace ReservoirCoupling {
32class GrupSlav {
33public:
34 enum class FilterFlag {
35 MAST,
36 SLAV,
37 BOTH
38 };
39
40 GrupSlav() = default;
41
43 const std::string& name,
44 const std::string& master_group_name,
45 FilterFlag oil_prod_flag,
46 FilterFlag liquid_prod_flag,
47 FilterFlag gas_prod_flag,
48 FilterFlag fluid_volume_prod_flag,
49 FilterFlag oil_inj_flag,
50 FilterFlag water_inj_flag,
51 FilterFlag gas_inj_flag
52 ) :
53 m_name{name},
54 m_master_group_name{master_group_name},
55 m_oil_prod_flag{oil_prod_flag},
56 m_liquid_prod_flag{liquid_prod_flag},
57 m_gas_prod_flag{gas_prod_flag},
58 m_fluid_volume_prod_flag{fluid_volume_prod_flag},
59 m_oil_inj_flag{oil_inj_flag},
60 m_water_inj_flag{water_inj_flag},
61 m_gas_inj_flag{gas_inj_flag}
62 {}
63
64 static GrupSlav serializationTestObject();
65
66 const std::string& name() const {
67 return this->m_name;
68 }
69
70 const std::string& masterGroupName() const {
71 return this->m_master_group_name;
72 }
73
74 FilterFlag oilProdFlag() const {
75 return this->m_oil_prod_flag;
76 }
77
78 FilterFlag liquidProdFlag() const {
79 return this->m_liquid_prod_flag;
80 }
81
82 FilterFlag gasProdFlag() const {
83 return this->m_gas_prod_flag;
84 }
85
86 FilterFlag fluidVolumeProdFlag() const {
87 return this->m_fluid_volume_prod_flag;
88 }
89
90 FilterFlag oilInjFlag() const {
91 return this->m_oil_inj_flag;
92 }
93
94 FilterFlag waterInjFlag() const {
95 return this->m_water_inj_flag;
96 }
97
98 FilterFlag gasInjFlag() const {
99 return this->m_gas_inj_flag;
100 }
101
102 void name(const std::string& value) {
103 this->m_name = value;
104 }
105
106 void masterGroupName(const std::string& value) {
107 this->m_master_group_name = value;
108 }
109
110 bool operator==(const GrupSlav& other) const;
111
112 template<class Serializer>
113 void serializeOp(Serializer& serializer)
114 {
115 serializer(m_name);
116 serializer(m_master_group_name);
117 serializer(m_oil_prod_flag);
118 serializer(m_liquid_prod_flag);
119 serializer(m_gas_prod_flag);
120 serializer(m_fluid_volume_prod_flag);
121 serializer(m_oil_inj_flag);
122 serializer(m_water_inj_flag);
123 serializer(m_gas_inj_flag);
124 }
125
126 static FilterFlag filterFlagFromString(const std::string& flag) {
127 if (flag == "MAST") {
128 return FilterFlag::MAST;
129 } else if (flag == "SLAV") {
130 return FilterFlag::SLAV;
131 } else if (flag == "BOTH") {
132 return FilterFlag::BOTH;
133 } else {
134 throw std::invalid_argument("Invalid filter flag: " + flag);
135 }
136 }
137private:
138 std::string m_name{};
139 std::string m_master_group_name{};
140 FilterFlag m_oil_prod_flag{FilterFlag::BOTH};
141 FilterFlag m_liquid_prod_flag{FilterFlag::BOTH};
142 FilterFlag m_gas_prod_flag{FilterFlag::BOTH};
143 FilterFlag m_fluid_volume_prod_flag{FilterFlag::BOTH};
144 FilterFlag m_oil_inj_flag{FilterFlag::BOTH};
145 FilterFlag m_water_inj_flag{FilterFlag::BOTH};
146 FilterFlag m_gas_inj_flag{FilterFlag::BOTH};
147};
148
149// NOTE: This operator is needed by Boost.Test, See tests/parser/ReservoirCouplingTests.cpp
150std::ostream& operator<<(std::ostream& os, const GrupSlav::FilterFlag& flag);
151
152} // namespace ReservoirCoupling
153
154extern void handleGRUPSLAV(HandlerContext& handlerContext);
155
156} // namespace Opm
157
158#endif // OPM_RESERVOIR_COUPLING_GRUPSLAV_HPP
Definition HandlerContext.hpp:54
Definition GrupSlav.hpp:32
Class for (de-)serializing.
Definition Serializer.hpp:94
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30