From 25731a67dde2f425bea697844d57901e52c58d8c Mon Sep 17 00:00:00 2001 From: Joakim Hove Date: Thu, 5 Nov 2020 09:39:57 +0100 Subject: [PATCH] Minor refactor of function --- src/opm/output/eclipse/AggregateGroupData.cpp | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/opm/output/eclipse/AggregateGroupData.cpp b/src/opm/output/eclipse/AggregateGroupData.cpp index 1a63ba72b..d40324cc9 100644 --- a/src/opm/output/eclipse/AggregateGroupData.cpp +++ b/src/opm/output/eclipse/AggregateGroupData.cpp @@ -274,23 +274,19 @@ bool higherLevelProdCMode_NotNoneFld(const Opm::Schedule& sched, const Opm::Group& group, const size_t simStep) { - bool ctrl_mode_not_none_fld = false; - if (group.defined( simStep )) { - auto current = group; - while (current.name() != "FIELD" && ctrl_mode_not_none_fld == false) { - current = sched.getGroup(current.parent(), simStep); - 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; - } - } - 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()); + auto current = group; + while (current.name() != "FIELD") { + current = sched.getGroup(current.parent(), simStep); + const auto& prod_cmode = group.gconprod_cmode(); + + if (prod_cmode != Opm::Group::ProductionCMode::FLD) + return true; + + if (prod_cmode != Opm::Group::ProductionCMode::NONE) + return true; + } + return false; } int higherLevelInjCMode_NotNoneFld_SeqIndex(const Opm::Schedule& sched,