HandlerContext: wpimult_global_factor is never nullptr
use a reference instead of a pointer
This commit is contained in:
parent
e334f28cc3
commit
32906b5022
@ -556,7 +556,7 @@ namespace Opm
|
||||
bool actionx_mode,
|
||||
SimulatorUpdate* sim_update,
|
||||
const std::unordered_map<std::string, double>* target_wellpi,
|
||||
std::unordered_map<std::string, double>* wpimult_global_factor = nullptr,
|
||||
std::unordered_map<std::string, double>& wpimult_global_factor,
|
||||
WelSegsSet* welsegs_wells = nullptr,
|
||||
std::set<std::string>* compsegs_wells = nullptr);
|
||||
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
ErrorGuard& errors_,
|
||||
SimulatorUpdate* sim_update_,
|
||||
const std::unordered_map<std::string, double>* target_wellpi_,
|
||||
std::unordered_map<std::string, double>* wpimult_global_factor_,
|
||||
std::unordered_map<std::string, double>& wpimult_global_factor_,
|
||||
WelSegsSet* welsegs_wells_,
|
||||
std::set<std::string>* compsegs_wells_)
|
||||
: block(block_)
|
||||
@ -96,7 +96,7 @@ public:
|
||||
const bool actionx_mode;
|
||||
const ParseContext& parseContext;
|
||||
ErrorGuard& errors;
|
||||
std::unordered_map<std::string, double>* wpimult_global_factor{nullptr};
|
||||
std::unordered_map<std::string, double>& wpimult_global_factor;
|
||||
const ScheduleGrid& grid;
|
||||
|
||||
private:
|
||||
|
@ -2291,13 +2291,10 @@ Well{0} entered with 'FIELD' parent group:
|
||||
// whether it is the last one.
|
||||
const bool default_con_comp = defaultConCompRec(record);
|
||||
if (default_con_comp) {
|
||||
auto wpimult_global_factor = handlerContext.wpimult_global_factor;
|
||||
if (!wpimult_global_factor) {
|
||||
throw std::runtime_error(" wpimult_global_factor is nullptr in function handleWPIMULT ");
|
||||
}
|
||||
auto& wpimult_global_factor = handlerContext.wpimult_global_factor;
|
||||
const auto scaling_factor = record.getItem("WELLPI").get<double>(0);
|
||||
for (const auto& wname : well_names) {
|
||||
(*wpimult_global_factor)[wname] = scaling_factor;
|
||||
wpimult_global_factor.insert_or_assign(wname, scaling_factor);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ Schedule::Schedule(const Deck& deck, const EclipseState& es, const std::optional
|
||||
bool actionx_mode,
|
||||
SimulatorUpdate* sim_update,
|
||||
const std::unordered_map<std::string, double>* target_wellpi,
|
||||
std::unordered_map<std::string, double>* wpimult_global_factor,
|
||||
std::unordered_map<std::string, double>& wpimult_global_factor,
|
||||
WelSegsSet* welsegs_wells,
|
||||
std::set<std::string>* compsegs_wells)
|
||||
{
|
||||
@ -690,7 +690,7 @@ void Schedule::iterateScheduleSection(std::size_t load_start, std::size_t load_e
|
||||
false,
|
||||
nullptr,
|
||||
target_wellpi,
|
||||
&wpimult_global_factor,
|
||||
wpimult_global_factor,
|
||||
&welsegs_wells,
|
||||
&compsegs_wells);
|
||||
keyword_index++;
|
||||
@ -1522,7 +1522,7 @@ File {} line {}.)", pattern, location.keyword, location.filename, location.linen
|
||||
/*actionx_mode=*/false,
|
||||
&sim_update,
|
||||
&target_wellpi,
|
||||
&wpimult_global_factor);
|
||||
wpimult_global_factor);
|
||||
}
|
||||
this->applyGlobalWPIMULT(wpimult_global_factor);
|
||||
this->end_report(reportStep);
|
||||
@ -1577,7 +1577,7 @@ File {} line {}.)", pattern, location.keyword, location.filename, location.linen
|
||||
true,
|
||||
&sim_update,
|
||||
&target_wellpi,
|
||||
&wpimult_global_factor);
|
||||
wpimult_global_factor);
|
||||
}
|
||||
|
||||
this->applyGlobalWPIMULT(wpimult_global_factor);
|
||||
|
Loading…
Reference in New Issue
Block a user