Minor refactor of function

This commit is contained in:
Joakim Hove 2020-11-05 09:39:57 +01:00
parent 618595e538
commit 25731a67dd

View File

@ -274,23 +274,19 @@ bool higherLevelProdCMode_NotNoneFld(const Opm::Schedule& sched,
const Opm::Group& group, const Opm::Group& group,
const size_t simStep) const size_t simStep)
{ {
bool ctrl_mode_not_none_fld = false; auto current = group;
if (group.defined( simStep )) { while (current.name() != "FIELD") {
auto current = group; current = sched.getGroup(current.parent(), simStep);
while (current.name() != "FIELD" && ctrl_mode_not_none_fld == false) { const auto& prod_cmode = group.gconprod_cmode();
current = sched.getGroup(current.parent(), simStep);
const auto& prod_cmode = group.gconprod_cmode(); if (prod_cmode != Opm::Group::ProductionCMode::FLD)
if ((prod_cmode != Opm::Group::ProductionCMode::FLD) && (prod_cmode!= Opm::Group::ProductionCMode::NONE)) { return true;
ctrl_mode_not_none_fld = true;
} if (prod_cmode != Opm::Group::ProductionCMode::NONE)
} return true;
return ctrl_mode_not_none_fld;
}
else {
std::stringstream str;
str << "actual group has not been defined at report time: " << simStep;
throw std::invalid_argument(str.str());
} }
return false;
} }
int higherLevelInjCMode_NotNoneFld_SeqIndex(const Opm::Schedule& sched, int higherLevelInjCMode_NotNoneFld_SeqIndex(const Opm::Schedule& sched,