HandlerContext: introduce a mark_tran_change method
make the sim_update pointer member private so we can centralize checks for nullptrs
This commit is contained in:
parent
a7f709f9f3
commit
23c3ba7475
@ -34,6 +34,13 @@ void HandlerContext::affected_well(const std::string& well_name)
|
||||
}
|
||||
}
|
||||
|
||||
void HandlerContext::record_tran_change()
|
||||
{
|
||||
if (sim_update) {
|
||||
sim_update->tran_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
void HandlerContext::record_well_structure_change()
|
||||
{
|
||||
if (sim_update) {
|
||||
|
@ -63,17 +63,20 @@ public:
|
||||
, actionx_mode(actionx_mode_)
|
||||
, parseContext(parseContext_)
|
||||
, errors(errors_)
|
||||
, sim_update(sim_update_)
|
||||
, target_wellpi(target_wellpi_)
|
||||
, wpimult_global_factor(wpimult_global_factor_)
|
||||
, welsegs_wells(welsegs_wells_)
|
||||
, compsegs_wells(compsegs_wells_)
|
||||
, grid(grid_)
|
||||
, sim_update(sim_update_)
|
||||
{}
|
||||
|
||||
//! \brief Mark that a well has changed.
|
||||
void affected_well(const std::string& well_name);
|
||||
|
||||
//! \brief Mark that transmissibilities must be recalculated.
|
||||
void record_tran_change();
|
||||
|
||||
//! \brief Mark that well structure has changed.
|
||||
void record_well_structure_change();
|
||||
|
||||
@ -90,12 +93,14 @@ public:
|
||||
const bool actionx_mode;
|
||||
const ParseContext& parseContext;
|
||||
ErrorGuard& errors;
|
||||
SimulatorUpdate* sim_update{nullptr};
|
||||
const std::unordered_map<std::string, double>* target_wellpi{nullptr};
|
||||
std::unordered_map<std::string, double>* wpimult_global_factor{nullptr};
|
||||
WelSegsSet* welsegs_wells{nullptr};
|
||||
std::set<std::string>* compsegs_wells{nullptr};
|
||||
const ScheduleGrid& grid;
|
||||
|
||||
private:
|
||||
SimulatorUpdate* sim_update{nullptr};
|
||||
};
|
||||
|
||||
} // end namespace Opm
|
||||
|
@ -990,8 +990,7 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
|
||||
void Schedule::handleGEOKeyword(HandlerContext& handlerContext) {
|
||||
this->snapshots.back().geo_keywords().push_back(handlerContext.keyword);
|
||||
this->snapshots.back().events().addEvent( ScheduleEvents::GEO_MODIFIER );
|
||||
if (handlerContext.sim_update)
|
||||
handlerContext.sim_update->tran_update = true;
|
||||
handlerContext.record_tran_change();
|
||||
}
|
||||
|
||||
void Schedule::handleMXUNSUPP(HandlerContext& handlerContext) {
|
||||
|
Loading…
Reference in New Issue
Block a user