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;
if (group.defined( simStep )) {
auto current = group; auto current = group;
while (current.name() != "FIELD" && ctrl_mode_not_none_fld == false) { while (current.name() != "FIELD") {
current = sched.getGroup(current.parent(), simStep); current = sched.getGroup(current.parent(), simStep);
const auto& prod_cmode = group.gconprod_cmode(); const auto& prod_cmode = group.gconprod_cmode();
if ((prod_cmode != Opm::Group::ProductionCMode::FLD) && (prod_cmode!= Opm::Group::ProductionCMode::NONE)) {
ctrl_mode_not_none_fld = true; if (prod_cmode != Opm::Group::ProductionCMode::FLD)
} return true;
}
return ctrl_mode_not_none_fld; if (prod_cmode != Opm::Group::ProductionCMode::NONE)
} return true;
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,