opm-common
Loading...
Searching...
No Matches
RestartValue.hpp
1/*
2 Copyright (c) 2017 Statoil ASA
3 This file is part of the Open Porous Media project (OPM).
4
5 OPM is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 OPM is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with OPM. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef RESTART_VALUE_HPP
19#define RESTART_VALUE_HPP
20
21#include <opm/output/data/Aquifer.hpp>
22#include <opm/output/data/Groups.hpp>
23#include <opm/output/data/Solution.hpp>
24#include <opm/output/data/Wells.hpp>
25
26#include <opm/input/eclipse/Units/UnitSystem.hpp>
27
28#include <string>
29#include <utility>
30#include <vector>
31
32namespace Opm {
33
34 class RestartKey {
35 public:
36 std::string key{};
37 UnitSystem::measure dim{UnitSystem::measure::_count};
38 bool required = false;
39
40 RestartKey() = default;
41
42 RestartKey( const std::string& _key, UnitSystem::measure _dim)
43 : key(_key),
44 dim(_dim),
45 required(true)
46 {}
47
48
49 RestartKey( const std::string& _key, UnitSystem::measure _dim, bool _required)
50 : key(_key),
51 dim(_dim),
52 required(_required)
53 {}
54
55 bool operator==(const RestartKey& key2) const;
56
57 template<class Serializer>
58 void serializeOp(Serializer& serializer)
59 {
60 serializer(key);
61 serializer(dim);
62 serializer(required);
63 }
64
65 static RestartKey serializationTestObject();
66 };
67
68 /*
69 A simple class used to communicate values between the simulator and
70 the RestartIO functions.
71 */
72 class RestartValue {
73 public:
74 using ExtraVector = std::vector<std::pair<RestartKey, std::vector<double>>>;
75
76 data::Solution solution{};
77 data::Wells wells{};
79 data::Aquifers aquifer{};
80 ExtraVector extra{};
81
82 RestartValue(data::Solution sol,
83 data::Wells wells_arg,
84 data::GroupAndNetworkValues grpn_nwrk_arg,
85 data::Aquifers aquifer_arg);
86
87 // Overloaded constructor to handle grid containing LGR
88 RestartValue(data::Solution sol,
89 data::Wells wells_arg,
90 data::GroupAndNetworkValues grpn_nwrk_arg,
91 data::Aquifers aquifer_arg,
92 int lgr_grid);
93
94 RestartValue() = default;
95
96 bool hasExtra(const std::string& key) const;
97 void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<double> data);
98 void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<float> data);
99 void addExtra(const std::string& key, std::vector<double> data);
100 void addExtra(const std::string& key, std::vector<float> data);
101 const std::vector<double>& getExtra(const std::string& key) const;
102 void convertFromSI(const UnitSystem& units);
103 void convertToSI(const UnitSystem& units);
104
105 bool operator==(const RestartValue& val2) const;
106
107 template<class Serializer>
108 void serializeOp(Serializer& serializer)
109 {
110 serializer(solution);
111 serializer(wells);
112 serializer(grp_nwrk);
113 serializer(aquifer);
114 serializer(extra);
115 }
116
117 static RestartValue serializationTestObject();
118
119 private:
120 void filter_wells_for_lgr(int lgr_grid);
121 };
122
123}
124
125#endif // RESTART_VALUE_HPP
Class for (de-)serializing.
Definition Serializer.hpp:94
Definition UnitSystem.hpp:34
Definition Groups.hpp:183
Definition Solution.hpp:35
Definition Wells.hpp:1197
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30