From 30e87532886a9d91a0be22b4bd0cd2192d8544ee Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Wed, 22 Mar 2017 11:51:52 +0100 Subject: [PATCH] Use Interior_Partition when iterating over grid instead of if(..) continue. Makes the code a bit cleaner. --- opm/autodiff/BlackoilModelEbos.hpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/opm/autodiff/BlackoilModelEbos.hpp b/opm/autodiff/BlackoilModelEbos.hpp index 39888096d..f00cd6b27 100644 --- a/opm/autodiff/BlackoilModelEbos.hpp +++ b/opm/autodiff/BlackoilModelEbos.hpp @@ -1049,17 +1049,13 @@ namespace Opm { } ElementContext elemCtx(ebosSimulator_); - const auto& elemEndIt = gridView.template end(); - for (auto elemIt = gridView.template begin(); + const auto& elemEndIt = gridView.template end(); + for (auto elemIt = gridView.template begin(); elemIt != elemEndIt; ++elemIt) { const auto& elem = *elemIt; - if (elem.partitionType() != Dune::InteriorEntity) { - continue; - } - - elemCtx.updatePrimaryStencil(elem); + elemCtx.updatePrimaryStencil(*elem); elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0); const unsigned cellIdx = elemCtx.globalSpaceIndex(/*spaceIdx=*/0, /*timeIdx=*/0); @@ -1114,14 +1110,11 @@ namespace Opm { comm.sum(tpv.data(), tpv.size()); comm.sum(hcpv.data(), hcpv.size()); - for (auto elemIt = gridView.template begin(); + for (auto elemIt = gridView.template begin(); elemIt != elemEndIt; ++elemIt) { const auto& elem = *elemIt; - if (elem.partitionType() != Dune::InteriorEntity) { - continue; - } elemCtx.updatePrimaryStencil(elem); elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0); @@ -1256,15 +1249,12 @@ namespace Opm { std::vector failed_cells_pb; std::vector failed_cells_pd; const auto& gridView = ebosSimulator().gridView(); - auto elemIt = gridView.template begin(); - const auto& elemEndIt = gridView.template end(); + auto elemIt = gridView.template begin(); + const auto& elemEndIt = gridView.template end(); ElementContext elemCtx(ebosSimulator()); for (; elemIt != elemEndIt; ++elemIt) { const auto& elem = *elemIt; - if (elem.partitionType() != Dune::InteriorEntity) { - continue; - } elemCtx.updatePrimaryStencil(elem); elemCtx.updatePrimaryIntensiveQuantities(/*timeIdx=*/0);