From 42a2d22d898683028f506616ef1a585ff3b70358 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 19 Mar 2020 10:03:44 +0100 Subject: [PATCH] avoid potentially uninitialized warnings in serial this was actually broken by an upstream change from return-by-reference to return-by-value, but we were lucky, the return value was kept in memory until end of block it seems. --- ebos/ecltransmissibility.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ebos/ecltransmissibility.hh b/ebos/ecltransmissibility.hh index 9ebaff7e8..b6e6e3e19 100644 --- a/ebos/ecltransmissibility.hh +++ b/ebos/ecltransmissibility.hh @@ -161,13 +161,15 @@ public: // compute the axis specific "centroids" used for the transmissibilities. for // consistency with the flow simulator, we use the element centers as // computed by opm-parser's Opm::EclipseGrid class for all axes. - const double* centroid; + std::array centroid; if (vanguard_.gridView().comm().rank() == 0) { const auto& eclGrid = eclState.getInputGrid(); unsigned cartesianCellIdx = cartMapper.cartesianIndex(elemIdx); - centroid = &eclGrid.getCellCenter(cartesianCellIdx)[0]; + centroid = eclGrid.getCellCenter(cartesianCellIdx); } else - centroid = ¢roids[centroidIdx * dimWorld]; + std::copy(centroids.begin() + centroidIdx * dimWorld, + centroids.begin() + (centroidIdx + 1) * dimWorld, + centroid.begin()); for (unsigned axisIdx = 0; axisIdx < dimWorld; ++axisIdx) for (unsigned dimIdx = 0; dimIdx < dimWorld; ++dimIdx)