dune-fem 2.8.0
Loading...
Searching...
No Matches
indexsetdofmapper.hh
Go to the documentation of this file.
1#ifndef DUNE_FEM_DOFMAPPER_INDEXSETDOFMAPPER_HH
2#define DUNE_FEM_DOFMAPPER_INDEXSETDOFMAPPER_HH
3
4#include <cassert>
5
6#include <type_traits>
7#include <utility>
8
9#include <dune/geometry/referenceelements.hh>
10#include <dune/geometry/type.hh>
11#include <dune/geometry/typeindex.hh>
12
20
21namespace Dune
22{
23
24 namespace Fem
25 {
26
27 // DefaultLocalDofMapping
28 // ----------------------
29
30 template< class GridPart >
32 {
33 struct Mapping
34 {
35 template< class Iterator, class Functor >
36 void operator() ( std::size_t index, unsigned int numDofs, Iterator begin, Iterator end, Functor functor ) const
37 {
38 while( begin != end )
39 functor( *(begin++), index++ );
40 }
41 };
42
43 public:
45 DefaultLocalDofMapping ( const GridPart & ) {}
46
47 Mapping operator() ( const typename GridPart::template Codim< 0 >::EntityType &element, unsigned int subEntity, unsigned int codim ) const { return {}; }
48 };
49
50
51
52 namespace __IndexSetDofMapper
53 {
54
55 // DofMapperBase
56 // -------------
57
58 template< class GridPart, class LocalDofMapping >
60 {
62
63 public:
64 typedef std::size_t SizeType;
65
66 protected:
68 {
70 : numDofs( 0 )
71 {}
72
73 unsigned int codim;
74 unsigned int numDofs;
76 };
77
79 static const int dimension = GridPart::dimension;
80 typedef Dune::ReferenceElements< typename GridPart::ctype, dimension > RefElementsType;
81 typedef typename RefElementsType::ReferenceElement RefElementType;
82
83 struct BuildFunctor;
84
86 {
87 SubEntityFilter(const RefElementType &refElement, int subEntity, int codim)
88 : active_(dimension+1), size_(0)
89 {
90 for (int c=0;c<=dimension;++c)
91 {
92 std::vector<bool> &a = active_[c];
93 a.resize( refElement.size( c ), false );
94 if (c<codim) continue;
95 if (c==codim) { a[subEntity]=true; ++size_; continue; }
96 for (int i=0;i<refElement.size(subEntity, codim, c);++i)
97 {
98 a[refElement.subEntity(subEntity, codim, i, c)] = true;
99 ++size_;
100 }
101 }
102 }
103 bool operator()(int i,int c) const { return active_[c][i]; }
104 private:
105 std::vector< std::vector< bool > > active_;
106 int size_;
107 };
108
109 template< class Functor >
111
112 public:
114
115 typedef GridPart GridPartType;
116 typedef LocalDofMapping LocalDofMappingType;
117 typedef typename GridPart::GridType GridType;
118
119 typedef typename GridPartType::template Codim< 0 >::EntityType ElementType;
120
121 template< class CodeFactory >
122 DofMapperBase ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory );
123
124 // mapping for DoFs
145 template< class Functor >
146 void mapEach ( const ElementType &element, Functor f ) const;
147
148 void map ( const ElementType &element, std::vector< GlobalKeyType > &indices ) const;
149
158 void onSubEntity( const ElementType &element, int i, int c, std::vector< bool > &indices ) const;
159
160 unsigned int maxNumDofs () const { return maxNumDofs_; }
161 unsigned int numDofs ( const ElementType &element ) const { return code( element ).numDofs(); }
162
163 // assignment of DoFs to entities
164 template< class Entity, class Functor >
165 void mapEachEntityDof ( const Entity &entity, Functor f ) const;
166
167 template< class Entity >
168 void mapEntityDofs ( const Entity &entity, std::vector< GlobalKeyType > &indices ) const;
169
170 template< class Entity >
171 unsigned int numEntityDofs ( const Entity &entity ) const;
172
173 // global information
174
175 bool contains ( int codim ) const { return (codimType_[ codim ] != CodimEmpty); }
176
177 bool fixedDataSize ( int codim ) const { return (codimType_[ codim ] == CodimFixedSize); }
178
179 SizeType size () const { return size_; }
180
182 void update ();
183
184 /* \name AdaptiveDofMapper interface methods
185 * \{
186 */
187
188 /* Compatibility methods; users expect an AdaptiveDiscreteFunction to
189 * compile over spaces built on top of a LeafGridPart or LevelGridPart.
190 *
191 * The AdaptiveDiscreteFunction requires the block mapper (i.e. this
192 * type) to be adaptive. The CodimensionMapper however is truly
193 * adaptive if and only if the underlying index set is adaptive. We
194 * don't want to wrap the index set as 1) it hides the actual problem
195 * (don't use the AdaptiveDiscreteFunction with non-adaptive index
196 * sets), and 2) other dune-fem classes may make correct use of the
197 * index set's capabilities.
198 */
199
200 static constexpr bool consecutive () noexcept { return false; }
201
203 {
204 DUNE_THROW( NotImplemented, "Method numBlocks() called on non-adaptive block mapper" );
205 }
206
208 {
209 DUNE_THROW( NotImplemented, "Method numberOfHoles() called on non-adaptive block mapper" );
210 }
211
212 GlobalKeyType oldIndex ( int hole, int ) const
213 {
214 DUNE_THROW( NotImplemented, "Method oldIndex() called on non-adaptive block mapper" );
215 }
216
217 GlobalKeyType newIndex ( int hole, int ) const
218 {
219 DUNE_THROW( NotImplemented, "Method newIndex() called on non-adaptive block mapper" );
220 }
221
222 SizeType oldOffSet ( int ) const
223 {
224 DUNE_THROW( NotImplemented, "Method oldOffSet() called on non-adaptive block mapper" );
225 }
226
227 SizeType offSet ( int ) const
228 {
229 DUNE_THROW( NotImplemented, "Method offSet() called on non-adaptive block mapper" );
230 }
231
232 template< class Entity >
233 void insertEntity ( const Entity &entity )
234 {
235 DUNE_THROW( NotImplemented, "Method insertEntity(entity) called on non-adaptive block mapper" );
236 }
237 template< class Entity >
238 void removeEntity ( const Entity &entity )
239 {
240 DUNE_THROW( NotImplemented, "Method removeEntity(entity) called on non-adaptive block mapper" );
241 }
242
243 void resize () { update(); }
244 bool compress () { update(); return true;}
245 void backup () const {}
246 void restore () {}
247 template <class StreamTraits>
249 template <class StreamTraits>
251
252 /* \} */
253
254 protected:
256 void requestCodimensions ();
257
258 typedef typename GridPartType::IndexSetType IndexSetType;
259 typedef std::vector< GeometryType > BlockMapType;
260
261 const DofMapperCode &code ( const GeometryType &gt ) const;
262 const DofMapperCode &code ( const ElementType &element ) const { return code( element.type() ); }
263
264 template< class Entity >
265 const SubEntityInfo &subEntityInfo ( const Entity &entity ) const;
266
267 const IndexSetType &indexSet () const { return indexSet_; }
268
270 LocalDofMapping localDofMapping_;
271 std::vector< DofMapperCode > code_;
272 unsigned int maxNumDofs_;
274 std::vector< SubEntityInfo > subEntityInfo_;
277 };
278
279
280
281 // DofMapper::BuildFunctor
282 // -----------------------
283
284 template< class GridPart, class LocalDofMapping >
285 struct DofMapperBase< GridPart, LocalDofMapping >::BuildFunctor
286 {
287 explicit BuildFunctor ( std::vector< SubEntityInfo > &subEntityInfo )
289 {}
290
291 template< class Iterator >
292 void operator() ( unsigned int gtIndex, unsigned int subEntity, Iterator it, Iterator end )
293 {
294 SubEntityInfo &info = subEntityInfo_[ gtIndex ];
295 const unsigned int numDofs = end - it;
296 if( info.numDofs == 0 )
297 info.numDofs = numDofs;
298 else if( info.numDofs != numDofs )
299 DUNE_THROW( DofMapperError, "Inconsistent number of DoFs on subEntity (codim = " << info.codim << ")." );
300 }
301
302 private:
303 std::vector< SubEntityInfo > &subEntityInfo_;
304 };
305
306
307
308
309 // Implementation of DofMapper
310 // ---------------------------
311
312 template< class GridPart, class LocalDofMapping >
314
315 template< class GridPart, class LocalDofMapping >
316 template< class CodeFactory >
318 ::DofMapperBase ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
319 // NOTE: Don't store gridPart in this class since the lifetime of gridPart
320 // might be shorter than the lifetime of this class. The lifetime of
321 // indexSet is guaranteed to be longer, so storage of that class is fine
322 : indexSet_( gridPart.indexSet() ),
323 localDofMapping_( std::move( localDofMapping ) ),
324 code_( LocalGeometryTypeIndex::size( dimension ) ),
325 maxNumDofs_( 0 ),
326 subEntityInfo_( GlobalGeometryTypeIndex::size( dimension ) )
327 {
328 std::vector< GeometryType > gt( GlobalGeometryTypeIndex::size( dimension ) );
329
330 const typename RefElementsType::Iterator end = RefElementsType::end();
331 for( typename RefElementsType::Iterator it = RefElementsType::begin(); it != end; ++it )
332 {
333 const RefElementType refElement = *it;
334
335 for( int codim = 0; codim <= dimension; ++codim )
336 {
337 for( int i = 0; i < refElement.size( codim ); ++i )
338 {
339 const unsigned int gtIdx = GlobalGeometryTypeIndex::index( refElement.type( i, codim ) );
340 gt[ gtIdx ] = refElement.type( i, codim );
341 subEntityInfo_[ gtIdx ].codim = codim;
342 }
343 }
344
345 DofMapperCode &code = code_[ LocalGeometryTypeIndex::index( refElement.type() ) ];
346 code = codeFactory( refElement );
349 }
350
351 for( int codim = 0; codim <= dimension; ++codim )
352 codimType_[ codim ] = CodimEmpty;
353
354 unsigned int codimDofs[ dimension+1 ];
355 for( unsigned int i = 0; i < subEntityInfo_.size(); ++i )
356 {
357 const SubEntityInfo &info = subEntityInfo_[ i ];
358 if( info.numDofs == 0 )
359 {
360 continue;
361 }
362
363 // see commit message f86ab6e96a27fdecfa82de43fe9099f01e240e1b
364 // Note: hasSingleGeometryType does not exist on all IndexSets
365 static const bool hasSingleGeometryType = Dune::Capabilities::hasSingleGeometryType< typename GridPartType::GridType > :: v ;
366 const auto & geomTypes = indexSet().types(info.codim);
367
368 if (hasSingleGeometryType && geomTypes[0] != gt[i])
369 {
370 continue;
371 }
372
373 if( codimType_[ info.codim ] == CodimEmpty )
374 codimType_[ info.codim ] = CodimFixedSize;
375 else if( codimDofs[ info.codim ] != info.numDofs )
377
378 codimDofs[ info.codim ] = info.numDofs;
379 blockMap_.push_back( gt[ i ] );
380 }
381
382 // submit request for codimensions to index set
384
385 // update offsets
386 update();
387 }
388
389
390 template< class GridPart, class LocalDofMapping >
391 template< class Functor >
393 ::mapEach ( const ElementType &element, Functor f ) const
394 {
395 const auto &idxSet = indexSet();
396
397 code( element )( [ this, &idxSet, &element, f ] ( unsigned int gtIndex, unsigned int subEntity, auto begin, auto end ) {
398 const SubEntityInfo &info = subEntityInfo_[ gtIndex ];
399 const SizeType subIndex = idxSet.subIndex( element, subEntity, info.codim );
400 SizeType index = info.offset + SizeType( info.numDofs ) * subIndex;
401 localDofMapping_( element, subEntity, info.codim )( index, info.numDofs, begin, end, f );
402 } );
403 }
404
405
406 template< class GridPart, class LocalDofMapping >
408 ::map ( const ElementType &element, std::vector< SizeType > &indices ) const
409 {
410 indices.resize( numDofs( element ) );
411 mapEach( element, AssignFunctor< std::vector< SizeType > >( indices ) );
412 }
413
414 template< class GridPart, class LocalDofMapping >
415 template< class Entity, class Functor >
417 ::mapEachEntityDof ( const Entity &entity, Functor f ) const
418 {
419 const SubEntityInfo &info = subEntityInfo( entity );
420 const unsigned int numDofs = info.numDofs;
421 SizeType index = info.offset + numDofs * SizeType( indexSet().index( entity ) );
422 for( unsigned int i = 0; i < info.numDofs; ++i )
423 f( i, index++ );
424 }
425
426
427 template< class GridPart, class LocalDofMapping >
428 template< class Entity >
430 ::mapEntityDofs ( const Entity &entity, std::vector< SizeType > &indices ) const
431 {
432 indices.resize( numEntityDofs( entity ) );
433 mapEachEntityDof( entity, AssignFunctor< std::vector< SizeType > >( indices ) );
434 }
435
436 template< class GridPart, class LocalDofMapping >
438 ::onSubEntity( const ElementType &element, int i, int c, std::vector< bool > &indices ) const
439 {
440 const SubEntityFilter filter( RefElementsType::general( element.type() ), i, c );
441 indices.resize( numDofs( element ) );
442 code( element )( [ this, &indices, &filter ] ( unsigned int gtIndex, unsigned int subEntity, auto begin, auto end ) {
443 const bool active = filter( subEntity, subEntityInfo_[ gtIndex ].codim );
444 while( begin != end )
445 indices[ *(begin++) ] = active;
446 } );
447 }
448
449 template< class GridPart, class LocalDofMapping >
450 template< class Entity >
451 inline unsigned int
453 ::numEntityDofs ( const Entity &entity ) const
454 {
455 return subEntityInfo( entity ).numDofs;
456 }
457
458
459 template< class GridPart, class LocalDofMapping >
461 {
462 // collect all available codimensions
463 std::vector< int > codimensions;
464 codimensions.reserve( dimension+1 );
465
466 for( typename BlockMapType::const_iterator it = blockMap_.begin(); it != blockMap_.end(); ++it )
467 {
468 SubEntityInfo &info = subEntityInfo_[ GlobalGeometryTypeIndex::index( *it ) ];
469 codimensions.push_back( info.codim );
470 }
471
472 // submit request for codimension to indexSet
473 indexSet().requestCodimensions( codimensions );
474 }
475
476 template< class GridPart, class LocalDofMapping >
478 {
479 size_ = 0;
480 for( const auto& geomType : blockMap_ )
481 {
482 SubEntityInfo &info = subEntityInfo_[ GlobalGeometryTypeIndex::index( geomType ) ];
483 info.oldOffset = info.offset;
484 info.offset = size_;
485 size_ += SizeType( info.numDofs ) * SizeType( indexSet().size( geomType ) );
486 }
487 }
488
489
490 template< class GridPart, class LocalDofMapping >
492 ::code ( const GeometryType &gt ) const
493 {
494 return code_[ LocalGeometryTypeIndex::index( gt ) ];
495 }
496
497
498 template< class GridPart, class LocalDofMapping >
499 template< class Entity >
502 {
503 return subEntityInfo_[ GlobalGeometryTypeIndex::index( entity.type() ) ];
504 }
505
506
507
508 // DofMapper
509 // ---------
510
511 template< class GridPart, class LocalDofMapping >
513 : public DofMapperBase< GridPart, LocalDofMapping >
514 {
517
518 protected:
522
523 public:
526 typedef typename BaseType::SizeType SizeType;
527
528 template< class CodeFactory >
529 DofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
530 : BaseType( gridPart, std::move( localDofMapping ), codeFactory ),
531 dofManager_( DofManagerType::instance( gridPart.grid() ) )
532 {
533 dofManager_.addIndexSet( *this );
534 }
535
536 DofMapper ( const ThisType & ) = delete;
537
539 {
541 }
542
543 ThisType &operator= ( const ThisType & ) = delete;
544
545 protected:
547 };
548
549
550 // AdaptiveDofMapper
551 // -----------------
552
553 template< class GridPart, class LocalDofMapping >
555 : public DofMapperBase< GridPart, LocalDofMapping >
556 {
559
560 protected:
564
565 public:
568 typedef typename BaseType::SizeType SizeType;
569
570 template< class CodeFactory >
571 AdaptiveDofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
572 : BaseType( gridPart, std::move( localDofMapping ), codeFactory ),
573 dofManager_( DofManagerType::instance( gridPart.grid() ) )
574 {
575 dofManager_.addIndexSet( *this );
576 }
577
578 AdaptiveDofMapper ( const ThisType & ) = delete;
579
581 {
583 }
584
585 ThisType &operator= ( const ThisType & ) = delete;
586
587 // Adaptive DoF mappers are always up to date, so this method does nothing.
588 // update is done several times during insertEntity
589 void update () {}
590
591 // adaptation interface
592
593 int numBlocks () const { return blockMap_.size(); }
594 SizeType offSet ( int blk ) const;
595 SizeType oldOffSet ( int blk ) const;
596
597 SizeType numberOfHoles ( int blk ) const;
598
599 SizeType oldIndex ( SizeType hole, int blk ) const;
600 SizeType newIndex ( SizeType hole, int blk ) const;
601
602 // adaptation methods (as for index sets)
603
604 bool consecutive () const { return true; }
605
606 template< class Entity >
607 void insertEntity ( const Entity &entity ) { BaseType::update(); }
608
609 template< class Entity >
610 void removeEntity ( const Entity &entity ) {}
611
613
614 bool compress () { BaseType::update(); return true; }
615
616 template <class StreamTraits>
618
619 template <class StreamTraits>
621 {
623 }
624
625 void backup () const {}
626 void restore () {}
627
628 protected:
629 using BaseType::indexSet;
630
633
635 };
636
637
638
639 // Implementation of AdaptiveDofMapper
640 // -----------------------------------
641
642 template< class GridPart, class LocalDofMapping >
645 {
646 assert( (blk >= 0) && (blk < numBlocks()) );
647 const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
648 return subEntityInfo_[ gtIdx ].offset;
649 }
650
651
652 template< class GridPart, class LocalDofMapping >
655 {
656 assert( (blk >= 0) && (blk < numBlocks()) );
657 const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
658 return subEntityInfo_[ gtIdx ].oldOffset;
659 }
660
661
662 template< class GridPart, class LocalDofMapping >
665 {
666 assert( (blk >= 0) && (blk < numBlocks()) );
667 const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
668 const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
669 return SizeType( info.numDofs ) * SizeType( indexSet().numberOfHoles( blockMap_[ blk ] ) );
670 }
671
672
673 template< class GridPart, class LocalDofMapping >
676 {
677 assert( (hole >= 0) && (hole < numberOfHoles( blk )) );
678 const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
679 const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
680 const unsigned int numDofs = info.numDofs;
681 const SizeType index = indexSet().oldIndex( hole / numDofs, blockMap_[ blk ] );
682 return info.offset + numDofs * index + (hole % numDofs);
683 }
684
685
686 template< class GridPart, class LocalDofMapping >
689 {
690 assert( (hole >= 0) && (hole < numberOfHoles( blk )) );
691 const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
692 const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
693 const unsigned int numDofs = info.numDofs;
694 const SizeType index = indexSet().newIndex( hole / numDofs, blockMap_[ blk ] );
695 return info.offset + numDofs * index + (hole % numDofs);
696 }
697
698
699
700 // Implementation
701 // --------------
702
703 template< class GridPart, class LocalDofMapping, bool adaptive = Capabilities::isAdaptiveIndexSet< typename GridPart::IndexSetType >::v >
705 {
706 typedef typename std::conditional< adaptive, AdaptiveDofMapper< GridPart, LocalDofMapping >, DofMapper< GridPart, LocalDofMapping > >::type Type;
707 };
708
709 } // namespace __IndexSetDofMapper
710
711
712
713 // IndexSetDofMapper
714 // -----------------
715
716 template< class GridPart, class LocalDofMapping = DefaultLocalDofMapping< GridPart > >
718 : public __IndexSetDofMapper::template Implementation< GridPart, LocalDofMapping >::Type
719 {
720 typedef typename __IndexSetDofMapper::template Implementation< GridPart, LocalDofMapping >::Type BaseType;
721
722 public:
723 typedef typename BaseType::GridPartType GridPartType;
724 typedef typename BaseType::LocalDofMappingType LocalDofMappingType;
725
726 template< class CodeFactory >
727 IndexSetDofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
728 : BaseType( gridPart, std::move( localDofMapping ), codeFactory )
729 {}
730
731 template< class CodeFactory >
732 IndexSetDofMapper ( const GridPartType &gridPart, const CodeFactory &codeFactory )
733 : BaseType( gridPart, LocalDofMappingType( gridPart ), codeFactory )
734 {}
735 };
736
737
738 // Capabilities
739 // ------------
740
741 namespace Capabilities
742 {
743 // isAdaptiveDofMapper
744 // -------------------
745
746 template< class GridPart, class LocalDofMapping >
747 struct isAdaptiveDofMapper< IndexSetDofMapper< GridPart, LocalDofMapping > >
748 {
750 };
751
752
753 // isConsecutiveIndexSet
754 // ---------------------
755
756 template< class GridPart, class LocalDofMapping >
757 struct isConsecutiveIndexSet< __IndexSetDofMapper::AdaptiveDofMapper< GridPart, LocalDofMapping > >
758 {
759 static const bool v = true;
760 };
761
762 } // namespace Capabilities
763
764 } // namespace Fem
765
766} // namespace Dune
767
768#endif //#ifndef DUNE_FEM_DOFMAPPER_INDEXSETDOFMAPPER_HH
void removeIndexSet(const IndexSetType &iset)
removed index set from dof manager's list of index sets
Definition: dofmanager.hh:1291
void addIndexSet(const IndexSetType &iset)
add index set to dof manager's list of index sets
Definition: dofmanager.hh:1256
STL namespace.
double max(const Dune::Fem::Double &v, const double p)
Definition: double.hh:965
Definition: bindguard.hh:11
specialize with true if index set implements the interface for consecutive index sets
Definition: common/indexset.hh:42
static const bool v
Definition: common/indexset.hh:49
specialize with true if index set implements the interface for adaptive index sets
Definition: common/indexset.hh:64
abstract interface for an output stream
Definition: streams.hh:46
abstract interface for an input stream
Definition: streams.hh:179
Definition: grcommon.hh:31
Definition: misc/functor.hh:31
Definition: dofmanager.hh:761
Definition: space/mapper/capabilities.hh:22
static const bool v
Definition: space/mapper/capabilities.hh:23
Definition: code.hh:18
unsigned int numDofs() const
Definition: code.hh:92
Extended interface for adaptive DoF mappers.
Definition: mapper/dofmapper.hh:219
Definition: space/mapper/exceptions.hh:14
Definition: indexsetdofmapper.hh:32
DefaultLocalDofMapping()
Definition: indexsetdofmapper.hh:44
Mapping operator()(const typename GridPart::template Codim< 0 >::EntityType &element, unsigned int subEntity, unsigned int codim) const
Definition: indexsetdofmapper.hh:47
DefaultLocalDofMapping(const GridPart &)
Definition: indexsetdofmapper.hh:45
Definition: indexsetdofmapper.hh:60
void map(const ElementType &element, std::vector< GlobalKeyType > &indices) const
Definition: indexsetdofmapper.hh:408
void removeEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:238
static constexpr bool consecutive() noexcept
Definition: indexsetdofmapper.hh:200
void read(InStreamInterface< StreamTraits > &in)
Definition: indexsetdofmapper.hh:250
void mapEach(const ElementType &element, Functor f) const
map each local DoF number to a global one
Definition: indexsetdofmapper.hh:393
const DofMapperCode & code(const GeometryType &gt) const
Definition: indexsetdofmapper.hh:492
SizeType size_
Definition: indexsetdofmapper.hh:273
BlockMapType blockMap_
Definition: indexsetdofmapper.hh:275
unsigned int maxNumDofs_
Definition: indexsetdofmapper.hh:272
void mapEachEntityDof(const Entity &entity, Functor f) const
Definition: indexsetdofmapper.hh:417
void requestCodimensions()
submit request for codimensions used to index set
Definition: indexsetdofmapper.hh:460
GridPart GridPartType
Definition: indexsetdofmapper.hh:115
SizeType GlobalKeyType
Definition: indexsetdofmapper.hh:113
bool contains(int codim) const
Definition: indexsetdofmapper.hh:175
GridPartType::template Codim< 0 >::EntityType ElementType
Definition: indexsetdofmapper.hh:119
const IndexSetType & indexSet() const
Definition: indexsetdofmapper.hh:267
std::vector< SubEntityInfo > subEntityInfo_
Definition: indexsetdofmapper.hh:274
void backup() const
Definition: indexsetdofmapper.hh:245
GridPartType::IndexSetType IndexSetType
Definition: indexsetdofmapper.hh:258
CodimType codimType_[dimension+1]
Definition: indexsetdofmapper.hh:276
GlobalKeyType oldIndex(int hole, int) const
Definition: indexsetdofmapper.hh:212
SizeType offSet(int) const
Definition: indexsetdofmapper.hh:227
std::vector< GeometryType > BlockMapType
Definition: indexsetdofmapper.hh:259
LocalDofMapping LocalDofMappingType
Definition: indexsetdofmapper.hh:116
void restore()
Definition: indexsetdofmapper.hh:246
std::vector< DofMapperCode > code_
Definition: indexsetdofmapper.hh:271
SizeType size() const
Definition: indexsetdofmapper.hh:179
unsigned int numDofs(const ElementType &element) const
Definition: indexsetdofmapper.hh:161
unsigned int maxNumDofs() const
Definition: indexsetdofmapper.hh:160
GridPart::GridType GridType
Definition: indexsetdofmapper.hh:117
CodimType
Definition: indexsetdofmapper.hh:78
@ CodimVariableSize
Definition: indexsetdofmapper.hh:78
@ CodimFixedSize
Definition: indexsetdofmapper.hh:78
@ CodimEmpty
Definition: indexsetdofmapper.hh:78
GlobalKeyType newIndex(int hole, int) const
Definition: indexsetdofmapper.hh:217
void resize()
Definition: indexsetdofmapper.hh:243
SizeType numBlocks() const
Definition: indexsetdofmapper.hh:202
void onSubEntity(const ElementType &element, int i, int c, std::vector< bool > &indices) const
fills a vector of bools with true indicating that the corresponding local degree of freedom is attach...
Definition: indexsetdofmapper.hh:438
SizeType oldOffSet(int) const
Definition: indexsetdofmapper.hh:222
bool fixedDataSize(int codim) const
Definition: indexsetdofmapper.hh:177
const DofMapperCode & code(const ElementType &element) const
Definition: indexsetdofmapper.hh:262
void mapEntityDofs(const Entity &entity, std::vector< GlobalKeyType > &indices) const
Definition: indexsetdofmapper.hh:430
SizeType numberOfHoles(int) const
Definition: indexsetdofmapper.hh:207
Dune::ReferenceElements< typename GridPart::ctype, dimension > RefElementsType
Definition: indexsetdofmapper.hh:80
void insertEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:233
RefElementsType::ReferenceElement RefElementType
Definition: indexsetdofmapper.hh:81
LocalDofMapping localDofMapping_
Definition: indexsetdofmapper.hh:270
const IndexSetType & indexSet_
Definition: indexsetdofmapper.hh:269
unsigned int numEntityDofs(const Entity &entity) const
Definition: indexsetdofmapper.hh:453
void write(OutStreamInterface< StreamTraits > &out) const
Definition: indexsetdofmapper.hh:248
void update()
update mapper offsets
Definition: indexsetdofmapper.hh:477
static const int dimension
Definition: indexsetdofmapper.hh:79
bool compress()
Definition: indexsetdofmapper.hh:244
const SubEntityInfo & subEntityInfo(const Entity &entity) const
Definition: indexsetdofmapper.hh:501
std::size_t SizeType
Definition: indexsetdofmapper.hh:64
SubEntityInfo()
Definition: indexsetdofmapper.hh:69
SizeType offset
Definition: indexsetdofmapper.hh:75
SizeType oldOffset
Definition: indexsetdofmapper.hh:75
unsigned int codim
Definition: indexsetdofmapper.hh:73
unsigned int numDofs
Definition: indexsetdofmapper.hh:74
SubEntityFilter(const RefElementType &refElement, int subEntity, int codim)
Definition: indexsetdofmapper.hh:87
bool operator()(int i, int c) const
Definition: indexsetdofmapper.hh:103
BuildFunctor(std::vector< SubEntityInfo > &subEntityInfo)
Definition: indexsetdofmapper.hh:287
Definition: indexsetdofmapper.hh:514
BaseType::GridPartType::GridType GridType
Definition: indexsetdofmapper.hh:520
BaseType::SubEntityInfo SubEntityInfo
Definition: indexsetdofmapper.hh:519
BaseType::SizeType SizeType
Definition: indexsetdofmapper.hh:526
~DofMapper()
Definition: indexsetdofmapper.hh:538
DofManagerType & dofManager_
Definition: indexsetdofmapper.hh:546
DofMapper(const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:529
ThisType & operator=(const ThisType &)=delete
BaseType::LocalDofMappingType LocalDofMappingType
Definition: indexsetdofmapper.hh:525
DofManager< GridType > DofManagerType
Definition: indexsetdofmapper.hh:521
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:524
Definition: indexsetdofmapper.hh:556
bool compress()
Definition: indexsetdofmapper.hh:614
void update()
Definition: indexsetdofmapper.hh:589
int numBlocks() const
Definition: indexsetdofmapper.hh:593
void read(InStreamInterface< StreamTraits > &in)
Definition: indexsetdofmapper.hh:620
DofManager< GridType > DofManagerType
Definition: indexsetdofmapper.hh:563
BlockMapType blockMap_
Definition: indexsetdofmapper.hh:275
void write(OutStreamInterface< StreamTraits > &out) const
Definition: indexsetdofmapper.hh:617
BaseType::LocalDofMappingType LocalDofMappingType
Definition: indexsetdofmapper.hh:567
BaseType::SubEntityInfo SubEntityInfo
Definition: indexsetdofmapper.hh:561
bool consecutive() const
Definition: indexsetdofmapper.hh:604
SizeType newIndex(SizeType hole, int blk) const
Definition: indexsetdofmapper.hh:688
void insertEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:607
void backup() const
Definition: indexsetdofmapper.hh:625
SizeType oldIndex(SizeType hole, int blk) const
Definition: indexsetdofmapper.hh:675
BaseType::GridPartType::GridType GridType
Definition: indexsetdofmapper.hh:562
void resize()
Definition: indexsetdofmapper.hh:612
AdaptiveDofMapper(const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:571
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:566
BaseType::SizeType SizeType
Definition: indexsetdofmapper.hh:568
~AdaptiveDofMapper()
Definition: indexsetdofmapper.hh:580
ThisType & operator=(const ThisType &)=delete
SizeType offSet(int blk) const
Definition: indexsetdofmapper.hh:644
SizeType numberOfHoles(int blk) const
Definition: indexsetdofmapper.hh:664
void restore()
Definition: indexsetdofmapper.hh:626
DofManagerType & dofManager_
Definition: indexsetdofmapper.hh:634
SizeType oldOffSet(int blk) const
Definition: indexsetdofmapper.hh:654
void removeEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:610
Definition: indexsetdofmapper.hh:705
std::conditional< adaptive, AdaptiveDofMapper< GridPart, LocalDofMapping >, DofMapper< GridPart, LocalDofMapping > >::type Type
Definition: indexsetdofmapper.hh:706
Definition: indexsetdofmapper.hh:719
IndexSetDofMapper(const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:727
IndexSetDofMapper(const GridPartType &gridPart, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:732
BaseType::LocalDofMappingType LocalDofMappingType
Definition: indexsetdofmapper.hh:724
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:723