From 6e8123d1930c99e807b62b32569bbaf1b3d3c3e4 Mon Sep 17 00:00:00 2001
From: Kilian Weishaupt <kilian.weishaupt@iws.uni-stuttgart.de>
Date: Tue, 28 Jul 2020 15:17:35 +0200
Subject: [PATCH] [basegridgeometry] Allow use of
 SingleCodimSingleGeomTypeMapper

---
 dumux/discretization/basegridgeometry.hh | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/dumux/discretization/basegridgeometry.hh b/dumux/discretization/basegridgeometry.hh
index 73821a6a87..48fe392a9e 100644
--- a/dumux/discretization/basegridgeometry.hh
+++ b/dumux/discretization/basegridgeometry.hh
@@ -76,8 +76,8 @@ public:
      */
     BaseGridGeometry(const GridView& gridView)
     : gridView_(gridView)
-    , elementMapper_(gridView, Dune::mcmgElementLayout())
-    , vertexMapper_(gridView, Dune::mcmgVertexLayout())
+    , elementMapper_(makeElementMapper_(gridView))
+    , vertexMapper_(makeVertexMapper_(gridView))
     , bBoxMin_(std::numeric_limits<double>::max())
     , bBoxMax_(-std::numeric_limits<double>::max())
     {
@@ -191,6 +191,24 @@ public:
 
 private:
 
+    //! Return an instance of the element mapper
+    ElementMapper makeElementMapper_(const GridView& gridView) const
+    {
+        if constexpr (std::is_same_v<ElementMapper, Dune::MultipleCodimMultipleGeomTypeMapper<GridView>>)
+            return ElementMapper(gridView, Dune::mcmgElementLayout());
+        else
+            return ElementMapper(gridView);
+    }
+
+    //! Return an instance of the vertex mapper
+    VertexMapper makeVertexMapper_(const GridView& gridView) const
+    {
+        if constexpr (std::is_same_v<VertexMapper, Dune::MultipleCodimMultipleGeomTypeMapper<GridView>>)
+            return VertexMapper(gridView, Dune::mcmgVertexLayout());
+        else
+            return VertexMapper(gridView);
+    }
+
     //! Compute the bouding box of the entire domain, for e.g. setting boundary conditions
     void computeGlobalBoundingBox_()
     {
-- 
GitLab