My Project
action.hpp
1 /*
2  Copyright 2021 Equinor ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify 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 
19 #ifndef RST_ACTIONX
20 #define RST_ACTIONX
21 
22 #include <ctime>
23 #include <optional>
24 #include <string>
25 #include <variant>
26 #include <vector>
27 
28 #include <opm/parser/eclipse/EclipseState/Schedule/Action/Enums.hpp>
29 #include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
30 
31 namespace Opm {
32 
33 namespace RestartIO {
34 
35 struct RstAction {
36  struct Quantity {
37  std::variant<std::string, double> quantity;
38  std::optional<std::string> wgname;
39 
40  Quantity() = default;
41  Quantity(const std::string * zacn, double sacn_value);
42  Quantity(const std::string& quantity);
43  Quantity(double value);
44  };
45 
46 
47  struct Condition {
48  static bool valid(const std::string * zacn, const int * iacn);
49  Condition(const std::string * zacn, const int * iacn, const double * sacn);
50  Action::Logical logic;
51  Action::Comparator cmp_op;
52  Quantity lhs;
53  Quantity rhs;
54  bool left_paren{false};
55  bool right_paren{false};
56 
57  std::vector<std::string> tokens() const;
58  };
59 
60 
61  RstAction(const std::string& name_arg, int max_run_arg, int run_count_arg, double min_wait_arg, std::time_t start_time, std::time_t last_run, std::vector<Condition> conditions_arg);
62 
63  std::string name;
64  int max_run;
65  int run_count;
66  double min_wait;
67  std::time_t start_time;
68  std::optional<std::time_t> last_run;
69  std::vector<Condition> conditions;
70  std::vector<DeckKeyword> keywords;
71 };
72 
73 }
74 }
75 
76 
77 
78 #endif
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: action.hpp:47
Definition: action.hpp:36
Definition: action.hpp:35