dune-fem  2.4.1-rc
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 
8 #include <dune/geometry/referenceelements.hh>
9 #include <dune/geometry/type.hh>
10 #include <dune/geometry/typeindex.hh>
11 
14 #include <dune/fem/misc/functor.hh>
19 
20 namespace Dune
21 {
22 
23  namespace Fem
24  {
25 
26  namespace __IndexSetDofMapper
27  {
28 
29  // DofMapper
30  // ---------
31 
32  template< class GridPart >
33  class DofMapper
34  {
36  public:
37  typedef std::size_t SizeType;
38  protected:
40  {
42  : numDofs( 0 )
43  {}
44 
45  unsigned int codim;
46  unsigned int numDofs;
47  SizeType offset, oldOffset;
48  };
49 
51  static const int dimension = GridPart::dimension;
52  typedef Dune::ReferenceElement< typename GridPart::ctype, dimension > RefElementType;
53  typedef Dune::ReferenceElements< typename GridPart::ctype, dimension > RefElementsType;
54 
55  struct BuildFunctor;
56 
58  {
59  SubEntityFilter(const RefElementType &refElement, int subEntity, int codim)
60  : active_(dimension+1), size_(0)
61  {
62  for (int c=0;c<=dimension;++c)
63  {
64  std::vector<bool> &a = active_[c];
65  a.resize( refElement.size( c ), false );
66  if (c<codim) continue;
67  if (c==codim) { a[subEntity]=true; ++size_; continue; }
68  for (int i=0;i<refElement.size(subEntity, codim, c);++i)
69  {
70  a[refElement.subEntity(subEntity, codim, i, c)] = true;
71  ++size_;
72  }
73  }
74  }
75  bool operator()(int i,int c) const { return active_[c][i]; }
76  private:
77  std::vector< std::vector< bool > > active_;
78  int size_;
79  };
80  template< class Functor >
81  struct MapFunctor;
83 
84  public:
85  typedef SizeType GlobalKeyType;
86 
87  typedef GridPart GridPartType;
88 
89  typedef typename GridPartType::template Codim< 0 >::EntityType ElementType;
90 
91  template< class CodeFactory >
92  DofMapper ( const GridPartType &gridPart, const CodeFactory &codeFactory );
93 
94  // mapping for DoFs
115  template< class Functor >
116  void mapEach ( const ElementType &element, Functor f ) const;
117 
118  void map ( const ElementType &element, std::vector< GlobalKeyType > &indices ) const;
119 
129  void onSubEntity( const ElementType &element, int i, int c, std::vector< bool > &indices ) const;
130 
131  unsigned int maxNumDofs () const { return maxNumDofs_; }
132  unsigned int numDofs ( const ElementType &element ) const { return code( element ).numDofs(); }
133 
134  // assignment of DoFs to entities
135  template< class Entity, class Functor >
136  void mapEachEntityDof ( const Entity &entity, Functor f ) const;
137 
138  template< class Entity >
139  void mapEntityDofs ( const Entity &entity, std::vector< GlobalKeyType > &indices ) const;
140 
141  template< class Entity >
142  unsigned int numEntityDofs ( const Entity &entity ) const;
143 
144  // global information
145 
146  bool contains ( int codim ) const { return (codimType_[ codim ] != CodimEmpty); }
147 
148  bool fixedDataSize ( int codim ) const { return (codimType_[ codim ] == CodimFixedSize); }
149 
150  SizeType size () const { return size_; }
151 
152  void update ();
153 
154 
155  /* \name AdaptiveDofMapper interface methods
156  * \{
157  */
158 
159  /* Compatibility methods; users expect an AdaptiveDiscreteFunction to
160  * compile over spaces built on top of a LeafGridPart or LevelGridPart.
161  *
162  * The AdaptiveDiscreteFunction requires the block mapper (i.e. this
163  * type) to be adaptive. The CodimensionMapper however is truly
164  * adaptive if and only if the underlying index set is adaptive. We
165  * don't want to wrap the index set as 1) it hides the actual problem
166  * (don't use the AdaptiveDiscreteFunction with non-adaptive index
167  * sets), and 2) other dune-fem classes may make correct use of the
168  * index set's capabilities.
169  */
170 
171  static constexpr bool consecutive () noexcept { return false; }
172 
173  SizeType numBlocks () const
174  {
175  DUNE_THROW( NotImplemented, "Method numBlocks() called on non-adaptive block mapper" );
176  }
177 
178  SizeType numberOfHoles ( int ) const
179  {
180  DUNE_THROW( NotImplemented, "Method numberOfHoles() called on non-adaptive block mapper" );
181  }
182 
183  GlobalKeyType oldIndex ( int hole, int ) const
184  {
185  DUNE_THROW( NotImplemented, "Method oldIndex() called on non-adaptive block mapper" );
186  }
187 
188  GlobalKeyType newIndex ( int hole, int ) const
189  {
190  DUNE_THROW( NotImplemented, "Method newIndex() called on non-adaptive block mapper" );
191  }
192 
193  SizeType oldOffSet ( int ) const
194  {
195  DUNE_THROW( NotImplemented, "Method oldOffSet() called on non-adaptive block mapper" );
196  }
197 
198  SizeType offSet ( int ) const
199  {
200  DUNE_THROW( NotImplemented, "Method offSet() called on non-adaptive block mapper" );
201  }
202 
203  /* \} */
204 
205  protected:
206  typedef typename GridPartType::IndexSetType IndexSetType;
207  typedef std::vector< GeometryType > BlockMapType;
208 
209  const DofMapperCode &code ( const GeometryType &gt ) const;
210  const DofMapperCode &code ( const ElementType &element ) const { return code( element.type() ); }
211 
212  template< class Entity >
213  const SubEntityInfo &subEntityInfo ( const Entity &entity ) const;
214 
215  const IndexSetType &indexSet () const { return gridPart_.indexSet(); }
216 
217  const GridPartType &gridPart_;
218  std::vector< DofMapperCode > code_;
219  unsigned int maxNumDofs_;
220  SizeType size_;
221  std::vector< SubEntityInfo > subEntityInfo_;
222  BlockMapType blockMap_;
223  CodimType codimType_[ dimension+1 ];
224  };
225 
226 
227 
228  // DofMapper::BuildFunctor
229  // -----------------------
230 
231  template< class GridPart >
232  struct DofMapper< GridPart >::BuildFunctor
233  {
234  explicit BuildFunctor ( std::vector< SubEntityInfo > &subEntityInfo )
235  : subEntityInfo_( subEntityInfo )
236  {}
237 
238  template< class Iterator >
239  void operator() ( unsigned int gtIndex, unsigned int subEntity, Iterator it, Iterator end )
240  {
241  SubEntityInfo &info = subEntityInfo_[ gtIndex ];
242  const unsigned int numDofs = end - it;
243  if( info.numDofs == 0 )
244  info.numDofs = numDofs;
245  else if( info.numDofs != numDofs )
246  DUNE_THROW( DofMapperError, "Inconsistent number of DoFs on subEntity (codim = " << info.codim << ")." );
247  }
248 
249  private:
250  std::vector< SubEntityInfo > &subEntityInfo_;
251  };
252 
253  // DofMapper::MapFunctor
254  // ---------------------
255 
256  // The functor maps all DoFs for a given entity. Intentially, it
257  // is passed as argument to DofMapperCode::operator() which then
258  // calls the apply()-method for each sub-entity with DoFs in turn.
259  template< class GridPart >
260  template< class Functor >
261  struct DofMapper< GridPart >::MapFunctor
262  {
263  static const bool isCartesian = Dune::Capabilities::
264  isCartesian< typename GridPart :: GridType > :: v ;
265 
266  MapFunctor ( const GridPart& gridPart, const std::vector< SubEntityInfo > &subEntityInfo,
267  const ElementType &element, Functor functor )
268  : gridPart_( gridPart ),
269  indexSet_( gridPart_.indexSet() ),
270  subEntityInfo_( subEntityInfo ),
271  element_( element ),
272  functor_( functor )
273  {}
274 
275  // subEntity is the sub-entity number, given codim, as returned
276  // by refElem.subEntity(). The iterators iterate over all DoFs
277  // attached to the given sub-entity.
278  template< class Iterator >
279  void operator() ( unsigned int gtIndex, unsigned int subEntity, Iterator it, Iterator end )
280  {
281  enum { dimension = GridPart :: dimension };
282 
283  const SubEntityInfo &info = subEntityInfo_[ gtIndex ];
284  const SizeType subIndex = indexSet_.subIndex( element_, subEntity, info.codim );
285  SizeType index = info.offset + SizeType( info.numDofs ) * subIndex;
286 
287  const unsigned int codim = info.codim ;
288 
289  const unsigned int numDofs = info.numDofs ;
290  // for non-Cartesian grids check twist if on edges with noDofs > 1
291  // this should be the case for polOrder > 2.
292  // Note that in 3d this only solves the twist problem up to polOrder = 3
293  if( ! isCartesian && codim == dimension-1 && numDofs > 1 )
294  {
295  typedef typename GridPart::ctype FieldType ;
296  const Dune::ReferenceElement< FieldType, dimension > &refElem
297  = Dune::ReferenceElements< FieldType, dimension >::general( element_.type() );
298 
299 #ifndef NDEBUG
300  const int vxSize = refElem.size( subEntity, codim, dimension );
301  // two vertices per edge in 2d
302  assert( vxSize == 2 );
303 #endif
304  const int vx[ 2 ] = { refElem.subEntity ( subEntity, codim, 0, dimension ),
305  refElem.subEntity ( subEntity, codim, 1, dimension ) };
306 
307  // flip index if face is twisted
308  if( gridPart_.grid().localIdSet().subId( gridEntity( element_ ), vx[ 1 ], dimension )
309  < gridPart_.grid().localIdSet().subId( gridEntity( element_ ), vx[ 0 ], dimension ) )
310  {
311  std::vector< unsigned int > global( numDofs );
312  std::vector< unsigned int > local ( numDofs );
313 
314  unsigned int count = 0 ;
315  while( it != end )
316  {
317  global[ count ] = index++;
318  local [ count ] = *(it++);
319  ++count ;
320  }
321 
322  unsigned int reverse = numDofs - 1;
323  for( unsigned int i=0; i<numDofs; ++ i, --reverse )
324  {
325  functor_( local[ i ], global[ reverse ] );
326  }
327 
328  // already did mapping, then return
329  return ;
330  }
331  }
332 
333  // standard mapping
334  while( it != end )
335  {
336  functor_( *(it++), index++ );
337  }
338  }
339 
340  private:
341  const GridPart& gridPart_;
342  const IndexSetType &indexSet_;
343  const std::vector< SubEntityInfo > &subEntityInfo_;
344  const ElementType &element_;
345  Functor functor_;
346  };
347 
348  template< class GridPart >
349  struct DofMapper< GridPart >::SubEntityFilterFunctor
350  {
351  static const bool isCartesian = Dune::Capabilities::
352  isCartesian< typename GridPart :: GridType > :: v ;
353 
354  SubEntityFilterFunctor( const GridPart &gridPart, const std::vector< SubEntityInfo > &subEntityInfo,
355  const ElementType &element, int i, int c,
356  std::vector<bool> &vec )
357  : gridPart_( gridPart ),
358  subEntityInfo_( subEntityInfo ),
359  element_( element ),
360  vec_(vec),
361  filter_(RefElementsType::general( element.type() ), i,c)
362  {}
363 
364  template< class Iterator >
365  void operator() ( unsigned int gtIndex, unsigned int subEntity, Iterator it, Iterator end )
366  {
367  enum { dimension = GridPart :: dimension };
368 
369  const SubEntityInfo &info = subEntityInfo_[ gtIndex ];
370 
371  const unsigned int codim = info.codim ;
372 
373  const unsigned int numDofs = info.numDofs ;
374 
375  bool active = filter_(subEntity,codim);
376 
377  // for non-Cartesian grids check twist if on codim 1 noDofs > 1
378  // this should be the case for polOrder > 2
379  if( ! isCartesian && codim == dimension-1 && numDofs > 1 )
380  {
381  typedef typename GridPart::ctype FieldType ;
382  const Dune::ReferenceElement< FieldType, dimension > &refElem
383  = Dune::ReferenceElements< FieldType, dimension >::general( element_.type() );
384 
385 #ifndef NDEBUG
386  const int vxSize = refElem.size( subEntity, codim, dimension );
387  // two vertices per edge in 2d
388  assert( vxSize == 2 );
389 #endif
390  const int vx[ 2 ] = { refElem.subEntity ( subEntity, codim, 0, dimension ),
391  refElem.subEntity ( subEntity, codim, 1, dimension ) };
392 
393  // flip index if face is twisted
394  if( gridPart_.grid().localIdSet().subId( gridEntity( element_ ), vx[ 1 ], dimension )
395  < gridPart_.grid().localIdSet().subId( gridEntity( element_ ), vx[ 0 ], dimension ) )
396  {
397  std::vector< unsigned int > global( numDofs );
398  std::vector< unsigned int > local ( numDofs );
399 
400  unsigned int count = 0 ;
401  while( it != end )
402  {
403  local [ count ] = *(it++);
404  ++count ;
405  }
406 
407  unsigned int reverse = numDofs - 1;
408  for( unsigned int i=0; i<numDofs; ++ i, --reverse )
409  {
410  vec_[ local[i] ] = active;
411  }
412 
413  // already did mapping, then return
414  return ;
415  }
416  }
417 
418  // standard mapping
419  while( it != end )
420  {
421  vec_[ *(it++) ] = active;
422  }
423  }
424 
425  private:
426  const GridPart& gridPart_;
427  const std::vector< SubEntityInfo > &subEntityInfo_;
428  const ElementType &element_;
429  std::vector<bool> &vec_;
430  SubEntityFilter filter_;
431  };
432 
433  // Implementation of DofMapper
434  // ---------------------------
435 
436  template< class GridPart >
438 
439  template< class GridPart >
440  template< class CodeFactory >
441  inline DofMapper< GridPart >
442  ::DofMapper ( const GridPartType &gridPart, const CodeFactory &codeFactory )
443  : gridPart_( gridPart ),
444  code_( LocalGeometryTypeIndex::size( dimension ) ),
445  maxNumDofs_( 0 ),
446  subEntityInfo_( GlobalGeometryTypeIndex::size( dimension ) )
447  {
448  std::vector< GeometryType > gt( GlobalGeometryTypeIndex::size( dimension ) );
449 
450  const typename RefElementsType::Iterator end = RefElementsType::end();
451  for( typename RefElementsType::Iterator it = RefElementsType::begin(); it != end; ++it )
452  {
453  const RefElementType &refElement = *it;
454 
455  for( int codim = 0; codim <= dimension; ++codim )
456  {
457  for( int i = 0; i < refElement.size( codim ); ++i )
458  {
459  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( refElement.type( i, codim ) );
460  gt[ gtIdx ] = refElement.type( i, codim );
461  subEntityInfo_[ gtIdx ].codim = codim;
462  }
463  }
464 
465  DofMapperCode &code = code_[ LocalGeometryTypeIndex::index( refElement.type() ) ];
466  code = codeFactory( refElement );
467  maxNumDofs_ = std::max( code.numDofs(), maxNumDofs_ );
469  }
470 
471  for( int codim = 0; codim <= dimension; ++codim )
473 
474  unsigned int codimDofs[ dimension+1 ];
475  for( unsigned int i = 0; i < subEntityInfo_.size(); ++i )
476  {
477  const SubEntityInfo &info = subEntityInfo_[ i ];
478  if( info.numDofs == 0 )
479  continue;
480 
481  if( codimType_[ info.codim ] == CodimEmpty )
482  codimType_[ info.codim ] = CodimFixedSize;
483  else if( codimDofs[ info.codim ] != info.numDofs )
485 
486  codimDofs[ info.codim ] = info.numDofs;
487  blockMap_.push_back( gt[ i ] );
488  }
489 
490  update();
491  }
492 
493 
494  template< class GridPart >
495  template< class Functor >
496  inline void DofMapper< GridPart >
497  ::mapEach ( const ElementType &element, Functor f ) const
498  {
499  code( element )( MapFunctor< Functor >( gridPart_, subEntityInfo_, element, f ) );
500  }
501 
502 
503  template< class GridPart >
504  inline void DofMapper< GridPart >
505  ::map ( const ElementType &element, std::vector< SizeType > &indices ) const
506  {
507  indices.resize( numDofs( element ) );
508  mapEach( element, AssignFunctor< std::vector< SizeType > >( indices ) );
509  }
510 
511  template< class GridPart >
512  template< class Entity, class Functor >
513  inline void DofMapper< GridPart >
514  ::mapEachEntityDof ( const Entity &entity, Functor f ) const
515  {
516  const SubEntityInfo &info = subEntityInfo( entity );
517  const unsigned int numDofs = info.numDofs;
518  SizeType index = info.offset + numDofs * SizeType( indexSet().index( entity ) );
519  for( unsigned int i = 0; i < info.numDofs; ++i )
520  f( i, index++ );
521  }
522 
523 
524  template< class GridPart >
525  template< class Entity >
526  inline void DofMapper< GridPart >
527  ::mapEntityDofs ( const Entity &entity, std::vector< SizeType > &indices ) const
528  {
529  indices.resize( numEntityDofs( entity ) );
530  mapEachEntityDof( entity, AssignFunctor< std::vector< SizeType > >( indices ) );
531  }
532 
533  template< class GridPart >
534  inline void DofMapper< GridPart >
535  ::onSubEntity( const ElementType &element, int i, int c, std::vector< bool > &indices ) const
536  {
537  indices.resize( numEntityDofs( element ) );
538  code( element )( SubEntityFilterFunctor( gridPart_, subEntityInfo_, element, i,c , indices ) );
539  }
540 
541  template< class GridPart >
542  template< class Entity >
543  inline unsigned int
545  ::numEntityDofs ( const Entity &entity ) const
546  {
547  return subEntityInfo( entity ).numDofs;
548  }
549 
550 
551  template< class GridPart >
553  {
554  size_ = 0;
555  for( typename BlockMapType::const_iterator it = blockMap_.begin(); it != blockMap_.end(); ++it )
556  {
557  SubEntityInfo &info = subEntityInfo_[ GlobalGeometryTypeIndex::index( *it ) ];
558  info.oldOffset = info.offset;
559  info.offset = size_;
560  size_ += SizeType( info.numDofs ) * SizeType( indexSet().size( *it ) );
561  }
562  }
563 
564 
565  template< class GridPart >
567  ::code ( const GeometryType &gt ) const
568  {
569  return code_[ LocalGeometryTypeIndex::index( gt ) ];
570  }
571 
572 
573  template< class GridPart >
574  template< class Entity >
575  inline const typename DofMapper< GridPart >::SubEntityInfo &
576  DofMapper< GridPart >::subEntityInfo ( const Entity &entity ) const
577  {
578  return subEntityInfo_[ GlobalGeometryTypeIndex::index( entity.type() ) ];
579  }
580 
581 
582 
583  // AdaptiveDofMapper
584  // -----------------
585 
586  template< class GridPart >
588  : public DofMapper< GridPart >
589  {
592 
593  protected:
595 
596  public:
598  typedef typename BaseType::SizeType SizeType;
599 
600  using BaseType::update;
601 
602  template< class CodeFactory >
603  AdaptiveDofMapper ( const GridPartType &gridPart, const CodeFactory &codeFactory )
604  : BaseType( gridPart, codeFactory )
605  {
607  }
608 
609  AdaptiveDofMapper ( const ThisType & ) = delete;
610 
612  {
613  DofManager< typename GridPartType::GridType >::instance( gridPart_.grid() ).removeIndexSet( *this );
614  }
615 
616  ThisType &operator= ( const ThisType & ) = delete;
617 
618  // adaptation interface
619 
620  int numBlocks () const { return blockMap_.size(); }
621  SizeType offSet ( int blk ) const;
622  SizeType oldOffSet ( int blk ) const;
623 
624  SizeType numberOfHoles ( int blk ) const;
625 
626  SizeType oldIndex ( SizeType hole, int blk ) const;
627  SizeType newIndex ( SizeType hole, int blk ) const;
628 
629  // adaptation methods (as for index sets)
630 
631  bool consecutive () const { return true; }
632 
633  template< class Entity >
634  void insertEntity ( const Entity &entity ) { update(); }
635 
636  template< class Entity >
637  void removeEntity ( const Entity &entity ) {}
638 
639  void resize () { update(); }
640 
641  bool compress () { update(); return true; }
642 
643  template <class StreamTraits>
645 
646  template <class StreamTraits>
648  {
649  update();
650  }
651 
652  void backup () const {}
653  void restore () {}
654 
655  protected:
656  using BaseType::indexSet;
657 
658  using BaseType::blockMap_;
659  using BaseType::gridPart_;
660  using BaseType::subEntityInfo_;
661  };
662 
663 
664 
665  // Implementation of AdaptiveDofMapper
666  // -----------------------------------
667 
668  template< class GridPart >
671  {
672  assert( (blk >= 0) && (blk < numBlocks()) );
673  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
674  return subEntityInfo_[ gtIdx ].offset;
675  }
676 
677 
678  template< class GridPart >
681  {
682  assert( (blk >= 0) && (blk < numBlocks()) );
683  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
684  return subEntityInfo_[ gtIdx ].oldOffset;
685  }
686 
687 
688  template< class GridPart >
691  {
692  assert( (blk >= 0) && (blk < numBlocks()) );
693  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
694  const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
695  return SizeType( info.numDofs ) * SizeType( indexSet().numberOfHoles( blockMap_[ blk ] ) );
696  }
697 
698 
699  template< class GridPart >
702  {
703  assert( (hole >= 0) && (hole < numberOfHoles( blk )) );
704  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
705  const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
706  const unsigned int numDofs = info.numDofs;
707  const SizeType index = indexSet().oldIndex( hole / numDofs, blockMap_[ blk ] );
708  return info.offset + numDofs * index + (hole % numDofs);
709  }
710 
711 
712  template< class GridPart >
715  {
716  assert( (hole >= 0) && (hole < numberOfHoles( blk )) );
717  const unsigned int gtIdx = GlobalGeometryTypeIndex::index( blockMap_[ blk ] );
718  const SubEntityInfo &info = subEntityInfo_[ gtIdx ];
719  const unsigned int numDofs = info.numDofs;
720  const SizeType index = indexSet().newIndex( hole / numDofs, blockMap_[ blk ] );
721  return info.offset + numDofs * index + (hole % numDofs);
722  }
723 
724 
725 
726  // Implementation
727  // --------------
728 
729  template< class GridPart, bool adaptive = Capabilities::isAdaptiveIndexSet< typename GridPart::IndexSetType >::v >
731  {
732  typedef typename std::conditional< adaptive, AdaptiveDofMapper< GridPart >, DofMapper< GridPart > >::type Type;
733  };
734 
735  } // namespace __IndexSetDofMapper
736 
737 
738 
739  // IndexSetDofMapper
740  // -----------------
741 
742  template< class GridPart >
744  : public __IndexSetDofMapper::template Implementation< GridPart >::Type
745  {
746  typedef typename __IndexSetDofMapper::template Implementation< GridPart >::Type BaseType;
747 
748  public:
749  typedef typename BaseType::GridPartType GridPartType;
750 
751  template< class CodeFactory >
752  IndexSetDofMapper ( const GridPartType &gridPart, const CodeFactory &codeFactory )
753  : BaseType( gridPart, codeFactory )
754  {}
755  };
756 
757 
758  // Capabilities
759  // ------------
760 
761  namespace Capabilities
762  {
763  // isAdaptiveDofMapper
764  // -------------------
765 
766  template< class GridPart >
768  {
770  };
771 
772  } // namespace Capabilities
773 
774  } // namespace Fem
775 
776 } // namespace Dune
777 
778 #endif //#ifndef DUNE_FEM_DOFMAPPER_INDEXSETDOFMAPPER_HH
Definition: indexsetdofmapper.hh:587
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:749
bool compress()
Definition: indexsetdofmapper.hh:641
Definition: indexsetdofmapper.hh:730
SizeType size_
Definition: indexsetdofmapper.hh:220
MapFunctor(const GridPart &gridPart, const std::vector< SubEntityInfo > &subEntityInfo, const ElementType &element, Functor functor)
Definition: indexsetdofmapper.hh:266
std::vector< GeometryType > BlockMapType
Definition: indexsetdofmapper.hh:207
bool consecutive() const
Definition: indexsetdofmapper.hh:631
SizeType newIndex(SizeType hole, int blk) const
Definition: indexsetdofmapper.hh:714
void read(InStreamInterface< StreamTraits > &in)
Definition: indexsetdofmapper.hh:647
SizeType offSet(int) const
Definition: indexsetdofmapper.hh:198
SubEntityInfo()
Definition: indexsetdofmapper.hh:41
void removeEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:637
void insertEntity(const Entity &entity)
Definition: indexsetdofmapper.hh:634
DofMapper(const GridPartType &gridPart, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:442
static constexpr T max(T a)
Definition: utility.hh:65
SizeType size() const
Definition: indexsetdofmapper.hh:150
int numBlocks() const
Definition: indexsetdofmapper.hh:620
unsigned int numEntityDofs(const Entity &entity) const
Definition: indexsetdofmapper.hh:545
SizeType oldOffset
Definition: indexsetdofmapper.hh:47
SubEntityFilter(const RefElementType &refElement, int subEntity, int codim)
Definition: indexsetdofmapper.hh:59
static const int dimension
Definition: indexsetdofmapper.hh:51
unsigned int maxNumDofs_
Definition: indexsetdofmapper.hh:219
bool operator()(int i, int c) const
Definition: indexsetdofmapper.hh:75
Dune::ReferenceElements< typename GridPart::ctype, dimension > RefElementsType
Definition: indexsetdofmapper.hh:53
GlobalKeyType newIndex(int hole, int) const
Definition: indexsetdofmapper.hh:188
void restore()
Definition: indexsetdofmapper.hh:653
GridPart GridPartType
Definition: indexsetdofmapper.hh:87
GridPartType::IndexSetType IndexSetType
Definition: indexsetdofmapper.hh:206
void backup() const
Definition: indexsetdofmapper.hh:652
std::size_t SizeType
Definition: indexsetdofmapper.hh:37
Definition: misc/functor.hh:30
const DofMapperCode & code(const GeometryType &gt) const
Definition: indexsetdofmapper.hh:567
SizeType oldOffSet(int blk) const
Definition: indexsetdofmapper.hh:680
GridPartType::template Codim< 0 >::EntityType ElementType
Definition: indexsetdofmapper.hh:89
unsigned int numDofs
Definition: indexsetdofmapper.hh:46
BuildFunctor(std::vector< SubEntityInfo > &subEntityInfo)
Definition: indexsetdofmapper.hh:234
Definition: indexsetdofmapper.hh:33
Definition: coordinate.hh:4
GlobalKeyType oldIndex(int hole, int) const
Definition: indexsetdofmapper.hh:183
SizeType offSet(int blk) const
Definition: indexsetdofmapper.hh:670
specialize with true if index set implements the interface for adaptive index sets ...
Definition: common/indexset.hh:69
abstract interface for an input stream
Definition: streams.hh:177
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:535
std::vector< SubEntityInfo > subEntityInfo_
Definition: indexsetdofmapper.hh:221
SizeType oldIndex(SizeType hole, int blk) const
Definition: indexsetdofmapper.hh:701
std::conditional< adaptive, AdaptiveDofMapper< GridPart >, DofMapper< GridPart > >::type Type
Definition: indexsetdofmapper.hh:732
SizeType numBlocks() const
Definition: indexsetdofmapper.hh:173
void mapEachEntityDof(const Entity &entity, Functor f) const
Definition: indexsetdofmapper.hh:514
BlockMapType blockMap_
Definition: indexsetdofmapper.hh:222
SizeType oldOffSet(int) const
Definition: indexsetdofmapper.hh:193
BaseType::SizeType SizeType
Definition: indexsetdofmapper.hh:598
SizeType numberOfHoles(int) const
Definition: indexsetdofmapper.hh:178
AdaptiveDofMapper(const GridPartType &gridPart, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:603
void resize()
Definition: indexsetdofmapper.hh:639
void write(OutStreamInterface< StreamTraits > &out) const
Definition: indexsetdofmapper.hh:644
SizeType numberOfHoles(int blk) const
Definition: indexsetdofmapper.hh:690
BaseType::SubEntityInfo SubEntityInfo
Definition: indexsetdofmapper.hh:594
const GridEntityAccess< Entity >::GridEntityType & gridEntity(const Entity &entity)
Definition: gridpart.hh:410
const DofMapperCode & code(const ElementType &element) const
Definition: indexsetdofmapper.hh:210
BaseType::GridPartType GridPartType
Definition: indexsetdofmapper.hh:597
bool contains(int codim) const
Definition: indexsetdofmapper.hh:146
IndexSetDofMapper(const GridPartType &gridPart, const CodeFactory &codeFactory)
Definition: indexsetdofmapper.hh:752
SizeType offset
Definition: indexsetdofmapper.hh:47
void update()
Definition: indexsetdofmapper.hh:552
CodimType
Definition: indexsetdofmapper.hh:50
Definition: space/mapper/capabilities.hh:21
const GridPartType & gridPart_
Definition: indexsetdofmapper.hh:217
unsigned int numDofs() const
Definition: code.hh:92
unsigned int maxNumDofs() const
Definition: indexsetdofmapper.hh:131
Definition: indexsetdofmapper.hh:743
CodimType codimType_[dimension+1]
Definition: indexsetdofmapper.hh:223
unsigned int numDofs(const ElementType &element) const
Definition: indexsetdofmapper.hh:132
const IndexSetType & indexSet() const
Definition: indexsetdofmapper.hh:215
const SubEntityInfo & subEntityInfo(const Entity &entity) const
Definition: indexsetdofmapper.hh:576
std::vector< DofMapperCode > code_
Definition: indexsetdofmapper.hh:218
~AdaptiveDofMapper()
Definition: indexsetdofmapper.hh:611
void mapEach(const ElementType &element, Functor f) const
map each local DoF number to a global one
Definition: indexsetdofmapper.hh:497
bool fixedDataSize(int codim) const
Definition: indexsetdofmapper.hh:148
Definition: space/mapper/exceptions.hh:12
void map(const ElementType &element, std::vector< GlobalKeyType > &indices) const
Definition: indexsetdofmapper.hh:505
Definition: code.hh:17
SubEntityFilterFunctor(const GridPart &gridPart, const std::vector< SubEntityInfo > &subEntityInfo, const ElementType &element, int i, int c, std::vector< bool > &vec)
Definition: indexsetdofmapper.hh:354
static constexpr bool consecutive() noexcept
Definition: indexsetdofmapper.hh:171
unsigned int codim
Definition: indexsetdofmapper.hh:45
static ThisType & instance(const GridType &grid)
obtain a reference to the DofManager for a given grid
Definition: dofmanager.hh:1319
SizeType GlobalKeyType
Definition: indexsetdofmapper.hh:82
void mapEntityDofs(const Entity &entity, std::vector< GlobalKeyType > &indices) const
Definition: indexsetdofmapper.hh:527
abstract interface for an output stream
Definition: streams.hh:44
Dune::ReferenceElement< typename GridPart::ctype, dimension > RefElementType
Definition: indexsetdofmapper.hh:52