My Project
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 */
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
83 data::Wells wells_arg,
84 data::GroupAndNetworkValues grpn_nwrk_arg,
85 data::Aquifers aquifer_arg);
86
87 RestartValue() = default;
88
89 bool hasExtra(const std::string& key) const;
90 void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<double> data);
91 void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<float> data);
92 void addExtra(const std::string& key, std::vector<double> data);
93 void addExtra(const std::string& key, std::vector<float> data);
94 const std::vector<double>& getExtra(const std::string& key) const;
95
96 void convertFromSI(const UnitSystem& units);
97 void convertToSI(const UnitSystem& units);
98
99 bool operator==(const RestartValue& val2) const;
100
101 template<class Serializer>
102 void serializeOp(Serializer& serializer)
103 {
104 serializer(solution);
105 serializer(wells);
106 serializer(grp_nwrk);
107 serializer(aquifer);
108 serializer(extra);
109 }
110
111 static RestartValue serializationTestObject();
112 };
113
114}
115
116#endif // RESTART_VALUE_HPP
Definition RestartValue.hpp:34
Definition RestartValue.hpp:72
Class for (de-)serializing.
Definition Serializer.hpp:91
Definition UnitSystem.hpp:34
Definition Groups.hpp:212
Definition Solution.hpp:35
Definition Wells.hpp:922
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30