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 <map>
29#include <string>
30#include <utility>
31#include <vector>
32
33namespace Opm {
34
35 class RestartKey {
36 public:
37
38 std::string key;
39 UnitSystem::measure dim;
40 bool required = false;
41
42 RestartKey() = default;
43
44 RestartKey( const std::string& _key, UnitSystem::measure _dim)
45 : key(_key),
46 dim(_dim),
47 required(true)
48 {}
49
50
51 RestartKey( const std::string& _key, UnitSystem::measure _dim, bool _required)
52 : key(_key),
53 dim(_dim),
54 required(_required)
55 {}
56
57 bool operator==(const RestartKey& key2) const;
58
59 template<class Serializer>
60 void serializeOp(Serializer& serializer)
61 {
62 serializer(key);
63 serializer(dim);
64 serializer(required);
65 }
66
67 static RestartKey serializationTestObject();
68 };
69
70 /*
71 A simple class used to communicate values between the simulator and
72 the RestartIO functions.
73 */
75 public:
76 using ExtraVector = std::vector<std::pair<RestartKey, std::vector<double>>>;
77
78 data::Solution solution{};
79 data::Wells wells{};
81 data::Aquifers aquifer{};
82 ExtraVector extra{};
83
85 data::Wells wells_arg,
86 data::GroupAndNetworkValues grpn_nwrk_arg,
87 data::Aquifers aquifer_arg);
88
89 RestartValue() = default;
90
91 bool hasExtra(const std::string& key) const;
92 void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<double> data);
93 void addExtra(const std::string& key, std::vector<double> 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:35
Definition RestartValue.hpp:74
Class for (de-)serializing.
Definition Serializer.hpp:84
Definition UnitSystem.hpp:34
Definition Groups.hpp:212
Definition Solution.hpp:35
Definition Wells.hpp:854
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30