opm-common
MasterGroup.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_MASTER_GROUP_HPP
20 #define OPM_RESERVOIR_COUPLING_MASTER_GROUP_HPP
21 
22 #include <map>
23 #include <stdexcept>
24 #include <string>
25 
26 namespace Opm {
27 
28 class HandlerContext;
29 
30 namespace ReservoirCoupling {
31 
32 class MasterGroup {
33 public:
34  MasterGroup() = default;
35 
36  explicit MasterGroup(
37  const std::string& name,
38  const std::string& slave_name,
39  const std::string& slave_group_name,
40  double flow_limit_fraction
41  ) :
42  m_name{name},
43  m_slave_name{slave_name},
44  m_slave_group_name{slave_group_name},
45  m_flow_limit_fraction{flow_limit_fraction}
46  {}
47  static MasterGroup serializationTestObject();
48 
49  const std::string name() const {
50  return this->m_name;
51  }
52  const std::string slaveName() const {
53  return this->m_slave_name;
54  }
55  const std::string slaveGroupName() const {
56  return this->m_slave_group_name;
57  }
58  double flowLimitFraction() const {
59  return this->m_flow_limit_fraction;
60  }
61  void name(const std::string& value) {
62  this->m_name = value;
63  }
64  void slaveName(const std::string& value) {
65  this->m_slave_name = value;
66  }
67  void slaveGroupName(const std::string& value) {
68  this->m_slave_group_name = value;
69  }
70  void flowLimitFraction(double value) {
71  this->m_flow_limit_fraction = value;
72  }
73  bool operator==(const MasterGroup& other) const;
74 
75  template<class Serializer>
76  void serializeOp(Serializer& serializer)
77  {
78  serializer(m_name);
79  serializer(m_slave_name);
80  serializer(m_slave_group_name);
81  serializer(m_flow_limit_fraction);
82  }
83 
84 private:
85  std::string m_name{};
86  std::string m_slave_name{};
87  std::string m_slave_group_name{};
88  double m_flow_limit_fraction{};
89 };
90 
91 
92 } // namespace ReservoirCoupling
93 
94 extern void handleGRUPMAST(HandlerContext& handlerContext);
95 
96 } // namespace Opm
97 
98 #endif // OPM_RESERVOIR_COUPLING_MASTER_GROUP_HPP
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: MasterGroup.hpp:32
Class for (de-)serializing.
Definition: Serializer.hpp:94
Definition: HandlerContext.hpp:54