dune-fem  2.8-git
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 
15 #include <dune/fem/misc/functor.hh>
20 
21 namespace 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  // DofMapper
56  // ---------
57 
58  template< class GridPart, class LocalDofMapping >
59  class DofMapper
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 >
110  struct MapFunctor;
111 
112  public:
114 
115  typedef GridPart GridPartType;
116  typedef LocalDofMapping LocalDofMappingType;
117 
118  typedef typename GridPartType::template Codim< 0 >::EntityType ElementType;
119 
120  template< class CodeFactory >
121  DofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory );
122 
123  // mapping for DoFs
144  template< class Functor >
145  void mapEach ( const ElementType &element, Functor f ) const;
146 
147  void map ( const ElementType &element, std::vector< GlobalKeyType > &indices ) const;
148 
157  void onSubEntity( const ElementType &element, int i, int c, std::vector< bool > &indices ) const;
158 
159  unsigned int maxNumDofs () const { return maxNumDofs_; }
160  unsigned int numDofs ( const ElementType &element ) const { return code( element ).numDofs(); }
161 
162  // assignment of DoFs to entities
163  template< class Entity, class Functor >
164  void mapEachEntityDof ( const Entity &entity, Functor f ) const;
165 
166  template< class Entity >
167  void mapEntityDofs ( const Entity &entity, std::vector< GlobalKeyType > &indices ) const;
168 
169  template< class Entity >
170  unsigned int numEntityDofs ( const Entity &entity ) const;
171 
172  // global information
173 
174  bool contains ( int codim ) const { return (codimType_[ codim ] != CodimEmpty); }
175 
176  bool fixedDataSize ( int codim ) const { return (codimType_[ codim ] == CodimFixedSize); }
177 
178  SizeType size () const { return size_; }
179 
181  void update ();
182 
183  /* \name AdaptiveDofMapper interface methods
184  * \{
185  */
186 
187  /* Compatibility methods; users expect an AdaptiveDiscreteFunction to
188  * compile over spaces built on top of a LeafGridPart or LevelGridPart.
189  *
190  * The AdaptiveDiscreteFunction requires the block mapper (i.e. this
191  * type) to be adaptive. The CodimensionMapper however is truly
192  * adaptive if and only if the underlying index set is adaptive. We
193  * don't want to wrap the index set as 1) it hides the actual problem
194  * (don't use the AdaptiveDiscreteFunction with non-adaptive index
195  * sets), and 2) other dune-fem classes may make correct use of the
196  * index set's capabilities.
197  */
198 
199  static constexpr bool consecutive () noexcept { return false; }
200 
202  {
203  DUNE_THROW( NotImplemented, "Method numBlocks() called on non-adaptive block mapper" );
204  }
205 
206  SizeType numberOfHoles ( int ) const
207  {
208  DUNE_THROW( NotImplemented, "Method numberOfHoles() called on non-adaptive block mapper" );
209  }
210 
211  GlobalKeyType oldIndex ( int hole, int ) const
212  {
213  DUNE_THROW( NotImplemented, "Method oldIndex() called on non-adaptive block mapper" );
214  }
215 
216  GlobalKeyType newIndex ( int hole, int ) const
217  {
218  DUNE_THROW( NotImplemented, "Method newIndex() called on non-adaptive block mapper" );
219  }
220 
221  SizeType oldOffSet ( int ) const
222  {
223  DUNE_THROW( NotImplemented, "Method oldOffSet() called on non-adaptive block mapper" );
224  }
225 
226  SizeType offSet ( int ) const
227  {
228  DUNE_THROW( NotImplemented, "Method offSet() called on non-adaptive block mapper" );
229  }
230 
231  /* \} */
232 
233  protected:
235  void requestCodimensions ();
236 
237  typedef typename GridPartType::IndexSetType IndexSetType;
238  typedef std::vector< GeometryType > BlockMapType;
239 
240  const DofMapperCode &code ( const GeometryType &gt ) const;
241  const DofMapperCode &code ( const ElementType &element ) const { return code( element.type() ); }
242 
243  template< class Entity >
244  const SubEntityInfo &subEntityInfo ( const Entity &entity ) const;
245 
246  const IndexSetType &indexSet () const { return indexSet_; }
247 
249  LocalDofMapping localDofMapping_;
250  std::vector< DofMapperCode > code_;
251  unsigned int maxNumDofs_;
253  std::vector< SubEntityInfo > subEntityInfo_;
256  };
257 
258 
259 
260  // DofMapper::BuildFunctor
261  // -----------------------
262 
263  template< class GridPart, class LocalDofMapping >
264  struct DofMapper< GridPart, LocalDofMapping >::BuildFunctor
265  {
266  explicit BuildFunctor ( std::vector< SubEntityInfo > &subEntityInfo )
268  {}
269 
270  template< class Iterator >
271  void operator() ( unsigned int gtIndex, unsigned int subEntity, Iterator it, Iterator end )
272  {
273  SubEntityInfo &info = subEntityInfo_[ gtIndex ];
274  const unsigned int numDofs = end - it;
275  if( info.numDofs == 0 )
276  info.numDofs = numDofs;
277  else if( info.numDofs != numDofs )
278  DUNE_THROW( DofMapperError, "Inconsistent number of DoFs on subEntity (codim = " << info.codim << ")." );
279  }
280 
281  private:
282  std::vector< SubEntityInfo > &subEntityInfo_;
283  };
284 
285 
286 
287 
288  // Implementation of DofMapper
289  // ---------------------------
290 
291  template< class GridPart, class LocalDofMapping >
293 
294  template< class GridPart, class LocalDofMapping >
295  template< class CodeFactory >
297  ::DofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
298  // NOTE: Don't store gridPart in this class since the lifetime of gridPart
299  // might be shorter than the lifetime of this class. The lifetime of
300  // indexSet is guaranteed to be longer, so storage of that class is fine
301  : indexSet_( gridPart.indexSet() ),
302  localDofMapping_( std::move( localDofMapping ) ),
303  code_( LocalGeometryTypeIndex::size( dimension ) ),
304  maxNumDofs_( 0 ),
305  subEntityInfo_( GlobalGeometryTypeIndex::size( dimension ) )
306  {
307  std::vector< GeometryType > gt( GlobalGeometryTypeIndex::size( dimension ) );
308 
309  const typename RefElementsType::Iterator end = RefElementsType::end();
310  for( typename RefElementsType::Iterator it = RefElementsType::begin(); it != end; ++it )
311  {
312  const RefElementType refElement = *it;
313 
314  for( int codim = 0; codim <= dimension; ++codim )
315  {
316  for( int i = 0; i < refElement.size( codim ); ++i )
317  {
318  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( refElement.type( i, codim ) );
319  gt[ gtIdx ] = refElement.type( i, codim );
320  subEntityInfo_[ gtIdx ].codim = codim;
321  }
322  }
323 
324  DofMapperCode &code = code_[ LocalGeometryTypeIndex::index( refElement.type() ) ];
325  code = codeFactory( refElement );
326  maxNumDofs_ = std::max( code.numDofs(), maxNumDofs_ );
327  code( BuildFunctor( subEntityInfo_ ) );
328  }
329 
330  for( int codim = 0; codim <= dimension; ++codim )
331  codimType_[ codim ] = CodimEmpty;
332 
333  unsigned int codimDofs[ dimension+1 ];
334  for( unsigned int i = 0; i < subEntityInfo_.size(); ++i )
335  {
336  const SubEntityInfo &info = subEntityInfo_[ i ];
337  if( info.numDofs == 0 )
338  {
339  continue;
340  }
341 
342  // see commit message f86ab6e96a27fdecfa82de43fe9099f01e240e1b
343  // Note: hasSingleGeometryType does not exist on all IndexSets
344  static const bool hasSingleGeometryType = Dune::Capabilities::hasSingleGeometryType< typename GridPartType::GridType > :: v ;
345  const auto & geomTypes = indexSet().types(info.codim);
346 
347  if (hasSingleGeometryType && geomTypes[0] != gt[i])
348  {
349  continue;
350  }
351 
352  if( codimType_[ info.codim ] == CodimEmpty )
353  codimType_[ info.codim ] = CodimFixedSize;
354  else if( codimDofs[ info.codim ] != info.numDofs )
355  codimType_[ info.codim ] = CodimVariableSize;
356 
357  codimDofs[ info.codim ] = info.numDofs;
358  blockMap_.push_back( gt[ i ] );
359  }
360 
361  // submit request for codimensions to index set
362  requestCodimensions ();
363 
364  // update offsets
365  update();
366  }
367 
368 
369  template< class GridPart, class LocalDofMapping >
370  template< class Functor >
372  ::mapEach ( const ElementType &element, Functor f ) const
373  {
374  const auto &idxSet = indexSet();
375 
376  code( element )( [ this, &idxSet, &element, f ] ( unsigned int gtIndex, unsigned int subEntity, auto begin, auto end ) {
377  const SubEntityInfo &info = subEntityInfo_[ gtIndex ];
378  const SizeType subIndex = idxSet.subIndex( element, subEntity, info.codim );
379  SizeType index = info.offset + SizeType( info.numDofs ) * subIndex;
380  localDofMapping_( element, subEntity, info.codim )( index, info.numDofs, begin, end, f );
381  } );
382  }
383 
384 
385  template< class GridPart, class LocalDofMapping >
387  ::map ( const ElementType &element, std::vector< SizeType > &indices ) const
388  {
389  indices.resize( numDofs( element ) );
390  mapEach( element, AssignFunctor< std::vector< SizeType > >( indices ) );
391  }
392 
393  template< class GridPart, class LocalDofMapping >
394  template< class Entity, class Functor >
396  ::mapEachEntityDof ( const Entity &entity, Functor f ) const
397  {
398  const SubEntityInfo &info = subEntityInfo( entity );
399  const unsigned int numDofs = info.numDofs;
400  SizeType index = info.offset + numDofs * SizeType( indexSet().index( entity ) );
401  for( unsigned int i = 0; i < info.numDofs; ++i )
402  f( i, index++ );
403  }
404 
405 
406  template< class GridPart, class LocalDofMapping >
407  template< class Entity >
409  ::mapEntityDofs ( const Entity &entity, std::vector< SizeType > &indices ) const
410  {
411  indices.resize( numEntityDofs( entity ) );
412  mapEachEntityDof( entity, AssignFunctor< std::vector< SizeType > >( indices ) );
413  }
414 
415  template< class GridPart, class LocalDofMapping >
417  ::onSubEntity( const ElementType &element, int i, int c, std::vector< bool > &indices ) const
418  {
419  const SubEntityFilter filter( RefElementsType::general( element.type() ), i, c );
420  indices.resize( numDofs( element ) );
421  code( element )( [ this, &indices, &filter ] ( unsigned int gtIndex, unsigned int subEntity, auto begin, auto end ) {
422  const bool active = filter( subEntity, subEntityInfo_[ gtIndex ].codim );
423  while( begin != end )
424  indices[ *(begin++) ] = active;
425  } );
426  }
427 
428  template< class GridPart, class LocalDofMapping >
429  template< class Entity >
430  inline unsigned int
432  ::numEntityDofs ( const Entity &entity ) const
433  {
434  return subEntityInfo( entity ).numDofs;
435  }
436 
437 
438  template< class GridPart, class LocalDofMapping >
440  {
441  // collect all available codimensions
442  std::vector< int > codimensions;
443  codimensions.reserve( dimension+1 );
444 
445  for( typename BlockMapType::const_iterator it = blockMap_.begin(); it != blockMap_.end(); ++it )
446  {
447  SubEntityInfo &info = subEntityInfo_[ GlobalGeometryTypeIndex::index( *it ) ];
448  codimensions.push_back( info.codim );
449  }
450 
451  // submit request for codimension to indexSet
452  indexSet().requestCodimensions( codimensions );
453  }
454 
455  template< class GridPart, class LocalDofMapping >
457  {
458  size_ = 0;
459  for( const auto& geomType : blockMap_ )
460  {
461  SubEntityInfo &info = subEntityInfo_[ GlobalGeometryTypeIndex::index( geomType ) ];
462  info.oldOffset = info.offset;
463  info.offset = size_;
464  size_ += SizeType( info.numDofs ) * SizeType( indexSet().size( geomType ) );
465  }
466  }
467 
468 
469  template< class GridPart, class LocalDofMapping >
471  ::code ( const GeometryType &gt ) const
472  {
473  return code_[ LocalGeometryTypeIndex::index( gt ) ];
474  }
475 
476 
477  template< class GridPart, class LocalDofMapping >
478  template< class Entity >
481  {
482  return subEntityInfo_[ GlobalGeometryTypeIndex::index( entity.type() ) ];
483  }
484 
485 
486 
487  // AdaptiveDofMapper
488  // -----------------
489 
490  template< class GridPart, class LocalDofMapping >
492  : public DofMapper< GridPart, LocalDofMapping >
493  {
496 
497  protected:
499  typedef typename BaseType::GridPartType::GridType GridType;
500 
501  public:
504  typedef typename BaseType::SizeType SizeType;
505 
506  template< class CodeFactory >
507  AdaptiveDofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
508  : BaseType( gridPart, std::move( localDofMapping ), codeFactory ),
509  // store grid (which is a unique object) for later removal of object
510  grid_( gridPart.grid() )
511  {
513  }
514 
515  AdaptiveDofMapper ( const ThisType & ) = delete;
516 
518  {
520  }
521 
522  ThisType &operator= ( const ThisType & ) = delete;
523 
524  // Adaptive DoF mappers are always up to date, so this method does nothing.
525  void update () {}
526 
527  // adaptation interface
528 
529  int numBlocks () const { return blockMap_.size(); }
530  SizeType offSet ( int blk ) const;
531  SizeType oldOffSet ( int blk ) const;
532 
533  SizeType numberOfHoles ( int blk ) const;
534 
535  SizeType oldIndex ( SizeType hole, int blk ) const;
536  SizeType newIndex ( SizeType hole, int blk ) const;
537 
538  // adaptation methods (as for index sets)
539 
540  bool consecutive () const { return true; }
541 
542  template< class Entity >
543  void insertEntity ( const Entity &entity ) { BaseType::update(); }
544 
545  template< class Entity >
546  void removeEntity ( const Entity &entity ) {}
547 
548  void resize () { BaseType::update(); }
549 
550  bool compress () { BaseType::update(); return true; }
551 
552  template <class StreamTraits>
554 
555  template <class StreamTraits>
557  {
559  }
560 
561  void backup () const {}
562  void restore () {}
563 
564  protected:
565  using BaseType::indexSet;
566 
567  using BaseType::blockMap_;
569 
570  const GridType& grid_;
571  };
572 
573 
574 
575  // Implementation of AdaptiveDofMapper
576  // -----------------------------------
577 
578  template< class GridPart, class LocalDofMapping >
581  {
582  assert( (blk >= 0) && (blk < numBlocks()) );
583  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
584  return subEntityInfo_[ gtIdx ].offset;
585  }
586 
587 
588  template< class GridPart, class LocalDofMapping >
591  {
592  assert( (blk >= 0) && (blk < numBlocks()) );
593  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
594  return subEntityInfo_[ gtIdx ].oldOffset;
595  }
596 
597 
598  template< class GridPart, class LocalDofMapping >
601  {
602  assert( (blk >= 0) && (blk < numBlocks()) );
603  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
604  const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
605  return SizeType( info.numDofs ) * SizeType( indexSet().numberOfHoles( blockMap_[ blk ] ) );
606  }
607 
608 
609  template< class GridPart, class LocalDofMapping >
612  {
613  assert( (hole >= 0) && (hole < numberOfHoles( blk )) );
614  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
615  const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
616  const unsigned int numDofs = info.numDofs;
617  const SizeType index = indexSet().oldIndex( hole / numDofs, blockMap_[ blk ] );
618  return info.offset + numDofs * index + (hole % numDofs);
619  }
620 
621 
622  template< class GridPart, class LocalDofMapping >
625  {
626  assert( (hole >= 0) && (hole < numberOfHoles( blk )) );
627  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
628  const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
629  const unsigned int numDofs = info.numDofs;
630  const SizeType index = indexSet().newIndex( hole / numDofs, blockMap_[ blk ] );
631  return info.offset + numDofs * index + (hole % numDofs);
632  }
633 
634 
635 
636  // Implementation
637  // --------------
638 
639  template< class GridPart, class LocalDofMapping, bool adaptive = Capabilities::isAdaptiveIndexSet< typename GridPart::IndexSetType >::v >
641  {
642  typedef typename std::conditional< adaptive, AdaptiveDofMapper< GridPart, LocalDofMapping >, DofMapper< GridPart, LocalDofMapping > >::type Type;
643  };
644 
645  } // namespace __IndexSetDofMapper
646 
647 
648 
649  // IndexSetDofMapper
650  // -----------------
651 
652  template< class GridPart, class LocalDofMapping = DefaultLocalDofMapping< GridPart > >
654  : public __IndexSetDofMapper::template Implementation< GridPart, LocalDofMapping >::Type
655  {
656  typedef typename __IndexSetDofMapper::template Implementation< GridPart, LocalDofMapping >::Type BaseType;
657 
658  public:
659  typedef typename BaseType::GridPartType GridPartType;
660  typedef typename BaseType::LocalDofMappingType LocalDofMappingType;
661 
662  template< class CodeFactory >
663  IndexSetDofMapper ( const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory )
664  : BaseType( gridPart, std::move( localDofMapping ), codeFactory )
665  {}
666 
667  template< class CodeFactory >
668  IndexSetDofMapper ( const GridPartType &gridPart, const CodeFactory &codeFactory )
669  : BaseType( gridPart, LocalDofMappingType( gridPart ), codeFactory )
670  {}
671  };
672 
673 
674  // Capabilities
675  // ------------
676 
677  namespace Capabilities
678  {
679  // isAdaptiveDofMapper
680  // -------------------
681 
682  template< class GridPart, class LocalDofMapping >
683  struct isAdaptiveDofMapper< IndexSetDofMapper< GridPart, LocalDofMapping > >
684  {
686  };
687 
688 
689  // isConsecutiveIndexSet
690  // ---------------------
691 
692  template< class GridPart, class LocalDofMapping >
693  struct isConsecutiveIndexSet< __IndexSetDofMapper::AdaptiveDofMapper< GridPart, LocalDofMapping > >
694  {
695  static const bool v = true;
696  };
697 
698  } // namespace Capabilities
699 
700  } // namespace Fem
701 
702 } // namespace Dune
703 
704 #endif //#ifndef DUNE_FEM_DOFMAPPER_INDEXSETDOFMAPPER_HH
static ThisType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition: dofmanager.hh:1216
Definition: bindguard.hh:11
static constexpr T max(T a)
Definition: utility.hh:77
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: 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
const IndexSetType & indexSet() const
Definition: indexsetdofmapper.hh:246
bool fixedDataSize(int codim) const
Definition: indexsetdofmapper.hh:176
LocalDofMapping LocalDofMappingType
Definition: indexsetdofmapper.hh:116
unsigned int numDofs(const ElementType &element) const
Definition: indexsetdofmapper.hh:160
RefElementsType::ReferenceElement RefElementType
Definition: indexsetdofmapper.hh:81
std::size_t SizeType
Definition: indexsetdofmapper.hh:64
void mapEach(const ElementType &element, Functor f) const
map each local DoF number to a global one
Definition: indexsetdofmapper.hh:372
SizeType numberOfHoles(int) const
Definition: indexsetdofmapper.hh:206
unsigned int maxNumDofs_
Definition: indexsetdofmapper.hh:251
SizeType size() const
Definition: indexsetdofmapper.hh:178
void requestCodimensions()
submit request for codimensions used to index set
Definition: indexsetdofmapper.hh:439
void map(const ElementType &element, std::vector< GlobalKeyType > &indices) const
Definition: indexsetdofmapper.hh:387
GridPart GridPartType
Definition: indexsetdofmapper.hh:115
LocalDofMapping localDofMapping_
Definition: indexsetdofmapper.hh:249
Dune::ReferenceElements< typename GridPart::ctype, dimension > RefElementsType
Definition: indexsetdofmapper.hh:80
static const int dimension
Definition: indexsetdofmapper.hh:79
GlobalKeyType oldIndex(int hole, int) const
Definition: indexsetdofmapper.hh:211
void mapEntityDofs(const Entity &entity, std::vector< GlobalKeyType > &indices) const
Definition: indexsetdofmapper.hh:409
CodimType
Definition: indexsetdofmapper.hh:78
@ CodimVariableSize
Definition: indexsetdofmapper.hh:78
@ CodimEmpty
Definition: indexsetdofmapper.hh:78
@ CodimFixedSize
Definition: indexsetdofmapper.hh:78
SizeType offSet(int) const
Definition: indexsetdofmapper.hh:226
SizeType GlobalKeyType
Definition: indexsetdofmapper.hh:110
const DofMapperCode & code(const GeometryType &gt) const
Definition: indexsetdofmapper.hh:471
void update()
update mapper offsets
Definition: indexsetdofmapper.hh:456
const IndexSetType & indexSet_
Definition: indexsetdofmapper.hh:248
bool contains(int codim) const
Definition: indexsetdofmapper.hh:174
DofMapper(const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:297
unsigned int maxNumDofs() const
Definition: indexsetdofmapper.hh:159
SizeType oldOffSet(int) const
Definition: indexsetdofmapper.hh:221
std::vector< GeometryType > BlockMapType
Definition: indexsetdofmapper.hh:238
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:417
void mapEachEntityDof(const Entity &entity, Functor f) const
Definition: indexsetdofmapper.hh:396
GlobalKeyType newIndex(int hole, int) const
Definition: indexsetdofmapper.hh:216
const SubEntityInfo & subEntityInfo(const Entity &entity) const
Definition: indexsetdofmapper.hh:480
GridPartType::template Codim< 0 >::EntityType ElementType
Definition: indexsetdofmapper.hh:118
static constexpr bool consecutive() noexcept
Definition: indexsetdofmapper.hh:199
GridPartType::IndexSetType IndexSetType
Definition: indexsetdofmapper.hh:237
CodimType codimType_[dimension+1]
Definition: indexsetdofmapper.hh:255
const DofMapperCode & code(const ElementType &element) const
Definition: indexsetdofmapper.hh:241
std::vector< DofMapperCode > code_
Definition: indexsetdofmapper.hh:250
SizeType size_
Definition: indexsetdofmapper.hh:252
unsigned int numEntityDofs(const Entity &entity) const
Definition: indexsetdofmapper.hh:432
BlockMapType blockMap_
Definition: indexsetdofmapper.hh:254
SizeType numBlocks() const
Definition: indexsetdofmapper.hh:201
std::vector< SubEntityInfo > subEntityInfo_
Definition: indexsetdofmapper.hh:253
SizeType oldOffset
Definition: indexsetdofmapper.hh:75
SubEntityInfo()
Definition: indexsetdofmapper.hh:69
SizeType offset
Definition: indexsetdofmapper.hh:75
unsigned int numDofs
Definition: indexsetdofmapper.hh:74
unsigned int codim
Definition: indexsetdofmapper.hh:73
SubEntityFilter(const RefElementType &refElement, int subEntity, int codim)
Definition: indexsetdofmapper.hh:87
bool operator()(int i, int c) const
Definition: indexsetdofmapper.hh:103
Definition: indexsetdofmapper.hh:110
BuildFunctor(std::vector< SubEntityInfo > &subEntityInfo)
Definition: indexsetdofmapper.hh:266
Definition: indexsetdofmapper.hh:493
bool compress()
Definition: indexsetdofmapper.hh:550
void update()
Definition: indexsetdofmapper.hh:525
int numBlocks() const
Definition: indexsetdofmapper.hh:529
void read(InStreamInterface< StreamTraits > &in)
Definition: indexsetdofmapper.hh:556
void write(OutStreamInterface< StreamTraits > &out) const
Definition: indexsetdofmapper.hh:553
BaseType::LocalDofMappingType LocalDofMappingType
Definition: indexsetdofmapper.hh:503
BaseType::SubEntityInfo SubEntityInfo
Definition: indexsetdofmapper.hh:498
bool consecutive() const
Definition: indexsetdofmapper.hh:540
SizeType newIndex(SizeType hole, int blk) const
Definition: indexsetdofmapper.hh:624
void insertEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:543
ThisType & operator=(const ThisType &)=delete
void backup() const
Definition: indexsetdofmapper.hh:561
SizeType oldIndex(SizeType hole, int blk) const
Definition: indexsetdofmapper.hh:611
BaseType::GridPartType::GridType GridType
Definition: indexsetdofmapper.hh:499
void resize()
Definition: indexsetdofmapper.hh:548
AdaptiveDofMapper(const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:507
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:502
BaseType::SizeType SizeType
Definition: indexsetdofmapper.hh:504
const GridType & grid_
Definition: indexsetdofmapper.hh:570
~AdaptiveDofMapper()
Definition: indexsetdofmapper.hh:517
SizeType offSet(int blk) const
Definition: indexsetdofmapper.hh:580
SizeType numberOfHoles(int blk) const
Definition: indexsetdofmapper.hh:600
BlockMapType blockMap_
Definition: indexsetdofmapper.hh:254
void restore()
Definition: indexsetdofmapper.hh:562
SizeType oldOffSet(int blk) const
Definition: indexsetdofmapper.hh:590
void removeEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:546
Definition: indexsetdofmapper.hh:641
std::conditional< adaptive, AdaptiveDofMapper< GridPart, LocalDofMapping >, DofMapper< GridPart, LocalDofMapping > >::type Type
Definition: indexsetdofmapper.hh:642
Definition: indexsetdofmapper.hh:655
IndexSetDofMapper(const GridPartType &gridPart, LocalDofMappingType localDofMapping, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:663
IndexSetDofMapper(const GridPartType &gridPart, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:668
BaseType::LocalDofMappingType LocalDofMappingType
Definition: indexsetdofmapper.hh:660
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:659