GasLiftGroupInfo: use an array to allow for one sum call

This commit is contained in:
Arne Morten Kvarving 2021-11-09 12:51:49 +01:00
parent fcb6ee60fb
commit 04ed31f800

View File

@ -346,10 +346,8 @@ std::tuple<double, double, double, double>
GasLiftGroupInfo:: GasLiftGroupInfo::
initializeGroupRatesRecursive_(const Group &group) initializeGroupRatesRecursive_(const Group &group)
{ {
double oil_rate = 0.0; std::array<double,4> rates{};
double water_rate = 0.0; auto& [oil_rate, water_rate, gas_rate, alq] = rates;
double gas_rate = 0.0;
double alq = 0.0;
if (group.wellgroup()) { if (group.wellgroup()) {
for (const std::string& well_name : group.wells()) { for (const std::string& well_name : group.wells()) {
// NOTE: we cannot simply use: // NOTE: we cannot simply use:
@ -374,10 +372,7 @@ initializeGroupRatesRecursive_(const Group &group)
} }
} }
} }
oil_rate = this->comm_.sum(oil_rate); this->comm_.sum(rates.data(), rates.size());
gas_rate = this->comm_.sum(gas_rate);
water_rate = this->comm_.sum(water_rate);
alq = this->comm_.sum(alq);
} }
else { else {
for (const std::string& group_name : group.groups()) { for (const std::string& group_name : group.groups()) {