19#ifndef HANDLER_CONTEXT_HPP
20#define HANDLER_CONTEXT_HPP
22#include <opm/common/OpmLog/KeywordLocation.hpp>
28#include <unordered_map>
33namespace Action {
class WGNames; }
43struct SimulatorUpdate;
56 const std::size_t currentStep_,
57 const std::vector<std::string>& matching_wells_,
62 const std::unordered_map<std::string, double>* target_wellpi_,
63 std::unordered_map<std::string, double>& wpimult_global_factor_,
65 std::set<std::string>* compsegs_wells_)
68 , currentStep(currentStep_)
69 , matching_wells(matching_wells_)
70 , actionx_mode(actionx_mode_)
71 , parseContext(parseContext_)
73 , wpimult_global_factor(wpimult_global_factor_)
75 , target_wellpi(target_wellpi_)
76 , welsegs_wells(welsegs_wells_)
77 , compsegs_wells(compsegs_wells_)
78 , sim_update(sim_update_)
112 std::optional<KeywordLocation> location = {});
118 void addGroup(
const std::string& groupName);
121 const std::string& child_group);
125 const std::string& wellName,
126 const std::string& groupName);
130 const std::vector<std::string>&
wellNames,
131 const std::string& groupName);
134 double getWellPI(
const std::string& well_name)
const;
146 std::vector<std::string>
groupNames(
const std::string& pattern)
const;
150 std::vector<std::string>
151 wellNames(
const std::string& pattern)
const;
156 std::vector<std::string>
157 wellNames(
const std::string& pattern,
bool allowEmpty)
const;
159 const ScheduleBlock& block;
160 const DeckKeyword& keyword;
161 const std::size_t currentStep;
162 const std::vector<std::string>& matching_wells;
163 const bool actionx_mode;
164 const ParseContext& parseContext;
166 std::unordered_map<std::string, double>& wpimult_global_factor;
167 const ScheduleGrid& grid;
170 const std::unordered_map<std::string, double>* target_wellpi{
nullptr};
171 WelSegsSet* welsegs_wells{
nullptr};
172 std::set<std::string>* compsegs_wells{
nullptr};
173 SimulatorUpdate* sim_update{
nullptr};
Definition DeckKeyword.hpp:36
Definition ErrorGuard.hpp:29
Definition HandlerContext.hpp:48
void compsegs_handled(const std::string &well_name)
Mark that the well occured in a COMPSEGS keyword.
Definition HandlerContext.cpp:78
void addGroupToGroup(const std::string &parent_group, const std::string &child_group)
Adds a group to a group.
Definition HandlerContext.cpp:178
HandlerContext(Schedule &schedule, const ScheduleBlock &block_, const DeckKeyword &keyword_, const ScheduleGrid &grid_, const std::size_t currentStep_, const std::vector< std::string > &matching_wells_, bool actionx_mode_, const ParseContext &parseContext_, ErrorGuard &errors_, SimulatorUpdate *sim_update_, const std::unordered_map< std::string, double > *target_wellpi_, std::unordered_map< std::string, double > &wpimult_global_factor_, WelSegsSet *welsegs_wells_, std::set< std::string > *compsegs_wells_)
Definition HandlerContext.hpp:52
void setExitCode(int code)
Set exit code.
Definition HandlerContext.cpp:90
void welspecsCreateNewWell(const DeckRecord &record, const std::string &wellName, const std::string &groupName)
Create a new Well from a WELSPECS record.
Definition HandlerContext.cpp:184
ScheduleState & state()
Returns a reference to current state.
Definition HandlerContext.cpp:85
void addGroup(const std::string &groupName)
Adds a group to the schedule.
Definition HandlerContext.cpp:173
void record_well_structure_change()
Mark that well structure has changed.
Definition HandlerContext.cpp:64
void welpi_well(const std::string &well_name)
Mark that a well is affected by WELPI.
Definition HandlerContext.cpp:50
std::vector< std::string > groupNames(const std::string &pattern) const
Obtain well group names from a pattern.
Definition HandlerContext.cpp:155
void welspecsUpdateExistingWells(const DeckRecord &record, const std::vector< std::string > &wellNames, const std::string &groupName)
Update one or more existing wells from a WELSPECS record.
Definition HandlerContext.cpp:213
WellStatus getWellStatus(const std::string &well) const
Get status of a well.
Definition HandlerContext.cpp:103
const Action::WGNames & action_wgnames() const
Obtain action well group names.
Definition HandlerContext.cpp:149
void record_tran_change()
Mark that transmissibilities must be recalculated.
Definition HandlerContext.cpp:57
double getWellPI(const std::string &well_name) const
Obtain PI for a well.
Definition HandlerContext.cpp:113
void invalidNamePattern(const std::string &namePattern) const
Adds parse error for an invalid name pattern.
Definition HandlerContext.cpp:132
std::vector< std::string > wellNames(const std::string &pattern) const
Obtain well names from a pattern.
Definition HandlerContext.cpp:167
double elapsed_seconds() const
Returns elapsed time since simulation start in seconds.
Definition HandlerContext.cpp:127
void welsegs_handled(const std::string &well_name)
Mark that the well occured in a WELSEGS keyword.
Definition HandlerContext.cpp:71
bool updateWellStatus(const std::string &well, WellStatus status, std::optional< KeywordLocation > location={})
Update status of a well.
Definition HandlerContext.cpp:95
const ScheduleStatic & static_schedule() const
Returns a const-ref to the static schedule.
Definition HandlerContext.cpp:108
void affected_well(const std::string &well_name)
Mark that a well has changed.
Definition HandlerContext.cpp:43
Definition ParseContext.hpp:84
Definition ScheduleBlock.hpp:52
Definition ScheduleGrid.hpp:37
Definition ScheduleState.hpp:94
Definition Schedule.hpp:89
Definition WelSegsSet.hpp:34
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30
Definition ScheduleStatic.hpp:40
This struct is used to communicate back from the Schedule::applyAction() what needs to be updated in ...
Definition SimulatorUpdate.hpp:33