My Project
RFTConfig.hpp
1 /*
2  Copyright 2019 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 RFT_CONFIG2_HPP
20 #define RFT_CONFIG2_HPP
21 
22 #include <cstddef>
23 #include <optional>
24 #include <string>
25 #include <unordered_map>
26 #include <utility>
27 
28 namespace Opm {
29 
30 class RFTConfig {
31 public:
32  enum class RFT {
33  YES = 1,
34  REPT = 2,
35  TIMESTEP = 3,
36  FOPN = 4,
37  NO = 5
38  };
39  static std::string RFT2String(RFT enumValue);
40  static RFT RFTFromString(const std::string &stringValue);
41 
42  enum class PLT {
43  YES = 1,
44  REPT = 2,
45  TIMESTEP = 3,
46  NO = 5
47  };
48  static std::string PLT2String(PLT enumValue);
49  static PLT PLTFromString( const std::string& stringValue);
50 
51 
52  void first_open(bool on);
53  void update(const std::string& wname, PLT mode);
54  void update(const std::string& wname, RFT mode);
55  bool active() const;
56  bool rft() const;
57  bool rft(const std::string& wname) const;
58  bool plt() const;
59  bool plt(const std::string& wname) const;
60  std::optional<RFTConfig> next() const;
61  std::optional<RFTConfig> well_open(const std::string& wname) const;
62 
63  static RFTConfig serializeObject();
64  bool operator==(const RFTConfig& data) const;
65 
66  template<class Serializer>
67  void serializeOp(Serializer& serializer)
68  {
69  serializer(first_open_rft);
70  serializer.template map<std::unordered_map<std::string, RFT>,false>(rft_state);
71  serializer.template map<std::unordered_map<std::string, PLT>,false>(plt_state);
72  serializer.template map<std::unordered_map<std::string, bool>,false>(open_wells);
73  }
74 
75 
76 private:
77  bool first_open_rft = false;
78  std::unordered_map<std::string, RFT> rft_state;
79  std::unordered_map<std::string, PLT> plt_state;
80  std::unordered_map<std::string, bool> open_wells;
81 };
82 
83 }
84 
85 #endif
Definition: RFTConfig.hpp:30
Definition: Serializer.hpp:38
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29