My Project
Loading...
Searching...
No Matches
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#ifndef ActionContext_HPP
21#define ActionContext_HPP
22
23#include <functional>
24#include <map>
25#include <string>
26#include <string_view>
27#include <vector>
28
29namespace Opm {
30
31class SummaryState;
32class WListManager;
33
34} // namespace Opm
35
36namespace Opm::Action {
37
42{
43public:
49 explicit Context(const SummaryState& summary_state,
50 const WListManager& wlm);
51
61 void add(std::string_view func, std::string_view arg, double value);
62
69 void add(const std::string& key, double value);
70
79 double get(std::string_view func, std::string_view arg) const;
80
87 double get(const std::string& key) const;
88
96 std::vector<std::string> wells(const std::string& func) const;
97
102 {
103 return this->wListMgr_;
104 }
105
106private:
108 std::reference_wrapper<const SummaryState> summaryState_;
109
111 std::reference_wrapper<const WListManager> wListMgr_;
112
117 std::map<std::string, double> values_{};
118};
119
120} // namespace Opm::Action
121
122#endif // ActionContext_HPP
Manager of summary vector values.
Definition ActionContext.hpp:42
double get(std::string_view func, std::string_view arg) const
Retrieve function value (e.g., WOPR) for a specific entity.
Definition ActionContext.cpp:65
const WListManager & wlist_manager() const
Get read-only access to run's well lists.
Definition ActionContext.hpp:101
std::vector< std::string > wells(const std::string &func) const
Retrieve name of all wells for which specified summary function is defined.
Definition ActionContext.cpp:81
void add(std::string_view func, std::string_view arg, double value)
Assign function value for named entity.
Definition ActionContext.cpp:52
Definition SummaryState.hpp:72
Definition WListManager.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30