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