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