From 39a0766b8cc0a1067dbd539ccd6c51c8f00544b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Atgeirr=20Fl=C3=B8=20Rasmussen?= Date: Thu, 1 Oct 2015 11:05:35 +0200 Subject: [PATCH] Refactor MPI version of convergenceReduction(). --- opm/autodiff/BlackoilModelBase_impl.hpp | 38 +++++++++++-------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/opm/autodiff/BlackoilModelBase_impl.hpp b/opm/autodiff/BlackoilModelBase_impl.hpp index c19986603..9bf85ee78 100644 --- a/opm/autodiff/BlackoilModelBase_impl.hpp +++ b/opm/autodiff/BlackoilModelBase_impl.hpp @@ -2330,32 +2330,28 @@ namespace detail { auto nc_and_pv_containers = std::make_tuple(v, geo_.poreVolume()); info.computeReduction(nc_and_pv_containers, nc_and_pv_operators, nc_and_pv); - for ( int idx=0; idx(0.0 ,0.0 ,0.0); - auto containers = std::make_tuple(B.col(idx), - tempV.col(idx), - R.col(idx)); - auto operators = std::make_tuple(Opm::Reduction::makeGlobalSumFunctor(), - Opm::Reduction::makeGlobalMaxFunctor(), - Opm::Reduction::makeGlobalSumFunctor()); - info.computeReduction(containers, operators, values); - B_avg[idx] = std::get<0>(values)/std::get<0>(nc_and_pv); - maxCoeff[idx] = std::get<1>(values); - R_sum[idx] = std::get<2>(values); + auto values = std::tuple(0.0 ,0.0 ,0.0); + auto containers = std::make_tuple(B.col(idx), + tempV.col(idx), + R.col(idx)); + auto operators = std::make_tuple(Opm::Reduction::makeGlobalSumFunctor(), + Opm::Reduction::makeGlobalMaxFunctor(), + Opm::Reduction::makeGlobalSumFunctor()); + info.computeReduction(containers, operators, values); + B_avg[idx] = std::get<0>(values)/std::get<0>(nc_and_pv); + maxCoeff[idx] = std::get<1>(values); + R_sum[idx] = std::get<2>(values); + assert(nm >= np); + if (idx < np) { maxNormWell[idx] = 0.0; - for ( int w=0; w(nc_and_pv); } @@ -2405,8 +2401,6 @@ namespace detail { const V pv = geo_.poreVolume(); - const std::vector cond = phaseCondition(); - std::vector R_sum(nm); std::vector B_avg(nm); std::vector maxCoeff(nm);