My Project
ActionContext.hpp
1 /*
2  Copyright 2018 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
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 #ifndef ActionContext_HPP
22 #define ActionContext_HPP
23 
24 #include <string>
25 #include <map>
26 
27 #include <opm/input/eclipse/Schedule/SummaryState.hpp>
28 #include <opm/input/eclipse/Schedule/Well/WListManager.hpp>
29 
30 namespace Opm {
31 namespace Action {
32 
33 /*
34  The Action::Context class is used as context when the ACTIONX condition is
35  evaluated. The Action::Context class is mainly just a thin wrapper around the
36  SummaryState class.
37 */
38 
39 class Context {
40 public:
41  explicit Context(const SummaryState& summary_state, const WListManager& wlm);
42 
43  /*
44  The get methods will first check the internal storage in the 'values' map
45  and then subsequently query the SummaryState member.
46  */
47  double get(const std::string& func, const std::string& arg) const;
48  void add(const std::string& func, const std::string& arg, double value);
49 
50  double get(const std::string& func) const;
51  void add(const std::string& func, double value);
52 
53  std::vector<std::string> wells(const std::string& func) const;
54  const WListManager& wlist_manager() const;
55 
56 private:
57  const SummaryState& summary_state;
58  const WListManager& wlm;
59  std::map<std::string, double> values;
60 };
61 }
62 }
63 #endif
Definition: ActionContext.hpp:39
Definition: SummaryState.hpp:69
Definition: WListManager.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29