Commit 78b57faf authored by Timo Koch's avatar Timo Koch
Browse files

Merge branch 'fix/gmshreader-alu' into 'master'

Fix makeGridFromFile for ALUGrid

Closes #729

See merge request !1709
parents 55e2ac09 a35bc7c4
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#ifndef DUMUX_IO_GRID_MANAGER_ALU_HH #ifndef DUMUX_IO_GRID_MANAGER_ALU_HH
#define DUMUX_IO_GRID_MANAGER_ALU_HH #define DUMUX_IO_GRID_MANAGER_ALU_HH
#include <dune/common/version.hh>
// ALUGrid specific includes // ALUGrid specific includes
#if HAVE_DUNE_ALUGRID #if HAVE_DUNE_ALUGRID
#include <dune/alugrid/grid.hh> #include <dune/alugrid/grid.hh>
...@@ -158,8 +160,12 @@ public: ...@@ -158,8 +160,12 @@ public:
{ {
std::vector<int> boundaryMarkersInsertionIndex, boundaryMarkers, faceMarkers, elementMarkers; std::vector<int> boundaryMarkersInsertionIndex, boundaryMarkers, faceMarkers, elementMarkers;
auto gridFactory = std::make_unique<Dune::GridFactory<Grid>>(); 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) 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()); ParentType::gridPtr() = std::shared_ptr<Grid>(gridFactory->createGrid());
...@@ -186,8 +192,12 @@ public: ...@@ -186,8 +192,12 @@ public:
else else
{ {
auto gridFactory = std::make_unique<Dune::GridFactory<Grid>>(); 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) 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()); ParentType::gridPtr() = std::shared_ptr<Grid>(gridFactory->createGrid());
} }
......
Supports Markdown
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