diff --git a/dumux/io/grid/gridmanager_alu.hh b/dumux/io/grid/gridmanager_alu.hh index 7de720c81f4a2fc6db8cf3282efbc1c895dfb625..621cd8d4c207cf8587e07deffde0a1949e909909 100644 --- a/dumux/io/grid/gridmanager_alu.hh +++ b/dumux/io/grid/gridmanager_alu.hh @@ -24,6 +24,8 @@ #ifndef DUMUX_IO_GRID_MANAGER_ALU_HH #define DUMUX_IO_GRID_MANAGER_ALU_HH +#include <dune/common/version.hh> + // ALUGrid specific includes #if HAVE_DUNE_ALUGRID #include <dune/alugrid/grid.hh> @@ -158,8 +160,12 @@ public: { std::vector<int> boundaryMarkersInsertionIndex, boundaryMarkers, faceMarkers, elementMarkers; auto gridFactory = std::make_unique<Dune::GridFactory<Grid>>(); + +// Older versions of Dune(-Alugrid) require that the Gmsh file is read only on process 0 +#if DUNE_VERSION_LT(DUNE_GRID, 2, 7) if (Dune::MPIHelper::getCollectiveCommunication().rank() == 0) - Dune::GmshReader<Grid>::read(*gridFactory, fileName, boundaryMarkersInsertionIndex, elementMarkers, verbose, boundarySegments); +#endif + Dune::GmshReader<Grid>::read(*gridFactory, fileName, boundaryMarkersInsertionIndex, elementMarkers, verbose, boundarySegments); ParentType::gridPtr() = std::shared_ptr<Grid>(gridFactory->createGrid()); @@ -186,8 +192,12 @@ public: else { auto gridFactory = std::make_unique<Dune::GridFactory<Grid>>(); + +// Older versions of Dune(-Alugrid) require that the Gmsh file is read only on process 0 +#if DUNE_VERSION_LT(DUNE_GRID, 2, 7) if (Dune::MPIHelper::getCollectiveCommunication().rank() == 0) - Dune::GmshReader<Grid>::read(*gridFactory, fileName, verbose, boundarySegments); +#endif + Dune::GmshReader<Grid>::read(*gridFactory, fileName, verbose, boundarySegments); ParentType::gridPtr() = std::shared_ptr<Grid>(gridFactory->createGrid()); }