From 6c0a3ea5aa71d7603ebca95b818d139081d08b51 Mon Sep 17 00:00:00 2001 From: Jonathan Youett <youett@math.fu-berlin.de> Date: Mon, 28 Aug 2017 15:31:28 +0200 Subject: [PATCH] Use new construction of MCMGMapper using a lambda instead of template --- dune/fufem/differencenormsquared.hh | 4 ++-- dune/fufem/estimators/fractionalmarking.hh | 4 ++-- dune/fufem/functionspacebases/p0basis.hh | 4 ++-- dune/fufem/functionspacebases/p2nodalbasis.hh | 23 ++++--------------- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/dune/fufem/differencenormsquared.hh b/dune/fufem/differencenormsquared.hh index 89e90189..8853020c 100644 --- a/dune/fufem/differencenormsquared.hh +++ b/dune/fufem/differencenormsquared.hh @@ -132,8 +132,8 @@ public: // Find the corresponding coarse grid element on the adaptive grid. // This is a linear algorithm, but we expect the coarse grid to be small. // //////////////////////////////////////////////////////////////////// - LevelMultipleCodimMultipleGeomTypeMapper<GridType,Dune::MCMGElementLayout> uniformP0Mapper (targetGrid, 0); - LevelMultipleCodimMultipleGeomTypeMapper<GridType,Dune::MCMGElementLayout> adaptiveP0Mapper(sourceGrid, 0); + LevelMultipleCodimMultipleGeomTypeMapper<GridType> uniformP0Mapper (targetGrid, 0, Dune::mcmgElementLayout()); + LevelMultipleCodimMultipleGeomTypeMapper<GridType> adaptiveP0Mapper(sourceGrid, 0, Dune::mcmgElementLayout()); const auto coarseIndex = uniformP0Mapper.index(element); typename GridType::LevelGridView sourceLevelView = sourceGrid.levelGridView(0); diff --git a/dune/fufem/estimators/fractionalmarking.hh b/dune/fufem/estimators/fractionalmarking.hh index 99cac762..c01cb299 100644 --- a/dune/fufem/estimators/fractionalmarking.hh +++ b/dune/fufem/estimators/fractionalmarking.hh @@ -109,7 +109,7 @@ mark(const std::vector<std::shared_ptr<RefinementIndicator<GridType> > >& refine minGridError[i] = std::numeric_limits<field_type>::max(); maxGridError[i] = -std::numeric_limits<field_type>::max(); - Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType,P0Layout> p0Mapper(*grids[i]); + Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType> p0Mapper(*grids[i], Dune::mcmgElementLayout()); const auto& leafView = grids[i]->leafGridView(); @@ -169,7 +169,7 @@ mark(const std::vector<std::shared_ptr<RefinementIndicator<GridType> > >& refine for (size_t i=0; i<grids.size(); i++) { - Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType,P0Layout> p0Mapper(*grids[i]); + Dune::LeafMultipleCodimMultipleGeomTypeMapper<GridType> p0Mapper(*grids[i], Dune::mcmgElementLayout()); for (const auto& e : elements(grids[i]->leafGridView())) if (refinedElements[i][p0Mapper.index(e)][0]) diff --git a/dune/fufem/functionspacebases/p0basis.hh b/dune/fufem/functionspacebases/p0basis.hh index 86f48dcd..f32129a5 100644 --- a/dune/fufem/functionspacebases/p0basis.hh +++ b/dune/fufem/functionspacebases/p0basis.hh @@ -46,7 +46,7 @@ class P0Basis : using Base::dim; using Base::gridview_; - typedef typename Dune::MultipleCodimMultipleGeomTypeMapper<GV, Dune::MCMGElementLayout > P0BasisMapper; + typedef typename Dune::MultipleCodimMultipleGeomTypeMapper<GV> P0BasisMapper; public: typedef typename Base::GridView GridView; @@ -56,7 +56,7 @@ class P0Basis : P0Basis(const GridView& gridview) : Base(gridview), - mapper_(gridview) + mapper_(gridview, Dune::mcmgElementLayout()) {} size_t size() const diff --git a/dune/fufem/functionspacebases/p2nodalbasis.hh b/dune/fufem/functionspacebases/p2nodalbasis.hh index 1fa51f2f..266685a6 100644 --- a/dune/fufem/functionspacebases/p2nodalbasis.hh +++ b/dune/fufem/functionspacebases/p2nodalbasis.hh @@ -25,32 +25,19 @@ #include <dune/fufem/functionspacebases/functionspacebasis.hh> - -template<int dim> -struct P2MapperLayout -{ - bool contains (Dune::GeometryType gt) const - { - // All vertices and all edges carry a dof - if (gt.dim()==0 || gt.dim()==1) - return true; - - // Quadrilaterals and cubes carry a dof - return gt.isCube(); - } -}; - template<class GridView> class P2BasisMapper : - public Dune::MultipleCodimMultipleGeomTypeMapper<GridView, P2MapperLayout> + public Dune::MultipleCodimMultipleGeomTypeMapper<GridView> { - typedef typename Dune::MultipleCodimMultipleGeomTypeMapper<GridView, P2MapperLayout> Base; + typedef typename Dune::MultipleCodimMultipleGeomTypeMapper<GridView> Base; typedef typename GridView::Grid::template Codim<0>::Entity Element; public: P2BasisMapper(const GridView& gridView) : - Base(gridView) + Base(gridView, + // all vertices, edges, and quadrilaterals/cubes carry a dof + [](Dune::GeometryType gt, int dimgrid) {return gt.dim()==0 or gt.dim()==1 or gt.isCube();}) {} typename Base::Index index(const Element& e, const Dune::LocalKey& localKey) const -- GitLab