Loading...
Searching...
No Matches
ActionContext.hpp
/*
Copyright 2018 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ActionContext_HPP
#define ActionContext_HPP
#include <functional>
#include <map>
#include <string>
#include <string_view>
#include <vector>
namespace Opm {
class SummaryState;
class WListManager;
} // namespace Opm
namespace Opm::Action {
class Context
{
public:
explicit Context(const SummaryState& summary_state,
const WListManager& wlm);
void add(std::string_view func, std::string_view arg, double value);
void add(const std::string& key, double value);
double get(std::string_view func, std::string_view arg) const;
double get(const std::string& key) const;
std::vector<std::string> wells(const std::string& func) const;
const WListManager& wlist_manager() const
{
return this->wListMgr_;
}
private:
std::reference_wrapper<const SummaryState> summaryState_;
std::reference_wrapper<const WListManager> wListMgr_;
std::map<std::string, double> values_{};
};
} // namespace Opm::Action
#endif // ActionContext_HPP
Opm::Action::Context::get
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
Opm::Action::Context::wlist_manager
const WListManager & wlist_manager() const
Get read-only access to run's well lists.
Definition ActionContext.hpp:101
Opm::Action::Context::Context
Context(const SummaryState &summary_state, const WListManager &wlm)
Constructor.
Definition ActionContext.cpp:42
Opm::Action::Context::wells
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
Opm::Action::Context::add
void add(std::string_view func, std::string_view arg, double value)
Assign function value for named entity.
Definition ActionContext.cpp:52
Opm::SummaryState
Definition SummaryState.hpp:72
Opm::WListManager
Definition WListManager.hpp:36
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30