From 23dec80d76641c7c89cd5f55320c7a930f1fb00b Mon Sep 17 00:00:00 2001
From: Lisa Julia Nebel <lisa_julia.nebel@tu-dresden.de>
Date: Mon, 24 Apr 2023 08:50:11 +0200
Subject: [PATCH] Add gmsh4 as a requirement in dune.module

This only works for gmsh-files with version 4 or 5, but this is what we want
---
 CHANGELOG.md              |  1 +
 dune.module               |  2 +-
 src/cosserat-continuum.cc | 12 ++++++------
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 861e472b..5537eb4b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,6 @@
 # Master
 
+- Added dune-gmsh4 as a dependency
 - Build cosserat-continuum for different combinations of LFE-orders and
   GFE-orders, the respective program is called
   cosserat-continuum-Xd-in-Xd-LFE_ORDER-GFE_ORDER
diff --git a/dune.module b/dune.module
index 6a17dcaf..669495ee 100644
--- a/dune.module
+++ b/dune.module
@@ -7,5 +7,5 @@ Module: dune-gfe
 Version: svn
 Maintainer: oliver.sander@tu-dresden.de
 #depending on
-Depends: dune-common(>=2.7) dune-grid(>=2.7) dune-uggrid dune-istl dune-localfunctions dune-geometry (>=2.7) dune-functions (>=2.7) dune-solvers dune-fufem dune-elasticity (>=2.7)
+Depends: dune-common(>=2.7) dune-grid(>=2.7) dune-uggrid dune-istl dune-localfunctions dune-geometry (>=2.7) dune-functions (>=2.7) dune-solvers dune-fufem dune-elasticity (>=2.7) dune-gmsh4
 Suggests: dune-foamgrid dune-parmg dune-vtk dune-curvedgrid
diff --git a/src/cosserat-continuum.cc b/src/cosserat-continuum.cc
index d23443bb..43ac8c7b 100644
--- a/src/cosserat-continuum.cc
+++ b/src/cosserat-continuum.cc
@@ -38,8 +38,6 @@
 #include <dune/grid/uggrid.hh>
 #include <dune/grid/utility/structuredgridfactory.hh>
 
-#include <dune/grid/io/file/gmshreader.hh>
-
 #if HAVE_DUNE_FOAMGRID
 #include <dune/foamgrid/foamgrid.hh>
 #endif
@@ -190,9 +188,11 @@ int main (int argc, char *argv[]) try
           DUNE_THROW(IOError, "Could not determine grid input file format");
         std::string suffix = gridFile.substr(dotPos, gridFile.length()-dotPos);
 
-        if (suffix == ".msh")
-            grid = std::shared_ptr<GridType>(GmshReader<GridType>::read(path + "/" + gridFile));
-        else if (suffix == ".vtu" or suffix == ".vtp")
+        if (suffix == ".msh") {
+            Gmsh4Reader reader{creator};
+            reader.read(path + "/" + gridFile);
+            grid = factory.createGrid();
+        } else if (suffix == ".vtu" or suffix == ".vtp")
 #if HAVE_DUNE_VTK
             grid = VtkReader<GridType>::createGridFromFile(path + "/" + gridFile);
 #else
@@ -346,7 +346,7 @@ int main (int argc, char *argv[]) try
         std::string path                       = parameterSet.get<std::string>("path");
         std::string initialIterateGridFilename = parameterSet.get<std::string>("initialIterateGridFilename");
 
-        initialIterateGrid = std::shared_ptr<GridType>(GmshReader<GridType>::read(path + "/" + initialIterateGridFilename));
+        initialIterateGrid = std::shared_ptr<GridType>(Gmsh4Reader<GridType>::createGridFromFile(path + "/" + initialIterateGridFilename));
       }
 
       std::vector<TargetSpace> initialIterate;
-- 
GitLab