All Classes Functions Variables
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 <string>
22 #include <map>
23 #include <vector>
24 
25 namespace Opm {
26 
27 
28  /*
29  Small convenience class used in the map passed to the
30  RestartIO::load( ) function. A class instance can be constructed
31  from a UnitSystem::measure value, which will default to a
32  required key, but it can also be constructed from a
33  two-parameter constructor, and then the required/not required
34  can controlled explicitly:
35 
36 
37  RestartIO::load(..., {{"PRESSURE" , UnitSystem::measure::pressure},
38  {"MAX_SWAT" , {UnitSystem::measure::identity, false}} )
39 
40  The RestartKey( ) for pressure is implicitly created from
41  UnitSystem::measure::pressure and will be required, whereas the
42  MAX_SWAT keyword is optional.
43 
44  */
45  class RestartKey {
46  public:
47 
48  UnitSystem::measure dim;
49  bool required = true;
50 
51  explicit RestartKey( UnitSystem::measure _dim)
52  : dim(_dim)
53  {}
54 
55 
56  RestartKey( UnitSystem::measure _dim, bool _required)
57  : dim(_dim),
58  required(_required)
59  {}
60 
61  };
62 
63 
64  /*
65  A simple struct - the only purpose is to facilitate return by value from the
66  RestartIO::load( ) function.
67  */
68 
69 
70  struct RestartValue {
71 
72  data::Solution solution;
73  data::Wells wells;
74  std::map<std::string,std::vector<double>> extra = {};
75 
76 
77  RestartValue(data::Solution sol, data::Wells wells_arg, std::map<std::string, std::vector<double>> extra_arg) :
78  solution(std::move(sol)),
79  wells(std::move(wells_arg)),
80  extra(std::move(extra_arg))
81  {
82  }
83 
84 
85  RestartValue(data::Solution sol, data::Wells wells_arg) :
86  solution(std::move(sol)),
87  wells(std::move(wells_arg))
88  {
89  }
90 
91  };
92 
93 }
94 
95 
96 #endif
Definition: Solution.hpp:32
Definition: RestartValue.hpp:45
Definition: RestartValue.hpp:70
Definition: Wells.hpp:109