Skip to content
Snippets Groups Projects
Commit 6c0a3ea5 authored by Jonathan Youett's avatar Jonathan Youett
Browse files

Use new construction of MCMGMapper using a lambda instead of template

parent 2959fc42
Branches
Tags
No related merge requests found
...@@ -132,8 +132,8 @@ public: ...@@ -132,8 +132,8 @@ public:
// Find the corresponding coarse grid element on the adaptive grid. // Find the corresponding coarse grid element on the adaptive grid.
// This is a linear algorithm, but we expect the coarse grid to be small. // This is a linear algorithm, but we expect the coarse grid to be small.
// //////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////
LevelMultipleCodimMultipleGeomTypeMapper<GridType,Dune::MCMGElementLayout> uniformP0Mapper (targetGrid, 0); LevelMultipleCodimMultipleGeomTypeMapper<GridType> uniformP0Mapper (targetGrid, 0, Dune::mcmgElementLayout());
LevelMultipleCodimMultipleGeomTypeMapper<GridType,Dune::MCMGElementLayout> adaptiveP0Mapper(sourceGrid, 0); LevelMultipleCodimMultipleGeomTypeMapper<GridType> adaptiveP0Mapper(sourceGrid, 0, Dune::mcmgElementLayout());
const auto coarseIndex = uniformP0Mapper.index(element); const auto coarseIndex = uniformP0Mapper.index(element);
typename GridType::LevelGridView sourceLevelView = sourceGrid.levelGridView(0); typename GridType::LevelGridView sourceLevelView = sourceGrid.levelGridView(0);
......
...@@ -109,7 +109,7 @@ mark(const std::vector<std::shared_ptr<RefinementIndicator<GridType> > >& refine ...@@ -109,7 +109,7 @@ mark(const std::vector<std::shared_ptr<RefinementIndicator<GridType> > >& refine
minGridError[i] = std::numeric_limits<field_type>::max(); minGridError[i] = std::numeric_limits<field_type>::max();
maxGridError[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(); const auto& leafView = grids[i]->leafGridView();
...@@ -169,7 +169,7 @@ mark(const std::vector<std::shared_ptr<RefinementIndicator<GridType> > >& refine ...@@ -169,7 +169,7 @@ mark(const std::vector<std::shared_ptr<RefinementIndicator<GridType> > >& refine
for (size_t i=0; i<grids.size(); i++) { 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())) for (const auto& e : elements(grids[i]->leafGridView()))
if (refinedElements[i][p0Mapper.index(e)][0]) if (refinedElements[i][p0Mapper.index(e)][0])
......
...@@ -46,7 +46,7 @@ class P0Basis : ...@@ -46,7 +46,7 @@ class P0Basis :
using Base::dim; using Base::dim;
using Base::gridview_; using Base::gridview_;
typedef typename Dune::MultipleCodimMultipleGeomTypeMapper<GV, Dune::MCMGElementLayout > P0BasisMapper; typedef typename Dune::MultipleCodimMultipleGeomTypeMapper<GV> P0BasisMapper;
public: public:
typedef typename Base::GridView GridView; typedef typename Base::GridView GridView;
...@@ -56,7 +56,7 @@ class P0Basis : ...@@ -56,7 +56,7 @@ class P0Basis :
P0Basis(const GridView& gridview) : P0Basis(const GridView& gridview) :
Base(gridview), Base(gridview),
mapper_(gridview) mapper_(gridview, Dune::mcmgElementLayout())
{} {}
size_t size() const size_t size() const
......
...@@ -25,32 +25,19 @@ ...@@ -25,32 +25,19 @@
#include <dune/fufem/functionspacebases/functionspacebasis.hh> #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> template<class GridView>
class P2BasisMapper : 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; typedef typename GridView::Grid::template Codim<0>::Entity Element;
public: public:
P2BasisMapper(const GridView& gridView) : 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 typename Base::Index index(const Element& e, const Dune::LocalKey& localKey) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment