ActionContext.hpp
Go to the documentation of this file.
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
28
29namespace Opm {
30namespace Action {
31
32/*
33 The Action::Context class is used as context when the ACTIONX condition is
34 evaluated. The Action::Context class is mainly just a thin wrapper around the
35 SummaryState class.
36*/
37
38class Context {
39public:
40 explicit Context(const SummaryState& summary_state);
41
42 /*
43 The get methods will first check the internal storage in the 'values' map
44 and then subsequently query the SummaryState member.
45 */
46 double get(const std::string& func, const std::string& arg) const;
47 void add(const std::string& func, const std::string& arg, double value);
48
49 double get(const std::string& func) const;
50 void add(const std::string& func, double value);
51
52 std::vector<std::string> wells(const std::string& func) const;
53
54private:
55 const SummaryState& summary_state;
56 std::map<std::string, double> values;
57};
58}
59}
60#endif
const char *const string
Definition: cJSON.h:170
Definition: ActionContext.hpp:38
double get(const std::string &func, const std::string &arg) const
double get(const std::string &func) const
void add(const std::string &func, const std::string &arg, double value)
Context(const SummaryState &summary_state)
void add(const std::string &func, double value)
std::vector< std::string > wells(const std::string &func) const
Definition: SummaryState.hpp:65
Action
Definition: InputErrorAction.hpp:36
Definition: A.hpp:4
T value(details::expression_node< T > *n)
Definition: exprtk.hpp:12955