dune-fem  2.4.1-rc
adaptiveleafindexset.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_ADAPTIVELEAFINDEXSET_HH
2 #define DUNE_FEM_ADAPTIVELEAFINDEXSET_HH
3 
4 #include <cassert>
5 #include <cstddef>
6 
7 #include <algorithm>
8 #include <string>
9 #include <vector>
10 #include <type_traits>
11 
12 #include <dune/common/forloop.hh>
13 
19 #include <dune/fem/version.hh>
20 
21 namespace Dune
22 {
23 
24  namespace Fem
25  {
26 
27  // Internal forward declations
28  // ---------------------------
29 
30  template < class GridPartImp >
32  template < class GridPartImp >
34  template < class GridPartImp >
36 
37 
38 
39 
41  //
42  // --AdaptiveIndexSetBaseTraits
43  //
45 
46  template< class GridPart, class IndexSet >
48  {
49  public:
50  // index set type derived from AdaptiveIndexSetBase
52 
53  // grid part type
54  typedef GridPart GridPartType;
55  // grid type
56  typedef typename GridPartType :: GridType GridType;
57 
58  // grid (part) dimension
59  static const int dimension = GridPartType :: dimension;
60 
61  template< int codim >
62  struct Codim
63  {
64  // entity type
65  typedef typename GridPartType :: template Codim< codim > :: EntityType Entity;
66  };
67 
68  // type of codim index set
70  // index type used
72 
73  // container of geometry types
74  typedef std::vector< GeometryType > Types;
75  };
76 
77 
78 
80  //
81  // --AdaptiveIndexSetBase
82  //
84 
96  template <class TraitsImp >
98  : public PersistentAdaptiveIndexSet< TraitsImp >
99  {
102 
103  protected:
104  typedef typename TraitsImp :: GridPartType GridPartType;
105  typedef typename GridPartType :: GridType GridType;
106 
107  typedef typename TraitsImp :: CodimIndexSetType CodimIndexSetType ;
108 
109  typedef typename GridType::template Codim< 0 >::Entity GridElementType;
110 
111  public:
113  static const int dimension = BaseType::dimension;
114 
116  static const int numCodimensions = TraitsImp :: numCodimensions ;
117 
119  static const int intersectionCodimension = TraitsImp :: intersectionCodimension ;
120 
122  static const bool hasSingleGeometryType = Dune::Capabilities::hasSingleGeometryType< GridType > :: v ;
123 
126 
128  typedef typename BaseType :: Types Types;
129 
131  typedef typename BaseType :: template Codim< 0 > :: Entity ElementType;
132 
134  typedef typename GridPartType :: IntersectionIteratorType IntersectionIteratorType;
135 
137  typedef typename GridPartType :: IntersectionType IntersectionType;
138 
139 
140  private:
141 
142  template< int codim , bool gridHasCodim >
143  struct CountElementsBase
144  {
145  static void apply ( const ThisType &indexSet, const GeometryType &type, IndexType& count )
146  {
147  if( type.dim() == dimension - codim )
148  count = indexSet.template countElements< codim >( type, std::integral_constant<bool,true>() );
149  }
150  };
151 
152  template< int codim >
153  struct CountElementsBase< codim, false >
154  {
155  static void apply ( const ThisType &indexSet, const GeometryType &type, IndexType& count )
156  {
157  if( type.dim() == dimension - codim )
158  count = indexSet.template countElements< codim >( type, std::integral_constant<bool,false>() );
159  }
160  };
161 
162  template< int codim >
163  struct CountElements
164  : public CountElementsBase< codim, Dune::Fem::GridPartCapabilities::hasEntity< GridPartType, codim > :: v >
165  {
166  };
167 
168 
169  template< int codim >
170  struct InsertSubEntities
171  {
172  static void apply ( ThisType &indexSet, const GridElementType &element )
173  {
174  // if codimension is not available return
175  if( ! indexSet.codimAvailable( codim ) ) return ;
176 
177  // if codimension is not used return
178  if( !indexSet.codimUsed_[ codim ] ) return;
179 
180  CodimIndexSetType &codimSet = indexSet.codimLeafSet( codim );
181 
182  const int count = element.subEntities( codim );
183  for( int i = 0; i < count; ++i )
184  {
185  codimSet.insertSubEntity( element, i );
186  }
187  }
188  };
189 
190  template< int codim , bool gridHasCodim >
191  struct InsertGhostSubEntitiesBase
192  {
193  static void apply ( ThisType &indexSet, const GridElementType &element,
194  const bool skipGhosts )
195  {
196  // if codimension is not available return
197  if( ! indexSet.codimAvailable( codim ) ) return ;
198 
199  // if codimension is not used return
200  if( !indexSet.codimUsed_[ codim ] ) return;
201 
202  CodimIndexSetType &codimSet = indexSet.codimLeafSet( codim );
203 
204  for( unsigned int i = 0; i < element.subEntities( codim ); ++i )
205  {
206  if( !skipGhosts || (element.partitionType() != GhostEntity) )
207  codimSet.insertGhost( make_entity( element.template subEntity< codim >( i ) ) );
208  }
209  }
210  };
211 
212  template< int codim >
213  struct InsertGhostSubEntitiesBase< codim, false >
214  {
215  static void apply ( ThisType &indexSet, const GridElementType &element,
216  const bool skipGhosts )
217  {}
218  };
219 
220  template< int codim >
221  struct InsertGhostSubEntities
222  : public InsertGhostSubEntitiesBase< codim, Dune::Capabilities::hasEntity < GridType, codim > :: v >
223  {
224  };
225 
226  template< int codim , bool gridHasCodim >
227  struct CallSetUpCodimSetBase
228  {
229  static void apply ( const int cd, const ThisType &indexSet )
230  {
231  // if codimension is not available return
232  if( ! indexSet.codimAvailable( codim ) ) return ;
233 
234  if( cd == codim )
235  indexSet.template setupCodimSet< codim >(std::integral_constant<bool,true>());
236  }
237  };
238 
239  template< int codim >
240  struct CallSetUpCodimSetBase< codim, false >
241  {
242  static void apply ( const int cd, const ThisType &indexSet )
243  {
244  if( cd == codim )
245  indexSet.template setupCodimSet< codim >(std::integral_constant<bool,false>());
246  }
247  };
248 
249  template< int codim >
250  struct CallSetUpCodimSet
251  : public CallSetUpCodimSetBase< codim, Dune::Capabilities::hasEntity < GridType, codim > :: v >
252  {
253  };
254 
255 
257  // subentity extractor
259 
260  template < int codim, bool gridHasCodim >
261  struct GetSubEntityBase
262  {
263  typedef typename GridPartType :: template Codim< codim > :: EntityType Entity;
264  static Entity subEntity( const ElementType& element, const int subEn )
265  {
266  return make_entity( element.template subEntity< codim > ( subEn ) );
267  }
268  };
269 
270  template < int codim >
271  struct GetSubEntityBase< codim, false >
272  {
273  typedef typename GridPartType :: template Codim< 0 > :: EntityType Entity;
274  static Entity subEntity( const ElementType& element, const int subEn )
275  {
276  DUNE_THROW(NotImplemented,"stupid grid without entities of codim 1 used");
277  }
278  };
279 
280  struct GetFaceEntity
281  : public GetSubEntityBase< 1, Dune::Capabilities::hasEntity < GridType, 1 > :: v >
282  {
283  };
284 
286  typedef typename GetFaceEntity :: Entity FaceType;
287 
289  enum { CartesianNonAdaptiveGrid = Dune::Capabilities::isCartesian<GridType>::v &&
291 
292  // my type, to be revised
293  enum { myType = ( numCodimensions == 1 ) ? ( (CartesianNonAdaptiveGrid) ? -1 : 665 ) : 6 };
294 
295  // max num of codimension (to avoid compiler warnings)
296  enum { maxNumCodimension = ((dimension + 1) > numCodimensions) ? dimension + 2 : numCodimensions+1 };
297 
299  static const PartitionIteratorType pitype = GridPartType :: indexSetPartitionType ;
300 
301  // reference to grid part
302  const GridPartType& gridPart_;
303  // Codimension leaf index sets
304  mutable CodimIndexSetType* codimLeafSet_[ numCodimensions ];
305  // flag for codim is in use or not
306  mutable bool codimUsed_ [ maxNumCodimension ];
307 
308  // vector holding geometry types
309  std::vector< std::vector< GeometryType > > geomTypes_;
310 
311  // actual sequence number
312  int sequence_;
313 
315  mutable bool compressed_;
316 
317  protected:
318  using BaseType::grid_;
319  using BaseType::dofManager_;
320 
321  // return true if codim is supported
322  bool codimAvailable( const int codim ) const
323  {
324  return codim < numCodimensions && codim >= 0 ;
325  }
326 
327  CodimIndexSetType& codimLeafSet( const int codim ) const
328  {
329  assert( codimLeafSet_[ codim ] );
330  // assert( codimAvailable( codim ) );
331  return *codimLeafSet_[ codim ];
332  }
333 
334  public:
336  AdaptiveIndexSetBase (const GridPartType & gridPart)
337  : BaseType( gridPart.grid() )
338  , gridPart_( gridPart )
339  , sequence_( dofManager_.sequence() )
340  , compressed_(true) // at start the set is compressed
341  {
342  // codim 0 is used by default
343  codimUsed_[ 0 ] = true;
344 
345  // all higher codims are not used by default
346  for(int codim = 1; codim < maxNumCodimension; ++codim ) codimUsed_[ codim ] = false ;
347 
348  // set the codim of each Codim Set.
349  for(int codim = 0; codim < numCodimensions; ++codim )
350  {
351  if( codim == intersectionCodimension )
352  codimLeafSet_[ codim ] = new CodimIndexSetType( grid_, 1 );
353  else
354  codimLeafSet_[ codim ] = new CodimIndexSetType( grid_, codim );
355  }
356 
358  {
359  // get level-0 view, this is alrady used in GridPtr (DFG parser)
360  typedef typename GridType :: LevelGridView MacroViewType;
361  MacroViewType macroView = grid_.levelGridView( 0 );
362  const typename MacroViewType :: IndexSet& indexSet = macroView.indexSet();
363 
364  // resize vector of geometry types
365  geomTypes_.resize( dimension+1 );
366  for(int codim=0; codim <= dimension; ++codim )
367  {
368  const int size = indexSet.types( codim ).size();
369  // copy geometry types
370  geomTypes_[ codim ].resize( size );
371  std::copy_n( indexSet.types( codim ).begin(), size, geomTypes_[ codim ].begin() );
372  }
373  }
374 
375  // build index set
376  setupIndexSet();
377  }
378 
381  {
382  // delete all the codim sets
383  for(int codim = 0; codim < numCodimensions; ++codim )
384  {
385  delete codimLeafSet_[ codim ];
386  codimLeafSet_[ codim ] = 0;
387  }
388  }
389 
391  int type () const
392  {
393  return myType;
394  }
395 
397  virtual std::string name () const
398  {
399  return "AdaptiveIndexSetBase";
400  }
401 
402  //****************************************************************
403  //
404  // INTERFACE METHODS for DUNE INDEX SETS
405  // --size
406  //
407  //****************************************************************
409  IndexType size ( GeometryType type ) const
410  {
411  const int codim = dimension - type.dim();
412 
413  // true if only one geometry type is present
414  const bool onlySingleGeometryType = hasSingleGeometryType || ( geomTypes( codim ).size() == 1 ) ;
415  // use size of codim index set if possible
416  if( codimAvailable( codim ) && onlySingleGeometryType )
417  {
418  if( codimUsed_[ codim ] )
419  return type == geomTypes( codim )[ 0 ] ? codimLeafSet( codim ).size() : 0;
420  }
421 
422  // count entities for given geometry type
423  IndexType count = 0 ;
424  ForLoop< CountElements, 0, dimension > :: apply( *this, type, count );
425  return count;
426  }
427 
429  IndexType size ( int codim ) const
430  {
431  assert( codim < numCodimensions );
432  if( intersectionCodimension > 0 && codim == intersectionCodimension )
433  {
434  return codimLeafSet( codim ).size();
435  }
436 
437  // count size for all geometry types
438  IndexType count = 0 ;
439  const size_t types = geomTypes( codim ).size();
440  for( size_t i=0; i<types; ++i )
441  {
442  count += size( geomTypes( codim )[ i ] );
443  }
444  return count ;
445  }
446 
448  const std::vector <GeometryType> & geomTypes (const int codim) const
449  {
450  assert( codim >= 0 && codim < int(geomTypes_.size()) );
451  return geomTypes_[ codim ];
452  }
453 
455  Types types( const int codim ) const
456  {
457  return geomTypes( codim );
458  }
459 
461  template <class EntityType>
462  bool contains (const EntityType & en) const
463  {
464  enum { codim = EntityType::codimension };
465  if( codimAvailable( codim ) )
466  {
467  assert( codimUsed_[codim] );
468  return codimLeafSet( codim ).exists( gridEntity( en ) );
469  }
470  else
471  return false;
472  }
473 
474  //****************************************************************
475  //
476  // METHODS for Adaptation with DofManger
477  //
478  //****************************************************************
479 
481  void insertEntity( const GridElementType &entity )
482  {
483  // here we have to add the support of higher codims
484  resizeVectors();
485  insertIndex( entity );
486  }
487 
489  void removeEntity( const GridElementType &entity )
490  {
491  removeIndex( entity );
492  }
493 
495  void resizeVectors ();
496 
498  void resize ()
499  {
500  resizeVectors();
501 
502  #if HAVE_MPI
503  if( CartesianNonAdaptiveGrid &&
504  grid_.comm().size() > 1 )
505  {
506  // only done for structured grids
507  clear();
508 
509  // this should only be the case of YaspGrid
510  markAllBelowOld<Interior_Partition>();
511  if( pitype > Interior_Partition )
512  {
513  markAllBelowOld< pitype >();
514  }
515  compressed_ = true;
516  }
517  else
518  #endif
519  {
520  // use a hierarchic walk to mark new elements
521  markAllBelowOld< pitype > ();
522 
523  #if HAVE_MPI
524  // only if ghost are really supported
525  if( pitype == All_Partition )
526  {
527  if( grid_.comm().size() > 1 )
528  {
529  // make sure that also ghosts have indices
530  markAllUsed<Ghost_Partition>();
531  }
532  }
533  #endif
534  }
535  }
536 
538  bool compress ();
539 
540  public:
542  // index methods
543  // --index
546  template< class Entity >
547  IndexType index ( const Entity &entity ) const
548  {
549  return index< Entity :: codimension >( entity );
550  }
551 
553  template< int codim >
554  IndexType
555  index ( const typename GridPartType::template Codim< codim >::EntityType &entity ) const
556  {
557  if( codimAvailable( codim ) )
558  {
559  if( (codim != 0) && ! codimUsed_[ codim ] )
560  setupCodimSet< codim >(std::integral_constant<bool,true>());
561 
562  return codimLeafSet( codim ).index( gridEntity( entity ) );
563  }
564  else
565  {
566  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
567  return -1;
568  }
569  }
570 
571  /* \brief return index for intersection */
572  IndexType index ( const IntersectionType &intersection ) const
573  {
574  enum { codim = intersectionCodimension };
575  if( codimAvailable( codim ) )
576  {
577  // this in only done on first call
578  setupIntersections();
579 
580  // get corresponding face entity pointer
581  FaceType face = getIntersectionFace( intersection );
582 
583  return codimLeafSet( codim ).index( gridEntity( face ) );
584  }
585  else
586  {
587  DUNE_THROW( NotImplemented, (name() + " does not support indices for intersections, intersectionCodim = ") << codim );
588  return -1;
589  }
590  }
591 
592  /* \brief return index for sub entity of given intersection and subEntityNumber */
593  IndexType
594  subIndex ( const IntersectionType &intersection,
595  int subNumber, unsigned int codim ) const
596  {
597  DUNE_THROW( NotImplemented, (name() + " does not support subIndices for intersections, intersectionCodim = ") << codim );
598  return -1;
599  }
600 
602  template< class Entity >
603  IndexType subIndex ( const Entity &entity, int subNumber, unsigned int codim ) const
604  {
605  return subIndex< Entity::codimension >( entity, subNumber, codim );
606  }
607 
609  template< int cd >
610  IndexType subIndex ( const typename GridPartType::template Codim< cd >::EntityType &entity,
611  int subNumber, unsigned int codim ) const
612  {
613  assert( (int( codim ) >= cd) && (int( codim ) <= dimension) );
614  if( !codimAvailable( codim ) )
615  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
616 
617  if( (codim != 0) && ! codimUsed_[ codim ] )
618  ForLoop< CallSetUpCodimSet, 0, dimension >::apply( codim, *this );
619 
620  const CodimIndexSetType &codimSet = codimLeafSet( codim );
621  const IndexType idx = codimSet.subIndex( gridEntity( entity ), subNumber );
622  assert( (idx >= 0) && (idx < IndexType( codimSet.size() )) );
623  return idx;
624  }
625 
627  //
628  // DoF adjustment methods, needed by AdaptiveDofMapper interface
629  //
631 
633  int numberOfHoles ( GeometryType type ) const
634  {
635  const int codim = dimension - type.dim();
636  assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
637  return numberOfHoles( codim );
638  }
639 
641  int numberOfHoles ( const int codim ) const
642  {
643  if( codimAvailable( codim ) && codimUsed_[codim] )
644  {
645  assert( codimUsed_[codim] );
646  return codimLeafSet( codim ).numberOfHoles();
647  }
648  else
649  return 0;
650  }
651 
653  int oldIndex ( int hole, GeometryType type ) const
654  {
655  const int codim = dimension - type.dim();
656  assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
657  return oldIndex( hole, codim );
658  }
659 
661  int oldIndex (const int hole, const int codim ) const
662  {
663  if( codimAvailable( codim ) )
664  {
665  assert( codimUsed_[codim] );
666  return codimLeafSet( codim ).oldIndex( hole );
667  }
668  else
669  {
670  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
671  return -1;
672  }
673  }
674 
676  int newIndex ( int hole, GeometryType type ) const
677  {
678  const int codim = dimension - type.dim();
679  assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
680  return newIndex( hole, codim );
681  }
682 
684  int newIndex (const int hole , const int codim ) const
685  {
686  if( codimAvailable( codim ) )
687  {
688  assert( codimUsed_[codim] );
689  return codimLeafSet( codim ).newIndex( hole );
690  }
691  else
692  {
693  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
694  return -1;
695  }
696  }
697 
698  protected:
699  // Note: The following methods forward to Dune::Fem::CodimIndexSet, which
700  // expects a Dune::Grid as template argument; all arguments passed to
701  // members of Dune::Fem::CodimIndexSet must be compatible with the
702  // template grid type. If entities returned by the grid and the grid part
703  // respectively differ in type, Dune::Fem::AdaptiveLeafIndexSetBase will
704  // call the necessary operations from grid part entities to grid entites.
705 
706  // memorise index
707  void insertIndex ( const GridElementType &entity );
708 
709  // memorise indices for all intersections
710  void insertIntersections ( const GridElementType &entity ) const;
711 
712  // insert index temporarily
713  void insertTemporary ( const GridElementType &entity );
714 
715  // set indices to unsed so that they are cleaned on compress
716  void removeIndex ( const GridElementType &entity );
717 
718  // check whether entity can be inserted or not
719  void checkHierarchy ( const GridElementType &entity, bool wasNew );
720 
721  // mark indices that are still used (and give new indices to new elements)
722  template <PartitionIteratorType pt>
723  void markAllUsed ();
724 
726  void clear();
727 
729  void setupIndexSet ();
730 
731  // give all entities that lie below the old entities new numbers
732  // here we need the hierarchic iterator because for example for some
733  // grid more the one level of new elements can be created during adaption
734  // there for we start to give new number for all elements below the old
735  // element
736  template <PartitionIteratorType pt>
737  void markAllBelowOld ();
738 
739  // mark indices that are still used (and give new indices to new elements)
740  template< int codim >
741  void setupCodimSet (const std::integral_constant<bool,true> &hasEntities) const;
742  template< int codim >
743  void setupCodimSet (const std::integral_constant<bool,false> &hasEntities) const;
744 
745  // mark indices that are still used (and give new indices to new intersections)
746  void setupIntersections () const;
747 
748  // count elements by iterating over grid and compare
749  // entities of given codim with given type
750  template< int codim >
751  inline IndexType countElements ( GeometryType type, const std::integral_constant<bool,true> &hasEntities ) const;
752  template< int codim >
753  inline IndexType countElements ( GeometryType type, const std::integral_constant<bool,false> &hasEntities ) const;
754 
755  public:
757  template< class StreamTraits >
758  bool write( OutStreamInterface< StreamTraits >& out ) const;
759 
761  template< class StreamTraits >
762  bool read( InStreamInterface< StreamTraits >& in );
763 
764  protected:
765  FaceType getIntersectionFace( const IntersectionType& intersection ) const
766  {
767  ElementType inside = make_entity( intersection.inside() );
768  return getIntersectionFace( intersection, inside );
769  }
770 
771  FaceType getIntersectionFace( const IntersectionType& intersection,
772  const ElementType& inside ) const
773  {
774  if( ! intersection.conforming() && intersection.neighbor() )
775  {
776  ElementType outside = make_entity( intersection.outside() );
777  // only if outside is more refined then inside
778  if( inside.level() < outside.level() )
779  return GetFaceEntity :: subEntity( outside, intersection.indexInOutside() );
780  }
781 
782  // default: get subentity of inside
783  return GetFaceEntity :: subEntity( inside, intersection.indexInInside() );
784  }
785  };
786 
787  template< class TraitsImp >
788  inline void
790  {
791  codimLeafSet( 0 ).resize();
792 
793  // if more than one codimension is supported
794  if( numCodimensions > 1 )
795  {
796  for( int codim = 1; codim < numCodimensions; ++codim )
797  {
798  if( codimUsed_[ codim ] )
799  codimLeafSet( codim ).resize();
800  }
801  }
802  }
803 
804 
805  // --compress
806  template< class TraitsImp >
807  inline bool
809  {
810  // reset list of holes in any case
811  for( int codim = 0; codim < numCodimensions; ++codim )
812  codimLeafSet( codim ).clearHoles();
813 
814  if( compressed_ )
815  {
816  // if set already compress, do noting for serial runs
817  // in parallel runs check sequence number of dof manager
818  if( (grid_.comm().size() == 1) || (sequence_ == dofManager_.sequence()) )
819  return false;
820  }
821 
822  // prepare index sets for setup
823  for( int codim = 0; codim < numCodimensions; ++codim )
824  {
825  codimLeafSet( codim ).prepareCompress();
826  }
827 
828  // mark all indices still needed
829  setupIndexSet();
830 
831  // true if a least one index is moved
832  bool haveToCopy = codimLeafSet( 0 ).compress();
833  for( int codim = 1; codim < numCodimensions; ++codim )
834  {
835  if( codimUsed_[ codim ] )
836  haveToCopy |= codimLeafSet( codim ).compress();
837  }
838 
839  // now status is compressed
840  compressed_ = true;
841  // update sequence number
842  sequence_ = dofManager_.sequence();
843 
844  return haveToCopy;
845  }
846 
847 
848  template< class TraitsImp >
849  inline void
851  {
852 #if HAVE_MPI
853  // we need special treatment for ghosts
854  // ghosts should not be inlcuded in holes list
855  if( entity.partitionType() == GhostEntity )
856  {
857  codimLeafSet( 0 ).insertGhost( entity );
858  const bool skipGhosts = (pitype != All_Partition);
859  // only for index sets upporting more than one codim
860  if( numCodimensions > 1 )
861  ForLoop< InsertGhostSubEntities, 1, dimension >::apply( *this, entity, skipGhosts );
862  }
863  else
864 #endif // HAVE_MPI
865  {
866  codimLeafSet( 0 ).insert( entity );
867  // only for index sets supporting more than one codim
868  if( numCodimensions > 1 )
869  ForLoop< InsertSubEntities, 1, dimension >::apply( *this, entity );
870 
871  }
872 
873  assert( codimLeafSet( 0 ).exists( entity ) );
874 
875  // insert intersections if this is enabled
876  if( intersectionCodimension > 0 )
877  {
878  insertIntersections( entity );
879  }
880 
881  // now consecutivity is no longer guaranteed
882  compressed_ = false;
883  }
884 
885  template< class TraitsImp >
886  inline void
888  {
889  codimLeafSet( intersectionCodimension ).resize();
890 
891  const ElementType &element = gridPart_.convert( gridElement );
892  const IntersectionIteratorType endiit = gridPart_.iend( element );
893  for( IntersectionIteratorType iit = gridPart_.ibegin( element );
894  iit != endiit ; ++ iit )
895  {
896  // get intersection
897  const IntersectionType& intersection = *iit ;
898 
899  // get correct face pointer
900  FaceType face = getIntersectionFace( intersection, element );
901 
902  // insert face into index set
903  codimLeafSet( intersectionCodimension ).insert( gridEntity( face ) );
904  }
905  }
906 
907  template< class TraitsImp >
908  inline void
910  {
911  insertIndex( entity );
912  codimLeafSet( 0 ).markForRemoval( entity );
913  }
914 
915  template< class TraitsImp >
916  inline void
918  {
919  // remove entities (only mark them as unused)
920  codimLeafSet( 0 ).markForRemoval( entity );
921 
922  // don't remove higher codim indices (will be done on compression
923 
924  // now consecutivity is no longer guaranteed
925  compressed_ = false;
926  }
927 
928 
929  template< class TraitsImp >
930  inline void
932  ::checkHierarchy ( const GridElementType &entity, bool wasNew )
933  {
934  bool isNew = wasNew ;
935  typedef typename GridType::HierarchicIterator HierarchicIterator;
936 
937  // for leaf entites, just insert the index
938  if( entity.isLeaf() )
939  {
940  insertIndex( entity );
941  return;
942  }
943 
944  if( isNew )
945  {
946  // this is a new entity, so insert it,
947  // but only temporarily because it's not a leaf entity
948  insertTemporary( entity );
949  }
950  else
951  {
952  // if we were a leaf entity, all children are new
953  isNew = codimLeafSet( 0 ).validIndex( entity );
954  }
955 
956  // entity has children and we need to go deeper
957  const int childLevel = entity.level() + 1;
958  const HierarchicIterator end = entity.hend( childLevel );
959  for( HierarchicIterator it = entity.hbegin( childLevel ); it != end; ++it )
960  checkHierarchy( *it, isNew );
961  }
962 
963 
964  template< class TraitsImp >
965  template< PartitionIteratorType pt >
966  inline void
968  {
969  // make correct size of vectors
970  resizeVectors();
971 
972  // mark all indices as unused
973  for( int codim = 0; codim < numCodimensions; ++codim )
974  {
975  if( codimUsed_[ codim ] )
976  codimLeafSet( codim ).resetUsed();
977  }
978 
979  typedef typename GridPartType
980  ::template Codim< 0 > :: template Partition< pt > :: IteratorType Iterator;
981 
982  const Iterator end = gridPart_.template end< 0, pt >();
983  for( Iterator it = gridPart_.template begin< 0, pt >(); it != end; ++it )
984  insertIndex( gridEntity( *it ) );
985  }
986 
987  template< class TraitsImp >
988  inline void
990  {
991  // for structured grids clear all information
992  // this in only done when setting up grids or after
993  // read of parallel data on serial grids
994  if( CartesianNonAdaptiveGrid )
995  {
996  // mark all indices as unused
997  for( int codim = 0; codim < numCodimensions; ++codim )
998  {
999  if( codimUsed_[ codim ] )
1000  {
1001  // clear all information
1002  codimLeafSet( codim ).clear();
1003  }
1004  }
1005  }
1006  }
1007 
1008  template< class TraitsImp >
1009  inline void
1011  {
1012  // only done for structured grids
1013  clear();
1014 
1015 #if HAVE_MPI
1016  // for YaspGrid we need all interior indices first
1017  // so we can use SGrid for the visualization :(
1018  if( CartesianNonAdaptiveGrid &&
1019  grid_.comm().size() > 1 )
1020  {
1021  // we should only get here for YaspGrid
1022  markAllUsed<Interior_Partition> ();
1023  if( pitype > Interior_Partition )
1024  markAllUsed< pitype >();
1025  }
1026  else
1027 #endif
1028  {
1029  // give all entities that lie on the leaf level new numbers
1030  markAllUsed< pitype > ();
1031  }
1032  }
1033 
1034  template< class TraitsImp >
1035  template< PartitionIteratorType pt >
1036  inline void
1038  {
1039  // mark all indices as unused
1040  for( int codim = 0; codim < numCodimensions; ++codim )
1041  {
1042  if( codimUsed_[ codim ] )
1043  codimLeafSet( codim ).resetUsed();
1044  }
1045 
1046  // get macro iterator
1047  typedef typename GridType :: template Partition< All_Partition > :: LevelGridView LevelGridView ;
1048  LevelGridView macroView = grid_.levelGridView( 0 );
1049 
1050  typedef typename LevelGridView::template Codim< 0 >::template Partition< pt >::Iterator Iterator;
1051  const Iterator macroend = macroView.template end< 0, pt >();
1052  for( Iterator macroit = macroView.template begin< 0, pt >();
1053  macroit != macroend; ++macroit )
1054  checkHierarchy( *macroit, false );
1055  }
1056 
1057 
1058  template< class TraitsImp >
1059  template< int codim >
1060  inline void
1061  AdaptiveIndexSetBase< TraitsImp >::setupCodimSet (const std::integral_constant<bool,true>&) const
1062  {
1063  // if codim is not available do nothing
1064  if( ! codimAvailable( codim ) ) return ;
1065 
1066  // resize if necessary
1067  codimLeafSet( codim ).resize();
1068 
1069  // walk over grid parts entity set and insert entities
1070  typedef typename GridPartType
1071  ::template Codim< codim >::template Partition< pitype > :: IteratorType Iterator;
1072 
1073  const Iterator end = gridPart_.template end< codim, pitype >();
1074  for( Iterator it = gridPart_.template begin< codim, pitype >(); it != end; ++it )
1075  codimLeafSet( codim ).insert( gridEntity( *it ) );
1076 
1077  // mark codimension as used
1078  codimUsed_[ codim ] = true;
1079  }
1080 
1081  template< class TraitsImp >
1082  template< int codim >
1083  inline void
1084  AdaptiveIndexSetBase< TraitsImp >::setupCodimSet (const std::integral_constant<bool,false>&) const
1085  {
1086  // if codim is not available do nothing
1087  if( ! codimAvailable( codim ) ) return ;
1088 
1089  // resize if necessary
1090  codimLeafSet( codim ).resize();
1091 
1092  typedef typename GridPartType
1093  ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1094 
1095  const Iterator end = gridPart_.template end< 0, pitype >();
1096  for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1097  {
1098  const ElementType& element = *it ;
1099  const GridElementType &gridElement = gridEntity( element );
1100  const int subEntities = gridElement.subEntities( codim );
1101  for (int i = 0; i < subEntities; ++i )
1102  {
1103  if (! codimLeafSet( codim ).exists( gridElement, i) )
1104  codimLeafSet( codim ).insertSubEntity( gridElement, i );
1105  }
1106  }
1107 
1108  // mark codimension as used
1109  codimUsed_[ codim ] = true;
1110  }
1111 
1112 
1113  template< class TraitsImp >
1114  inline void
1116  {
1117  // if intersectionCodimension < 0 then this feature is disabled
1118  if( intersectionCodimension < 0 ) return ;
1119 
1120  // do nothing if insections are already available
1121  if( codimUsed_[ intersectionCodimension ] ) return ;
1122 
1123  // resize if necessary
1124  codimLeafSet( intersectionCodimension ).resize();
1125 
1126  // walk over grid parts entity set and insert entities
1127  typedef typename GridPartType
1128  ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1129 
1130  const Iterator end = gridPart_.template end< 0, pitype >();
1131  for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1132  {
1133  // insert all intersections of this entity
1134  insertIntersections( gridEntity( *it ) );
1135  }
1136 
1137  // mark codimension as used
1138  codimUsed_[ intersectionCodimension ] = true;
1139  }
1140 
1141  template< class TraitsImp >
1142  template< int codim >
1144  AdaptiveIndexSetBase< TraitsImp >::countElements ( GeometryType type, const std::integral_constant<bool,true>& ) const
1145  {
1146  typedef typename GridPartType
1147  ::template Codim< codim > :: template Partition< pitype > :: IteratorType Iterator;
1148 
1149  const Iterator begin = gridPart_.template begin< codim, pitype >();
1150  const Iterator end = gridPart_.template end< codim, pitype >();
1151  IndexType count = 0;
1152  for( Iterator it = begin; it != end; ++it )
1153  {
1154  if( it->type() == type )
1155  {
1156  ++count;
1157  }
1158  }
1159  return count;
1160  }
1161 
1162  template< class TraitsImp >
1163  template< int codim >
1165  AdaptiveIndexSetBase< TraitsImp >::countElements ( GeometryType type, const std::integral_constant<bool,false>& ) const
1166  {
1167  // make sure codimension is enabled
1168  assert( codimAvailable( codim ) );
1169 
1170  // resize if necessary
1171  codimLeafSet( codim ).resize();
1172 
1173  typedef typename GridPartType
1174  ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1175 
1176  typedef typename GridPartType::ctype ctype;
1177 
1178  const Iterator end = gridPart_.template end< 0, pitype >();
1179  IndexType count = 0;
1180  for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1181  {
1182  const ElementType& element = *it ;
1183  const GridElementType &gridElement = gridEntity( element );
1184  const int subEntities = gridElement.subEntities( codim );
1185  for (int i=0; i < subEntities; ++i)
1186  {
1187  if (! codimLeafSet( codim ).exists( gridElement, i) )
1188  {
1189  codimLeafSet( codim ).insertSubEntity( gridElement,i );
1190  if ( Dune::ReferenceElements< ctype, dimension >::
1191  general( gridElement.type() ).type( i, codim ) == type )
1192  {
1193  ++count;
1194  }
1195  }
1196  }
1197  }
1198 
1199  // mark codimension as used
1200  codimUsed_[ codim ] = true;
1201 
1202  return count;
1203  }
1204 
1205 
1206  template< class TraitsImp >
1207  template< class StreamTraits >
1210  {
1211  // write name for indentification
1212  const std::string myname( name() );
1213  out << myname;
1214 
1215  // write number of codimensions
1216  out << numCodimensions ;
1217 
1218  // write whether codim is used
1219  for( int i = 0; i < numCodimensions; ++i )
1220  out << codimUsed_[ i ];
1221 
1222  // write all sets
1223  for( int i = 0; i < numCodimensions; ++i )
1224  {
1225  if( codimUsed_[ i ] )
1226  codimLeafSet( i ).write( out );
1227  }
1228 
1229  // if we got until here writing was sucessful
1230  return true;
1231  }
1232 
1233 
1234  template< class TraitsImp >
1235  template< class StreamTraits >
1238  {
1239  {
1240  // read name and check compatibility
1241  std::string storedName;
1242  in >> storedName;
1243 
1244  std::string myname( name() );
1245 
1246  if( myname != storedName )
1247  {
1248  size_t length = std::min( myname.size(), storedName.size() );
1249  // only print the first character of whatever storedName is
1250  std::string found = storedName.substr(0, length-1 );
1251  DUNE_THROW( InvalidStateException,
1252  "AdaptiveIndexSetBase::read: got " << found
1253  << " (expected " << myname << ")." );
1254  }
1255  }
1256 
1257  // read number of codimensions
1258  int numCodim;
1259  in >> numCodim;
1260 
1261  // make sure everything is correct
1262  assert( numCodim == numCodimensions );
1263 
1264  // read codim used
1265  for( int i = 0; i < numCodimensions; ++i )
1266  in >> codimUsed_[ i ];
1267 
1268  for( int i = 0; i < numCodimensions; ++i )
1269  {
1270  if( codimUsed_[ i ] )
1271  codimLeafSet( i ).read( in );
1272  }
1273 
1274  // in parallel runs we have to compress here
1275  if( grid_.comm().size() > 1 )
1276  compressed_ = false;
1277 
1278  // if we got until here reading was sucessful
1279  return true;
1280  }
1281 
1282 
1283 
1285  //
1286  // --AdaptiveLeafIndexSet
1287  //
1289 
1290  template< class GridPartImp >
1292  : public AdaptiveIndexSetBaseTraits< GridPartImp, AdaptiveLeafIndexSet< GridPartImp > >
1293  {
1294  // number of codimensions
1295  enum { numCodimensions = GridPartImp :: dimension + 1 };
1296  // first comdimension that is supported (not yet supported)
1297  enum { startingCodimension = 0 };
1298  // intersection codimensions (this is usually dimension + 1 )
1299  enum { intersectionCodimension = -1 };
1300  };
1301 
1313  template < class GridPartImp >
1314  class AdaptiveLeafIndexSet
1315  : public AdaptiveIndexSetBase< AdaptiveLeafIndexSetTraits< GridPartImp > >
1316  {
1319 
1320  public:
1321  typedef typename BaseType :: GridPartType GridPartType;
1323  AdaptiveLeafIndexSet (const GridPartType & gridPart)
1324  : BaseType(gridPart)
1325  {}
1326 
1328  virtual std::string name () const
1329  {
1330  return "AdaptiveLeafIndexSet";
1331  }
1332 
1333  bool compress ()
1334  {
1335  const bool compressed = BaseType::compress();
1336 
1337 #ifndef NDEBUG
1338  if( this->grid_.comm().size() == 1 )
1339  {
1340  for( int codim = Traits::startingCodimension; codim < Traits::numCodimensions; ++codim )
1341  assert( this->size( codim ) == this->grid_.size( codim ) );
1342  }
1343 #endif // #ifndef NDEBUG
1344 
1345  return compressed;
1346  }
1347  };
1348 
1349 
1351  //
1352  // --IntersectionAdaptiveLeafIndexSet
1353  //
1355 
1356  template< class GridPartImp >
1358  : public AdaptiveIndexSetBaseTraits< GridPartImp, IntersectionAdaptiveLeafIndexSet< GridPartImp > >
1359  {
1360  // number of codimensions
1361  enum { numCodimensions = GridPartImp :: dimension + 2 };
1362  // intersection codimensions (this is usually dimension + 1 )
1363  enum { intersectionCodimension = numCodimensions - 1 };
1364  // first comdimension that is supported (not yet supported)
1365  enum { startingCodimension = 0 };
1366  };
1367 
1379  template < class GridPartImp >
1381  : public AdaptiveIndexSetBase< IntersectionAdaptiveLeafIndexSetTraits< GridPartImp > >
1382  {
1385 
1386  public:
1387  typedef typename BaseType :: GridPartType GridPartType;
1389  IntersectionAdaptiveLeafIndexSet (const GridPartType & gridPart)
1390  : BaseType(gridPart)
1391  {}
1392 
1394  virtual std::string name () const
1395  {
1396  return "IntersectionAdaptiveLeafIndexSet";
1397  }
1398 
1399  bool compress ()
1400  {
1401  const bool compressed = BaseType::compress();
1402 
1403 #ifndef NDEBUG
1404  if( this->grid_.comm().size() == 1 )
1405  {
1406  for( int codim = Traits::startingCodimension; codim < Traits::numCodimensions; ++codim )
1407  if( codim != Traits::intersectionCodimension )
1408  assert( this->size( codim ) == this->grid_.size( codim ) );
1409  }
1410 #endif // #ifndef NDEBUG
1411 
1412  return compressed;
1413  }
1414  };
1415 
1417  //
1418  // --DGAdaptiveLeafIndexSet
1419  //
1421 
1422  template< class GridPartImp >
1424  : public AdaptiveIndexSetBaseTraits< GridPartImp, DGAdaptiveLeafIndexSet< GridPartImp > >
1425  {
1426  // this index set only supports one codimension, codim zero
1427  enum { numCodimensions = 1 };
1428  // first comdimension that is supported (not yet supported)
1429  enum { startingCodimension = 0 };
1430  // intersection codimensions (this is usually dimension + 1 )
1431  enum { intersectionCodimension = -1 };
1432  };
1433 
1444  template < class GridPartImp >
1446  : public AdaptiveIndexSetBase< DGAdaptiveLeafIndexSetTraits< GridPartImp > >
1447  {
1450 
1451  public:
1452  typedef typename BaseType :: GridPartType GridPartType;
1454  DGAdaptiveLeafIndexSet (const GridPartType & gridPart)
1455  : BaseType(gridPart)
1456  {}
1457 
1459  virtual std::string name () const
1460  {
1461  return "DGAdaptiveLeafIndexSet";
1462  }
1463 
1464  bool compress ()
1465  {
1466  const bool compressed = BaseType::compress();
1467 
1468 #ifndef NDEBUG
1469  if( this->grid_.comm().size() == 1 )
1470  assert( this->size( 0 ) == this->grid_.size( 0 ) );
1471 #endif // #ifndef NDEBUG
1472 
1473  return compressed;
1474  }
1475  };
1476 
1477  } // namespace Fem
1478 
1479 } // namespace Dune
1480 
1481 #endif // #ifndef DUNE_FEM_ADAPTIVELEAFINDEXSET_HH
Definition: persistentindexset.hh:24
int numberOfHoles(const int codim) const
return number of holes of the sets indices
Definition: adaptiveleafindexset.hh:641
CodimIndexSet< GridType > CodimIndexSetType
Definition: adaptiveleafindexset.hh:69
BaseType::IndexType IndexType
index type */
Definition: adaptiveleafindexset.hh:125
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1394
Definition: adaptiveleafindexset.hh:1423
Definition: misc/capabilities.hh:152
interface documentation for (grid part) index sets
Definition: common/indexset.hh:25
IndexType index(const IntersectionType &intersection) const
Definition: adaptiveleafindexset.hh:572
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1459
bool compress()
Definition: adaptiveleafindexset.hh:1464
static constexpr T min(T a)
Definition: utility.hh:81
void clear()
clear index set (only for structured grids)
Definition: adaptiveleafindexset.hh:989
GridPartType::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition: adaptiveleafindexset.hh:134
Definition: adaptiveleafindexset.hh:47
TraitsImp::CodimIndexSetType CodimIndexSetType
Definition: adaptiveleafindexset.hh:107
int newIndex(int hole, GeometryType type) const
return new index for given hole and type */
Definition: adaptiveleafindexset.hh:676
bool write(OutStreamInterface< StreamTraits > &out) const
please doc me */
Definition: adaptiveleafindexset.hh:1209
const std::vector< GeometryType > & geomTypes(const int codim) const
return vector of geometry types used of given codimension */
Definition: adaptiveleafindexset.hh:448
static const int dimension
Definition: adaptiveleafindexset.hh:59
IndexType subIndex(const Entity &entity, int subNumber, unsigned int codim) const
return index for given subentity */
Definition: adaptiveleafindexset.hh:603
IndexSet IndexSetType
Definition: adaptiveleafindexset.hh:51
CodimIndexSetType & codimLeafSet(const int codim) const
Definition: adaptiveleafindexset.hh:327
IndexType subIndex(const IntersectionType &intersection, int subNumber, unsigned int codim) const
Definition: adaptiveleafindexset.hh:594
void insertEntity(const GridElementType &entity)
please doc me */
Definition: adaptiveleafindexset.hh:481
IndexType index(const Entity &entity) const
return number of entities of given type */
Definition: adaptiveleafindexset.hh:547
void insertIntersections(const GridElementType &entity) const
Definition: adaptiveleafindexset.hh:887
GridPartType::template Codim< codim >::EntityType Entity
Definition: adaptiveleafindexset.hh:65
AdaptiveLeafIndexSet(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:1323
virtual ~AdaptiveIndexSetBase()
Destructor.
Definition: adaptiveleafindexset.hh:380
IndexType size(int codim) const
return number of entities of given type */
Definition: adaptiveleafindexset.hh:429
GridPartType::IntersectionType IntersectionType
type of intersections
Definition: adaptiveleafindexset.hh:137
BaseType::Types Types
geometry type range type */
Definition: adaptiveleafindexset.hh:128
void resize()
please doc me */
Definition: adaptiveleafindexset.hh:498
void setupCodimSet(const std::integral_constant< bool, true > &hasEntities) const
Definition: adaptiveleafindexset.hh:1061
bool read(InStreamInterface< StreamTraits > &in)
please doc me */
Definition: adaptiveleafindexset.hh:1237
consecutive, persistent index set for the leaf level based on the grid&#39;s hierarchy index set ...
Definition: adaptiveleafindexset.hh:35
void insertTemporary(const GridElementType &entity)
Definition: adaptiveleafindexset.hh:909
int newIndex(const int hole, const int codim) const
return new index, for dof manager only returns index
Definition: adaptiveleafindexset.hh:684
Dune::EntityPointer< Grid, Implementation >::Entity make_entity(const Dune::EntityPointer< Grid, Implementation > &entityPointer)
Definition: compatibility.hh:23
void setupIntersections() const
Definition: adaptiveleafindexset.hh:1115
GridPart GridPartType
Definition: adaptiveleafindexset.hh:54
GridPartType::GridType GridType
Definition: adaptiveleafindexset.hh:56
consecutive, persistent index set for the leaf level based on the grid&#39;s hierarchy index set ...
Definition: adaptiveleafindexset.hh:97
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:397
void markAllBelowOld()
Definition: adaptiveleafindexset.hh:1037
Definition: coordinate.hh:4
FaceType getIntersectionFace(const IntersectionType &intersection, const ElementType &inside) const
Definition: adaptiveleafindexset.hh:771
std::vector< GeometryType > Types
Definition: adaptiveleafindexset.hh:74
abstract interface for an input stream
Definition: streams.hh:177
IndexType countElements(GeometryType type, const std::integral_constant< bool, true > &hasEntities) const
Definition: adaptiveleafindexset.hh:1144
bool compress()
please doc me */
Definition: adaptiveleafindexset.hh:808
BaseType::template Codim< 0 >::Entity ElementType
type of codimension 0 Entity
Definition: adaptiveleafindexset.hh:131
bool codimAvailable(const int codim) const
Definition: adaptiveleafindexset.hh:322
int type() const
return type of index set, for GrapeDataIO
Definition: adaptiveleafindexset.hh:391
BaseType::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:1321
AdaptiveIndexSetBase(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:336
int numberOfHoles(GeometryType type) const
return number of holes for given type */
Definition: adaptiveleafindexset.hh:633
void insertIndex(const GridElementType &entity)
Definition: adaptiveleafindexset.hh:850
Definition: adaptiveleafindexset.hh:62
Definition: adaptiveleafindexset.hh:1357
CodimIndexSetType::IndexType IndexType
Definition: adaptiveleafindexset.hh:71
GridPartType::GridType GridType
Definition: adaptiveleafindexset.hh:105
bool compress()
Definition: adaptiveleafindexset.hh:1399
void removeIndex(const GridElementType &entity)
Definition: adaptiveleafindexset.hh:917
void resizeVectors()
reallocate the vector for new size
Definition: adaptiveleafindexset.hh:789
const GridEntityAccess< Entity >::GridEntityType & gridEntity(const Entity &entity)
Definition: gridpart.hh:410
Types types(const int codim) const
return range of geometry types */
Definition: adaptiveleafindexset.hh:455
BaseType::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:1452
bool contains(const EntityType &en) const
return true if entity has index */
Definition: adaptiveleafindexset.hh:462
consecutive, persistent index set for the leaf level based on the grid&#39;s hierarchy index set ...
Definition: adaptiveleafindexset.hh:31
BaseType::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:1387
void setupIndexSet()
mark all indices of interest
Definition: adaptiveleafindexset.hh:1010
Definition: codimindexset.hh:30
GridType::template Codim< 0 >::Entity GridElementType
Definition: adaptiveleafindexset.hh:109
IntersectionAdaptiveLeafIndexSetTraits< GridPartImp >::IndexType IndexType
index type
Definition: common/indexset.hh:123
IndexType size(GeometryType type) const
return number of entities of given type */
Definition: adaptiveleafindexset.hh:409
int IndexType
Definition: codimindexset.hh:46
DGAdaptiveLeafIndexSet(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:1454
TraitsImp::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:104
FaceType getIntersectionFace(const IntersectionType &intersection) const
Definition: adaptiveleafindexset.hh:765
Definition: adaptiveleafindexset.hh:33
IndexType index(const typename GridPartType::template Codim< codim >::EntityType &entity) const
return number of entities of given type */
Definition: adaptiveleafindexset.hh:555
int oldIndex(const int hole, const int codim) const
return old index, for dof manager only
Definition: adaptiveleafindexset.hh:661
IntersectionAdaptiveLeafIndexSetTraits< GridPartImp >::Types Types
geometry type range type
Definition: common/indexset.hh:126
IndexType subIndex(const typename GridPartType::template Codim< cd >::EntityType &entity, int subNumber, unsigned int codim) const
return index for given subentity */
Definition: adaptiveleafindexset.hh:610
void markAllUsed()
Definition: adaptiveleafindexset.hh:967
void removeEntity(const GridElementType &entity)
please doc me */
Definition: adaptiveleafindexset.hh:489
abstract interface for an output stream
Definition: streams.hh:44
IntersectionAdaptiveLeafIndexSet(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:1389
int oldIndex(int hole, GeometryType type) const
return old index for given hole and type */
Definition: adaptiveleafindexset.hh:653
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1328
Definition: adaptiveleafindexset.hh:1291
void checkHierarchy(const GridElementType &entity, bool wasNew)
Definition: adaptiveleafindexset.hh:932
bool compress()
Definition: adaptiveleafindexset.hh:1333