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