diff --git a/dumux/discretization/basegridgeometry.hh b/dumux/discretization/basegridgeometry.hh index 73821a6a8775bc220b0dd832bc5f631323efc9fd..48fe392a9e92a9ce8949080ab439641c16c60189 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_() {