Commit a35bc7c4 authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

[io][grid] fix makeGridFromFile for Dune(-Alugrid) > 2.6

Call GmshReader on every process. Keep the old behavior for Dune < 2.7.
parent b4a2a64c
......@@ -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());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment