My Project
Loading...
Searching...
No Matches
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
28namespace Opm {
29
31{
32public:
33 enum class RFT {
34 YES = 1,
35 REPT = 2,
36 TIMESTEP = 3,
37 FOPN = 4,
38 NO = 5,
39 };
40 static std::string RFT2String(const RFT enumValue);
41 static RFT RFTFromString(const std::string &stringValue);
42
43 enum class PLT {
44 YES = 1,
45 REPT = 2,
46 TIMESTEP = 3,
47 NO = 5,
48 };
49 static std::string PLT2String(const PLT enumValue);
50 static PLT PLTFromString( const std::string& stringValue);
51
52 void first_open(bool on);
53 void update(const std::string& wname, const PLT mode);
54 void update(const std::string& wname, const RFT mode);
55 void update_segment(const std::string& wname, const PLT mode);
56
57 bool active() const;
58
59 bool rft() const;
60 bool rft(const std::string& wname) const;
61
62 bool plt() const;
63 bool plt(const std::string& wname) const;
64
65 bool segment() const;
66 bool segment(const std::string& wname) const;
67
68 std::optional<RFTConfig> next() const;
69 std::optional<RFTConfig> well_open(const std::string& wname) const;
70
71 static RFTConfig serializationTestObject();
72 bool operator==(const RFTConfig& data) const;
73
74 template <class Serializer>
75 void serializeOp(Serializer& serializer)
76 {
77 serializer(this->first_open_rft);
78 serializer(this->rft_state);
79 serializer(this->plt_state);
80 serializer(this->seg_state);
81 serializer(this->open_wells);
82 }
83
84private:
85 template <typename Kind>
86 using StateMap = std::unordered_map<std::string, Kind>;
87
88 // Please make sure that member functions serializeOp(), operator==(),
89 // and serializationTestObject() are also up to date when changing this list of
90 // data members.
91 bool first_open_rft = false;
92 StateMap<RFT> rft_state{};
93 StateMap<PLT> plt_state{};
94 StateMap<PLT> seg_state{};
95 std::unordered_map<std::string, bool> open_wells{};
96
97 void update_state(const std::string& wname,
98 const PLT mode,
99 StateMap<PLT>& state);
100};
101
102} // namespace Opm
103
104#endif // RFT_CONFIG2_HPP
Definition RFTConfig.hpp:31
Class for (de-)serializing.
Definition Serializer.hpp:84
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30