diff --git a/dune/gdt/mapper/default/productfv.hh b/dune/gdt/mapper/default/productfv.hh index 85ff525305f7949ba964f17f4c9b656cfd0bc4db..3d3503ed54430daec274e2ee23e600e72cbb643b 100644 --- a/dune/gdt/mapper/default/productfv.hh +++ b/dune/gdt/mapper/default/productfv.hh @@ -31,10 +31,11 @@ namespace internal { template <class GridViewImp, size_t rangeDim, size_t rangeDimCols> -class ProductFiniteVolumeTraits : internal::FiniteVolumeTraits<GridViewImp, rangeDim, rangeDimCols> +class ProductFiniteVolumeTraits : public internal::FiniteVolumeTraits<GridViewImp, rangeDim, rangeDimCols> { public: typedef ProductFiniteVolume<GridViewImp, rangeDim, rangeDimCols> derived_type; + static const size_t dimRange = rangeDim; }; @@ -43,26 +44,24 @@ public: template <class GridViewImp, size_t rangeDim> class ProductFiniteVolume<GridViewImp, rangeDim, 1> - : public ProductMapperInterface<internal::ProductFiniteVolumeTraits<GridViewImp, rangeDim, 1>>, - public FiniteVolume<GridViewImp, rangeDim, 1> + : public ProductMapperInterface<internal::ProductFiniteVolumeTraits<GridViewImp, rangeDim, 1>> { - typedef ProductMapperInterface<internal::ProductFiniteVolumeTraits<GridViewImp, rangeDim, 1>> InterfaceType; - typedef FiniteVolume<GridViewImp, rangeDim, 1> BaseType; - using BaseType::dimRange; + typedef ProductMapperInterface<internal::ProductFiniteVolumeTraits<GridViewImp, rangeDim, 1>> BaseType; + typedef FiniteVolume<GridViewImp, rangeDim, 1> FiniteVolumeMapperType; public: typedef internal::ProductFiniteVolumeTraits<GridViewImp, rangeDim, 1> Traits; - using typename BaseType::GridViewType; + typedef typename Traits::GridViewType GridViewType; + static const size_t dimRange = Traits::dimRange; using typename BaseType::EntityType; + using typename BaseType::BackendType; ProductFiniteVolume(const GridViewType& grid_view) - : BaseType(grid_view) + : fv_mapper_(grid_view) { } - using BaseType::numDofs; - using BaseType::globalIndices; - + // These methods are required by the ProductMapperInterface Dune::DynamicVector<size_t> globalIndices(const size_t factor_index, const EntityType& entity) const { Dune::DynamicVector<size_t> ret(numDofs(entity), 0); @@ -75,11 +74,44 @@ public: { assert(localIndex == 0); assert(factor_index < numDofs(entity)); - return (dimRange * (backend_.index(entity))) + factor_index; + return (dimRange * (backend().index(entity))) + factor_index; + } + + // The remaining methods are just redirected to the usual finite volume mapper + const BackendType& backend() const + { + return fv_mapper_.backend(); + } + + size_t size() const + { + return fv_mapper_.size(); + } + + size_t numDofs(const EntityType& entity) const + { + return fv_mapper_.numDofs(entity); + } + + size_t maxNumDofs() const + { + return fv_mapper_.maxNumDofs(); + } + + void globalIndices(const EntityType& entity, Dune::DynamicVector<size_t>& ret) const + { + return fv_mapper_.globalIndices(entity, ret); + } // ... globalIndices(...) + + using BaseType::globalIndices; + + size_t mapToGlobal(const EntityType& entity, const size_t& localIndex) const + { + return fv_mapper_.mapToGlobal(entity, localIndex); } private: - using BaseType::backend_; + const FiniteVolumeMapperType fv_mapper_; }; // class ProductFiniteVolume< ..., rangeDim, 1 > diff --git a/dune/gdt/mapper/interface.hh b/dune/gdt/mapper/interface.hh index fe20ff9d2081ce9620778b14f0bcc7de36952529..b4b3af48ce690d16e65c78f7d787342d2ecab596 100644 --- a/dune/gdt/mapper/interface.hh +++ b/dune/gdt/mapper/interface.hh @@ -82,6 +82,8 @@ class ProductMapperInterface : public MapperInterface<Traits>, IsProductMapper public: using typename BaseType::EntityType; + using BaseType::globalIndices; + void globalIndices(const size_t factor_index, const EntityType& entity, Dune::DynamicVector<size_t>& ret) const { CHECK_AND_CALL_CRTP(this->as_imp(*this).globalIndices(factor_index, entity, ret));