1#ifndef DUNE_FEM_SPACE_MAPPER_CODIMENSIONMAPPER_HH
2#define DUNE_FEM_SPACE_MAPPER_CODIMENSIONMAPPER_HH
28 template<
class Gr
idPart,
int codim >
29 class CodimensionMapper;
35 namespace __CodimensionMapper
41 template<
class Gr
idPart,
int codim >
44 typedef CodimensionMapper< GridPart, codim > DofMapperType;
46 static const int codimension = codim;
48 typedef GridPart GridPartType;
49 typedef typename GridPartType::IndexSetType IndexSetType;
51 typedef typename GridPartType::template Codim< 0 >::EntityType
ElementType;
54 typedef SizeType GlobalKeyType;
66 typedef Base< T > BaseType;
69 typedef typename BaseType::Traits Traits;
71 static const int codimension = Traits::codimension;
73 typedef typename Traits::GridPartType GridPartType;
74 typedef typename Traits::IndexSetType IndexSetType;
77 typedef typename BaseType::SizeType SizeType;
78 typedef typename Traits::GlobalKeyType GlobalKeyType;
80 explicit DofMapper (
const GridPartType &gridPart )
84 explicit DofMapper (
const IndexSetType &indexSet )
89 AllGeomTypes< IndexSetType, typename GridPartType::GridType > types( indexSet );
90 for( GeometryType type : types.geomTypes( 0 ) )
93 if constexpr ( Capabilities::isDuneFemIndexSet< IndexSetType >:: v )
97 indexSet_.requestCodimensions( codimensions );
105 SizeType
size ()
const
110 static constexpr bool contains (
int codim )
noexcept
112 return codim == codimension;
115 static constexpr bool fixedDataSize (
int codim )
noexcept
120 template<
class Function >
121 void mapEach (
const ElementType &element, Function function )
const
123 if( codimension == 0 )
127 const SizeType numDofs = this->numDofs( element );
128 for( SizeType i = 0; i < numDofs; ++i )
129 function( i,
indexSet().subIndex( element, i, codimension ) );
135 indices.
resize( numDofs( element ) );
139 template<
class Entity >
142 indices.
resize( numEntityDofs( entity ) );
146 template<
class Entity,
class Function >
147 void mapEachEntityDof (
const Entity &entity, Function function )
const
149 assert( Entity::codimension == codimension );
153 int maxNumDofs ()
const {
return maxNumDofs_; }
155 SizeType numDofs (
const ElementType &element )
const
157 return element.subEntities( codimension );
160 template<
class Entity >
161 static constexpr SizeType numEntityDofs (
const Entity &entity )
noexcept
163 return contains( Entity::codimension ) ? 1 : 0;
168 void extendSize(
const SizeType extension )
170 extension_ = extension;
173 [[deprecated(
"Use onSubEntity method with char vector instead")]]
174 void onSubEntity (
const ElementType &element,
int i,
int c,
std::vector< bool > &indices )
const
177 onSubEntity(element, i, c, _idx);
180 _idx[i] = indices[i] > 0;
182 void onSubEntity (
const ElementType &element,
int i,
int c,
std::vector< char > &indices )
const
184 indices.
resize( numDofs(element) );
207 static constexpr bool consecutive () noexcept {
return false; }
209 SizeType numBlocks ()
const
211 DUNE_THROW( NotImplemented,
"Method numBlocks() called on non-adaptive block mapper" );
214 SizeType numberOfHoles (
int )
const
216 DUNE_THROW( NotImplemented,
"Method numberOfHoles() called on non-adaptive block mapper" );
219 GlobalKeyType oldIndex (
int hole,
int )
const
221 DUNE_THROW( NotImplemented,
"Method oldIndex() called on non-adaptive block mapper" );
224 GlobalKeyType newIndex (
int hole,
int )
const
226 DUNE_THROW( NotImplemented,
"Method newIndex() called on non-adaptive block mapper" );
229 SizeType oldOffSet (
int )
const
231 DUNE_THROW( NotImplemented,
"Method oldOffSet() called on non-adaptive block mapper" );
234 SizeType offSet (
int )
const
236 DUNE_THROW( NotImplemented,
"Method offSet() called on non-adaptive block mapper" );
242 const IndexSetType &
indexSet ()
const {
return indexSet_; }
246 ->
decltype( ReferenceElements< typename GridPartType::ctype, GridPartType::dimension >::general( type ) )
248 return ReferenceElements< typename GridPartType::ctype, GridPartType::dimension >::general( type );
251 const IndexSetType &indexSet_;
261 template<
class Traits >
262 class AdaptiveDofMapper
263 :
public DofMapper< Traits, Dune::Fem::AdaptiveDofMapper >
265 typedef DofMapper< Traits, Dune::Fem::AdaptiveDofMapper > BaseType;
268 static const int codimension = BaseType::codimension;
270 typedef typename BaseType::SizeType SizeType;
271 typedef typename BaseType::GlobalKeyType GlobalKeyType;
274 using BaseType::indexSet;
277 explicit AdaptiveDofMapper (
const typename BaseType::GridPartType &gridPart )
278 : BaseType( gridPart )
281 explicit AdaptiveDofMapper (
const typename BaseType::IndexSetType &indexSet )
285 static constexpr bool consecutive () noexcept {
return true; }
287 static constexpr SizeType numBlocks () noexcept
292 SizeType numberOfHoles (
int )
const
294 return indexSet().numberOfHoles( codimension );
297 GlobalKeyType oldIndex (
int hole,
int )
const
299 return indexSet().oldIndex( hole, codimension );
302 GlobalKeyType newIndex (
int hole,
int )
const
304 return indexSet().newIndex( hole, codimension );
307 static constexpr SizeType oldOffSet (
int )
noexcept
312 static constexpr SizeType offSet (
int )
noexcept
323 template<
class GridPart,
int codim,
324 bool adaptive = Capabilities::isAdaptiveIndexSet< typename GridPart::IndexSetType >::v >
327 typedef __CodimensionMapper::Traits< GridPart, codim > Traits;
331 AdaptiveDofMapper< Traits >,
354 template<
class Gr
idPart,
int codim >
356 :
public __CodimensionMapper::template Implementation< GridPart, codim >::Type
358 typedef typename __CodimensionMapper::template Implementation< GridPart, codim >::Type BaseType;
362 : BaseType( gridPart )
366 : BaseType( *indexSet )
370 : BaseType( indexSet )
378 namespace Capabilities
383 template<
class Gr
idPart,
int codim >
393 template<
class Gr
idPart,
int codim >
396 static const bool v =
true;
Hierarchy< Domain, A >::Iterator update
unspecified value type referenceElement(T &&... t)
static bool contains(const Type &attribute)
std::ptrdiff_t index() const
#define DUNE_THROW(E,...)
const GlobalIndex & global() const
const IndexSet & indexSet() const
GridImp::template Codim< cd >::Entity Entity
auto size(GeometryType type) const
specialize with true if index set implements the interface for consecutive index sets
Definition common/indexset.hh:61
static const bool v
Definition common/indexset.hh:68
specialize with true if index set implements the interface for adaptive index sets
Definition common/indexset.hh:83
Definition space/mapper/capabilities.hh:22
static const bool v
Definition space/mapper/capabilities.hh:23
mapper allocating one DoF per subentity of a given codimension
Definition codimensionmapper.hh:357
CodimensionMapper(const typename BaseType::IndexSetType &indexSet)
Definition codimensionmapper.hh:369
CodimensionMapper(const typename BaseType::IndexSetType *indexSet)
Definition codimensionmapper.hh:365
CodimensionMapper(const typename BaseType::GridPartType &gridPart)
Definition codimensionmapper.hh:361
Interface for calculating the size of a function space for a grid on a specified level....
Definition mapper/dofmapper.hh:43
Extended interface for adaptive DoF mappers.
Definition mapper/dofmapper.hh:219