Remove lookUpCellCentroid for rank zero

This commit is contained in:
Antonella Ritorto
2023-08-29 10:12:48 +02:00
parent 5d9f8a88b4
commit 1c2069cb6a

View File

@@ -478,17 +478,19 @@ protected:
std::function<std::array<double,dimensionworld>(int)> std::function<std::array<double,dimensionworld>(int)>
cellCentroids_(const CartMapper& cartMapper) const cellCentroids_(const CartMapper& cartMapper) const
{ {
auto rank = this->gridView().comm().rank(); return [this, cartMapper](int elemIdx) {
if (rank == 0) std::array<double,dimensionworld> centroid;
{ if (this->gridView().comm().rank() == 0)
LookUpCellCentroid<Grid,GridView> lookUpCellCentroid(this->gridView(), cartMapper, &(this ->eclState().getInputGrid())); {
return lookUpCellCentroid; centroid = this->eclState().getInputGrid().getCellCenter(cartMapper.cartesianIndex(elemIdx));
} }
else else
{ {
LookUpCellCentroid<Grid,GridView> lookUpCellCentroid(this->gridView(), cartMapper, nullptr); LookUpCellCentroid<Grid,GridView> lookUpCellCentroid(this->gridView(), cartMapper, nullptr);
return lookUpCellCentroid; centroid = lookUpCellCentroid(elemIdx);
} }
return centroid;
};
} }
void callImplementationInit() void callImplementationInit()