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