RestartValue.hpp
Go to the documentation of this file.
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 <map>
22#include <string>
23#include <utility>
24#include <vector>
25
27
31
32namespace Opm {
33
34 class RestartKey {
35 public:
36
39 bool required = false;
40
41 RestartKey() = default;
42
44 : key(_key),
45 dim(_dim),
47 {}
48
49
50 RestartKey( const std::string& _key, UnitSystem::measure _dim, bool _required)
51 : key(_key),
52 dim(_dim),
53 required(_required)
54 {}
55
56 bool operator==(const RestartKey& key2) const
57 {
58 return key == key2.key &&
59 dim == key2.dim &&
60 required == key2.required;
61 }
62 };
63
64 /*
65 A simple class used to communicate values between the simulator and
66 the RestartIO functions.
67 */
69 public:
70 using ExtraVector = std::vector<std::pair<RestartKey, std::vector<double>>>;
74 std::vector<data::AquiferData> aquifer;
75
77
79
80 bool hasExtra(const std::string& key) const;
81 void addExtra(const std::string& key, UnitSystem::measure dimension, std::vector<double> data);
82 void addExtra(const std::string& key, std::vector<double> data);
83 const std::vector<double>& getExtra(const std::string& key) const;
84
85 void convertFromSI(const UnitSystem& units);
86 void convertToSI(const UnitSystem& units);
87
88 bool operator==(const RestartValue& val2) const
89 {
90 return solution == val2.solution &&
91 wells == val2.wells &&
92 extra == val2.extra;
93 }
94 };
95
96}
97
98#endif // RESTART_VALUE_HPP
const char *const string
Definition: cJSON.h:170
Definition: RestartValue.hpp:34
std::string key
Definition: RestartValue.hpp:37
bool operator==(const RestartKey &key2) const
Definition: RestartValue.hpp:56
UnitSystem::measure dim
Definition: RestartValue.hpp:38
RestartKey(const std::string &_key, UnitSystem::measure _dim)
Definition: RestartValue.hpp:43
RestartKey(const std::string &_key, UnitSystem::measure _dim, bool _required)
Definition: RestartValue.hpp:50
RestartKey()=default
bool required
Definition: RestartValue.hpp:39
Definition: RestartValue.hpp:68
RestartValue(data::Solution sol, data::Wells wells_arg)
void addExtra(const std::string &key, std::vector< double > data)
data::Wells wells
Definition: RestartValue.hpp:72
void addExtra(const std::string &key, UnitSystem::measure dimension, std::vector< double > data)
void convertFromSI(const UnitSystem &units)
bool operator==(const RestartValue &val2) const
Definition: RestartValue.hpp:88
void convertToSI(const UnitSystem &units)
RestartValue()
Definition: RestartValue.hpp:78
std::vector< std::pair< RestartKey, std::vector< double > > > ExtraVector
Definition: RestartValue.hpp:70
std::vector< data::AquiferData > aquifer
Definition: RestartValue.hpp:74
bool hasExtra(const std::string &key) const
data::Solution solution
Definition: RestartValue.hpp:71
ExtraVector extra
Definition: RestartValue.hpp:73
const std::vector< double > & getExtra(const std::string &key) const
Definition: UnitSystem.hpp:32
measure
Definition: UnitSystem.hpp:42
Definition: custom-opm-common/opm-common/opm/output/data/Solution.hpp:32
Definition: Wells.hpp:299
#define true
Definition: msvc_stdbool.h:18
Definition: A.hpp:4
static std::string data()
Definition: exprtk.hpp:40022