dune-fem  2.8-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 <memory>
11 #include <type_traits>
12 
14 
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 >
31  class AdaptiveLeafIndexSet;
32  template < class GridPartImp >
33  class IntersectionAdaptiveLeafIndexSet;
34  template < class GridPartImp >
35  class DGAdaptiveLeafIndexSet;
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 ( const 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( 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 && ! indexSet.codimUsed( cd ) )
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 && ! indexSet.codimUsed( cd ) )
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 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  // grid part (for iterator access, no index set)
302  const GridPartType& gridPart_;
303 
304  // pointer storage in case index set is created by passing a grid
305  std::unique_ptr< const GridPartType > gridPartPtr_;
306 
307  // Codimension leaf index sets
308  mutable std::unique_ptr< CodimIndexSetType > codimLeafSet_[ numCodimensions ];
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  // return true if indices for this codim exist
330  bool codimUsed( const int codim ) const
331  {
332  return codimAvailable( codim ) && codimLeafSet_[ codim ] ;
333  }
334 
335  CodimIndexSetType& codimLeafSet( const int codim ) const
336  {
337  assert( codimUsed( codim ) );
338  return *codimLeafSet_[ codim ];
339  }
340 
341  public:
342  void requestCodimensions ( const std::vector< int >& codimensions ) const
343  {
344  // enable requested codimensions and rebuild index set
345  for( const auto& codim : codimensions )
346  {
347  // start loop from 1 since codim 0 is always created
349  }
350  }
351 
354  : AdaptiveIndexSetBase( *(new GridPartType( const_cast< GridType& > (*grid), typename GridPartType::NoIndexSetType() )) )
355  {
356  // store pointer to avoid memory leaks
357  gridPartPtr_.reset( &gridPart_ );
358  }
359 
361  AdaptiveIndexSetBase ( const GridPartType& gridPart )
362  : BaseType( gridPart.grid() )
363  , gridPart_( gridPart )
364  , sequence_( dofManager_.sequence() )
365  , compressed_(true) // at start the set is compressed
366  {
367  // codim 0 is used by default
368  codimLeafSet_[ 0 ].reset( new CodimIndexSetType( grid_, 0 ) );
369 
370  // set the codim of each Codim Set.
371  for(int codim = 0; codim < numCodimensions; ++codim )
372  {
373  if( codim == intersectionCodimension )
374  codimLeafSet_[ codim ].reset( new CodimIndexSetType( grid_, 1 ) );
375  }
376 
378  {
379  // get level-0 view, this is already used in GridPtr (DFG parser)
380  typedef typename GridType :: LevelGridView MacroViewType;
381  MacroViewType macroView = grid_.levelGridView( 0 );
382  const typename MacroViewType :: IndexSet& indexSet = macroView.indexSet();
383 
384  // resize vector of geometry types
385  geomTypes_.resize( dimension+1 );
386  for(int codim=0; codim <= dimension; ++codim )
387  {
388  const int size = indexSet.types( codim ).size();
389  // copy geometry types
390  geomTypes_[ codim ].resize( size );
391  std::copy_n( indexSet.types( codim ).begin(), size, geomTypes_[ codim ].begin() );
392  }
393  }
394 
395  // build index set
396  setupIndexSet();
397  }
398 
400  int type () const
401  {
402  return myType;
403  }
404 
406  virtual std::string name () const
407  {
408  return "AdaptiveIndexSetBase";
409  }
410 
411  //****************************************************************
412  //
413  // INTERFACE METHODS for DUNE INDEX SETS
414  // --size
415  //
416  //****************************************************************
418  IndexType size ( GeometryType type ) const
419  {
420  const int codim = dimension - type.dim();
421 
422  // true if only one geometry type is present
423  const bool onlySingleGeometryType = hasSingleGeometryType || ( geomTypes( codim ).size() == 1 ) ;
424  // use size of codim index set if possible
425  if( codimAvailable( codim ) && onlySingleGeometryType )
426  {
427  if( codimUsed( codim ) )
428  return type == geomTypes( codim )[ 0 ] ? codimLeafSet( codim ).size() : 0;
429  }
430 
431  // count entities for given geometry type
432  IndexType count = 0 ;
434  return count;
435  }
436 
438  IndexType size ( int codim ) const
439  {
440  assert( codim < numCodimensions );
442  {
443  return codimLeafSet( codim ).size();
444  }
445 
446  // count size for all geometry types
447  IndexType count = 0 ;
448  const size_t types = geomTypes( codim ).size();
449  for( size_t i=0; i<types; ++i )
450  {
451  count += size( geomTypes( codim )[ i ] );
452  }
453  return count ;
454  }
455 
457  const std::vector <GeometryType> & geomTypes (const int codim) const
458  {
459  assert( codim >= 0 && codim < int(geomTypes_.size()) );
460  return geomTypes_[ codim ];
461  }
462 
464  Types types( const int codim ) const
465  {
466  return geomTypes( codim );
467  }
468 
470  template <class EntityType>
471  bool contains (const EntityType & en) const
472  {
473  enum { codim = EntityType::codimension };
474  if( codimAvailable( codim ) )
475  {
476  assert( codimUsed( codim ) );
477  return codimLeafSet( codim ).exists( gridEntity( en ) );
478  }
479  else
480  return false;
481  }
482 
483  //****************************************************************
484  //
485  // METHODS for Adaptation with DofManger
486  //
487  //****************************************************************
488 
490  void insertEntity( const GridElementType &entity )
491  {
492  // here we have to add the support of higher codims
493  resizeVectors();
494  insertIndex( entity );
495  }
496 
498  void removeEntity( const GridElementType &entity )
499  {
500  removeIndex( entity );
501  }
502 
504  void resizeVectors ();
505 
507  void resize ()
508  {
509  resizeVectors();
510 
511  #if HAVE_MPI
512  if( CartesianNonAdaptiveGrid &&
513  grid_.comm().size() > 1 )
514  {
515  // only done for structured grids
516  clear();
517 
518  // this should only be the case of YaspGrid
519  markAllBelowOld<Interior_Partition>();
520  if( pitype > Interior_Partition )
521  {
522  markAllBelowOld< pitype >();
523  }
524  compressed_ = true;
525  }
526  else
527  #endif
528  {
529  // use a hierarchic walk to mark new elements
530  markAllBelowOld< pitype > ();
531 
532  #if HAVE_MPI
533  // only if ghost are really supported
534  if( pitype == All_Partition )
535  {
536  if( grid_.comm().size() > 1 )
537  {
538  // make sure that also ghosts have indices
539  markAllUsed<Ghost_Partition>();
540  }
541  }
542  #endif
543  }
544  }
545 
547  bool compress ();
548 
549  public:
551  // index methods
552  // --index
555  template< class Entity >
556  IndexType index ( const Entity &entity ) const
557  {
558  return index< Entity :: codimension >( entity );
559  }
560 
562  template< int codim >
563  IndexType
564  index ( const typename GridPartType::template Codim< codim >::EntityType &entity ) const
565  {
566  if( codimAvailable( codim ) )
567  {
568  if( (codim != 0) && ! codimUsed( codim ) )
569  setupCodimSet< codim >(std::integral_constant<bool,Dune::Capabilities::hasEntity < GridType, codim > :: v>());
570 
571  return codimLeafSet( codim ).index( gridEntity( entity ) );
572  }
573  else
574  {
575  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
576  return -1;
577  }
578  }
579 
580  /* \brief return index for intersection */
581  IndexType index ( const IntersectionType &intersection ) const
582  {
583  enum { codim = intersectionCodimension };
584  if( codimAvailable( codim ) )
585  {
586  // this in only done on first call
588 
589  // get corresponding face entity pointer
590  FaceType face = getIntersectionFace( intersection );
591 
592  return codimLeafSet( codim ).index( gridEntity( face ) );
593  }
594  else
595  {
596  DUNE_THROW( NotImplemented, (name() + " does not support indices for intersections, intersectionCodim = ") << codim );
597  return -1;
598  }
599  }
600 
601  /* \brief return index for sub entity of given intersection and subEntityNumber */
602  IndexType
603  subIndex ( const IntersectionType &intersection,
604  int subNumber, unsigned int codim ) const
605  {
606  DUNE_THROW( NotImplemented, (name() + " does not support subIndices for intersections, intersectionCodim = ") << codim );
607  return -1;
608  }
609 
611  template< class Entity >
612  IndexType subIndex ( const Entity &entity, int subNumber, unsigned int codim ) const
613  {
614  return subIndex< Entity::codimension >( entity, subNumber, codim );
615  }
616 
618  template< int cd >
619  IndexType subIndex ( const typename GridPartType::template Codim< cd >::EntityType &entity,
620  int subNumber, unsigned int codim ) const
621  {
622  assert( (int( codim ) >= cd) && (int( codim ) <= dimension) );
623  if( !codimAvailable( codim ) )
624  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
625 
626  if( (codim != 0) && ! codimUsed( codim ) )
627  {
629  }
630 
631  const CodimIndexSetType &codimSet = codimLeafSet( codim );
632  const IndexType idx = codimSet.subIndex( gridEntity( entity ), subNumber );
633  assert( (idx >= 0) && (idx < IndexType( codimSet.size() )) );
634  return idx;
635  }
636 
638  //
639  // DoF adjustment methods, needed by AdaptiveDofMapper interface
640  //
642 
644  int numberOfHoles ( GeometryType type ) const
645  {
646  const int codim = dimension - type.dim();
647  // this index set works only with single geometry types adaptively
648  assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
649 
650  // if mapper is asking for types that are
651  // not in the index set then 0 should be returned
652  if( geomTypes( codim )[ 0 ] != type )
653  {
654  return 0;
655  }
656 
657  return numberOfHoles( codim );
658  }
659 
661  int numberOfHoles ( const int codim ) const
662  {
663  if( codimAvailable( codim ) && codimUsed( codim ) )
664  {
665  return codimLeafSet( codim ).numberOfHoles();
666  }
667  else
668  return 0;
669  }
670 
672  int oldIndex ( int hole, GeometryType type ) const
673  {
674  const int codim = dimension - type.dim();
675  assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
676  return oldIndex( hole, codim );
677  }
678 
680  int oldIndex (const int hole, const int codim ) const
681  {
682  if( codimAvailable( codim ) )
683  {
684  assert( codimUsed( codim ) );
685  return codimLeafSet( codim ).oldIndex( hole );
686  }
687  else
688  {
689  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
690  return -1;
691  }
692  }
693 
695  int newIndex ( int hole, GeometryType type ) const
696  {
697  const int codim = dimension - type.dim();
698  assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
699  return newIndex( hole, codim );
700  }
701 
703  int newIndex (const int hole , const int codim ) const
704  {
705  if( codimAvailable( codim ) )
706  {
707  assert( codimUsed( codim ) );
708  return codimLeafSet( codim ).newIndex( hole );
709  }
710  else
711  {
712  DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
713  return -1;
714  }
715  }
716 
717  protected:
718  // Note: The following methods forward to Dune::Fem::CodimIndexSet, which
719  // expects a Dune::Grid as template argument; all arguments passed to
720  // members of Dune::Fem::CodimIndexSet must be compatible with the
721  // template grid type. If entities returned by the grid and the grid part
722  // respectively differ in type, Dune::Fem::AdaptiveLeafIndexSetBase will
723  // call the necessary operations from grid part entities to grid entites.
724 
725  // memorise index
726  void insertIndex ( const GridElementType &entity );
727 
728  // memorise indices for all intersections
729  void insertIntersections ( const GridElementType &entity ) const;
730 
731  // insert index temporarily
732  void insertTemporary ( const GridElementType &entity );
733 
734  // set indices to unsed so that they are cleaned on compress
735  void removeIndex ( const GridElementType &entity );
736 
737  // check whether entity can be inserted or not
738  void checkHierarchy ( const GridElementType &entity, bool wasNew );
739 
740  // mark indices that are still used (and give new indices to new elements)
741  template <PartitionIteratorType pt>
742  void markAllUsed ();
743 
745  void clear();
746 
748  void setupIndexSet ();
749 
750  // give all entities that lie below the old entities new numbers
751  // here we need the hierarchic iterator because for example for some
752  // grid more the one level of new elements can be created during adaption
753  // there for we start to give new number for all elements below the old
754  // element
755  template <PartitionIteratorType pt>
757 
758  // mark indices that are still used (and give new indices to new elements)
759  template< int codim >
760  void setupCodimSet (const std::integral_constant<bool,true> &hasEntities) const;
761  template< int codim >
762  void setupCodimSet (const std::integral_constant<bool,false> &hasEntities) const;
763 
764  // mark indices that are still used (and give new indices to new intersections)
765  void setupIntersections () const;
766 
767  // count elements by iterating over grid and compare
768  // entities of given codim with given type
769  template< int codim >
770  inline IndexType countElements ( GeometryType type, const std::integral_constant<bool,true> &hasEntities ) const;
771  template< int codim >
772  inline IndexType countElements ( GeometryType type, const std::integral_constant<bool,false> &hasEntities ) const;
773 
774  public:
776  template< class StreamTraits >
778 
780  template< class StreamTraits >
782 
783  protected:
784  FaceType getIntersectionFace( const IntersectionType& intersection ) const
785  {
786  ElementType inside = intersection.inside();
787  return getIntersectionFace( intersection, inside );
788  }
789 
790  FaceType getIntersectionFace( const IntersectionType& intersection,
791  const ElementType& inside ) const
792  {
793  if( ! intersection.conforming() && intersection.neighbor() )
794  {
795  ElementType outside = intersection.outside();
796  // only if outside is more refined then inside
797  if( inside.level() < outside.level() )
798  return GetFaceEntity :: subEntity( outside, intersection.indexInOutside() );
799  }
800 
801  // default: get subentity of inside
802  return GetFaceEntity :: subEntity( inside, intersection.indexInInside() );
803  }
804  };
805 
806  template< class TraitsImp >
807  inline void
809  {
810  codimLeafSet( 0 ).resize();
811 
812  // if more than one codimension is supported
813  if( numCodimensions > 1 )
814  {
815  for( int codim = 1; codim < numCodimensions; ++codim )
816  {
817  if( codimUsed( codim ) )
818  codimLeafSet( codim ).resize();
819  }
820  }
821  }
822 
823 
824  // --compress
825  template< class TraitsImp >
826  inline bool
828  {
829  // reset list of holes in any case
830  for( int codim = 0; codim < numCodimensions; ++codim )
831  {
832  if( codimUsed( codim ) )
833  codimLeafSet( codim ).clearHoles();
834  }
835 
836  if( compressed_ )
837  {
838  // if set already compress, do noting for serial runs
839  // in parallel runs check sequence number of dof manager
840  if( (grid_.comm().size() == 1) || (sequence_ == dofManager_.sequence()) )
841  return false;
842  }
843 
844  // prepare index sets for setup
845  for( int codim = 0; codim < numCodimensions; ++codim )
846  {
847  if( codimUsed( codim ) )
848  codimLeafSet( codim ).prepareCompress();
849  }
850 
851  // mark all indices still needed
852  setupIndexSet();
853 
854  // true if a least one index is moved
855  bool haveToCopy = codimLeafSet( 0 ).compress();
856  for( int codim = 1; codim < numCodimensions; ++codim )
857  {
858  if( codimUsed( codim ) )
859  haveToCopy |= codimLeafSet( codim ).compress();
860  }
861 
862  // now status is compressed
863  compressed_ = true;
864  // update sequence number
865  sequence_ = dofManager_.sequence();
866 
867  return haveToCopy;
868  }
869 
870 
871  template< class TraitsImp >
872  inline void
874  {
875 #if HAVE_MPI
876  // we need special treatment for ghosts
877  // ghosts should not be inlcuded in holes list
878  if( entity.partitionType() == GhostEntity )
879  {
880  codimLeafSet( 0 ).insertGhost( entity );
881  const bool skipGhosts = (pitype != All_Partition);
882  // only for index sets upporting more than one codim
883  if( numCodimensions > 1 )
885  }
886  else
887 #endif // HAVE_MPI
888  {
889  codimLeafSet( 0 ).insert( entity );
890  // only for index sets supporting more than one codim
891  if( numCodimensions > 1 )
893 
894  }
895 
896  assert( codimLeafSet( 0 ).exists( entity ) );
897 
898  // insert intersections if this is enabled
899  if( intersectionCodimension > 0 )
900  {
901  insertIntersections( entity );
902  }
903 
904  // now consecutivity is no longer guaranteed
905  compressed_ = false;
906  }
907 
908  template< class TraitsImp >
909  inline void
911  {
912  codimLeafSet( intersectionCodimension ).resize();
913 
914  const ElementType &element = gridPart_.convert( gridElement );
915  const IntersectionIteratorType endiit = gridPart_.iend( element );
916  for( IntersectionIteratorType iit = gridPart_.ibegin( element );
917  iit != endiit ; ++ iit )
918  {
919  // get intersection
920  const IntersectionType& intersection = *iit ;
921 
922  // get correct face pointer
923  FaceType face = getIntersectionFace( intersection, element );
924 
925  // insert face into index set
926  codimLeafSet( intersectionCodimension ).insert( gridEntity( face ) );
927  }
928  }
929 
930  template< class TraitsImp >
931  inline void
933  {
934  insertIndex( entity );
935  codimLeafSet( 0 ).markForRemoval( entity );
936  }
937 
938  template< class TraitsImp >
939  inline void
941  {
942  // remove entities (only mark them as unused)
943  codimLeafSet( 0 ).markForRemoval( entity );
944 
945  // don't remove higher codim indices (will be done on compression
946 
947  // now consecutivity is no longer guaranteed
948  compressed_ = false;
949  }
950 
951 
952  template< class TraitsImp >
953  inline void
955  ::checkHierarchy ( const GridElementType &entity, bool wasNew )
956  {
957  bool isNew = wasNew ;
958  typedef typename GridType::HierarchicIterator HierarchicIterator;
959 
960  // for leaf entities, just insert the index
961  if( entity.isLeaf() )
962  {
963  insertIndex( entity );
964  return;
965  }
966 
967  if( isNew )
968  {
969  // this is a new entity, so insert it,
970  // but only temporarily because it's not a leaf entity
971  insertTemporary( entity );
972  }
973  else
974  {
975  // if we were a leaf entity, all children are new
976  isNew = codimLeafSet( 0 ).validIndex( entity );
977  }
978 
979  // entity has children and we need to go deeper
980  const int childLevel = entity.level() + 1;
981  const HierarchicIterator end = entity.hend( childLevel );
982  for( HierarchicIterator it = entity.hbegin( childLevel ); it != end; ++it )
983  checkHierarchy( *it, isNew );
984  }
985 
986 
987  template< class TraitsImp >
988  template< PartitionIteratorType pt >
989  inline void
991  {
992  // make correct size of vectors
993  resizeVectors();
994 
995  // mark all indices as unused
996  for( int codim = 0; codim < numCodimensions; ++codim )
997  {
998  if( codimUsed( codim ) )
999  codimLeafSet( codim ).resetUsed();
1000  }
1001 
1002  typedef typename GridPartType
1003  ::template Codim< 0 > :: template Partition< pt > :: IteratorType Iterator;
1004 
1005  const Iterator end = gridPart_.template end< 0, pt >();
1006  for( Iterator it = gridPart_.template begin< 0, pt >(); it != end; ++it )
1007  insertIndex( gridEntity( *it ) );
1008  }
1009 
1010  template< class TraitsImp >
1011  inline void
1013  {
1014  // for structured grids clear all information
1015  // this in only done when setting up grids or after
1016  // read of parallel data on serial grids
1017  if( CartesianNonAdaptiveGrid )
1018  {
1019  // mark all indices as unused
1020  for( int codim = 0; codim < numCodimensions; ++codim )
1021  {
1022  if( codimUsed( codim ) )
1023  {
1024  // clear all information
1025  codimLeafSet( codim ).clear();
1026  }
1027  }
1028  }
1029  }
1030 
1031  template< class TraitsImp >
1032  inline void
1034  {
1035  // only done for structured grids
1036  clear();
1037 
1038 #if HAVE_MPI
1039  // for YaspGrid we need all interior indices first
1040  if( CartesianNonAdaptiveGrid &&
1041  grid_.comm().size() > 1 )
1042  {
1043  // we should only get here for YaspGrid
1044  markAllUsed<Interior_Partition> ();
1045  if( pitype > Interior_Partition )
1046  markAllUsed< pitype >();
1047  }
1048  else
1049 #endif
1050  {
1051  // give all entities that lie on the leaf level new numbers
1052  markAllUsed< pitype > ();
1053  }
1054  }
1055 
1056  template< class TraitsImp >
1057  template< PartitionIteratorType pt >
1058  inline void
1060  {
1061  // mark all indices as unused
1062  for( int codim = 0; codim < numCodimensions; ++codim )
1063  {
1064  if( codimUsed( codim ) )
1065  codimLeafSet( codim ).resetUsed();
1066  }
1067 
1068  // get macro iterator
1069  typedef typename GridType::LevelGridView LevelGridView;
1070  LevelGridView macroView = grid_.levelGridView( 0 );
1071 
1072  typedef typename LevelGridView::template Codim< 0 >::template Partition< pt >::Iterator Iterator;
1073  const Iterator macroend = macroView.template end< 0, pt >();
1074  for( Iterator macroit = macroView.template begin< 0, pt >();
1075  macroit != macroend; ++macroit )
1076  checkHierarchy( *macroit, false );
1077  }
1078 
1079 
1080  template< class TraitsImp >
1081  template< int codim >
1082  inline void
1083  AdaptiveIndexSetBase< TraitsImp >::setupCodimSet (const std::integral_constant<bool,true>&) const
1084  {
1085  // if codim is not available do nothing
1086  if( ! codimAvailable( codim ) ) return ;
1087 
1088  // create codimLeafSet if not existing
1089  if( ! codimLeafSet_[ codim ] )
1090  {
1091  codimLeafSet_[ codim ].reset( new CodimIndexSetType( grid_, codim ) );
1092  }
1093 
1094  // resize if necessary
1095  codimLeafSet( codim ).resize();
1096 
1097  // walk over grid parts entity set and insert entities
1098  typedef typename GridPartType
1099  ::template Codim< codim >::template Partition< pitype > :: IteratorType Iterator;
1100 
1101  const Iterator end = gridPart_.template end< codim, pitype >();
1102  for( Iterator it = gridPart_.template begin< codim, pitype >(); it != end; ++it )
1103  codimLeafSet( codim ).insert( gridEntity( *it ) );
1104  }
1105 
1106  template< class TraitsImp >
1107  template< int codim >
1108  inline void
1109  AdaptiveIndexSetBase< TraitsImp >::setupCodimSet (const std::integral_constant<bool,false>&) const
1110  {
1111  // if codim is not available do nothing
1112  if( ! codimAvailable( codim ) ) return ;
1113 
1114  // create codimLeafSet if not existing
1115  if( ! codimLeafSet_[ codim ] )
1116  {
1117  codimLeafSet_[ codim ].reset( new CodimIndexSetType( grid_, codim ) );
1118  }
1119 
1120  // resize if necessary
1121  codimLeafSet( codim ).resize();
1122 
1123  typedef typename GridPartType
1124  ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1125 
1126  const Iterator end = gridPart_.template end< 0, pitype >();
1127  for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1128  {
1129  const ElementType& element = *it ;
1130  const GridElementType &gridElement = gridEntity( element );
1131  InsertSubEntities< codim >::apply( *this, gridElement );
1132  }
1133  }
1134 
1135 
1136  template< class TraitsImp >
1137  inline void
1139  {
1140  // if intersectionCodimension < 0 then this feature is disabled
1141  if( intersectionCodimension < 0 ) return ;
1142 
1143  // do nothing if insections are already available
1144  if( codimUsed( intersectionCodimension ) ) return ;
1145 
1146  // resize if necessary
1147  codimLeafSet( intersectionCodimension ).resize();
1148 
1149  // walk over grid parts entity set and insert entities
1150  typedef typename GridPartType
1151  ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1152 
1153  const Iterator end = gridPart_.template end< 0, pitype >();
1154  for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1155  {
1156  // insert all intersections of this entity
1157  insertIntersections( gridEntity( *it ) );
1158  }
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  if( ! codimLeafSet_[ codim ] )
1188  return 0;
1189 
1190  // make sure codimension is enabled
1191  assert( codimAvailable( codim ) );
1192 
1193  // resize if necessary
1194  codimLeafSet( codim ).resize();
1195 
1196  typedef typename GridPartType
1197  ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1198 
1199  typedef typename GridPartType::ctype ctype;
1200 
1201  const Iterator end = gridPart_.template end< 0, pitype >();
1202  IndexType count = 0;
1203  for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1204  {
1205  const ElementType& element = *it ;
1206  const GridElementType &gridElement = gridEntity( element );
1207  const int subEntities = gridElement.subEntities( codim );
1208  for (int i=0; i < subEntities; ++i)
1209  {
1210  if (! codimLeafSet( codim ).exists( gridElement, i) )
1211  {
1212  codimLeafSet( codim ).insertSubEntity( gridElement,i );
1213  if ( Dune::ReferenceElements< ctype, dimension >::
1214  general( gridElement.type() ).type( i, codim ) == type )
1215  {
1216  ++count;
1217  }
1218  }
1219  }
1220  }
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  if( numCodim != numCodimensions )
1284  DUNE_THROW(InvalidStateException,"AdaptiveIndexSetBase::read: got wrong number of codimensions" << numCodim << " instead of " << numCodimensions);
1285 
1286  // read codim used
1287  for( int i = 0; i < numCodimensions; ++i )
1288  {
1289  bool codimInUse = false ;
1290  in >> codimInUse;
1291  if( codimInUse && ! codimLeafSet_[ i ] )
1292  {
1293  codimLeafSet_[ i ].reset( new CodimIndexSetType( grid_, (i == intersectionCodimension ) ? 1 : i ) );
1294  }
1295  }
1296 
1297  for( int i = 0; i < numCodimensions; ++i )
1298  {
1299  if( codimUsed( i ) )
1300  codimLeafSet( i ).read( in );
1301  }
1302 
1303  // in parallel runs we have to compress here
1304  if( grid_.comm().size() > 1 )
1305  compressed_ = false;
1306 
1307  // if we got until here reading was sucessful
1308  return true;
1309  }
1310 
1311 
1312 
1314  //
1315  // --AdaptiveLeafIndexSet
1316  //
1318 
1319  template< class GridPartImp >
1321  : public AdaptiveIndexSetBaseTraits< GridPartImp, AdaptiveLeafIndexSet< GridPartImp > >
1322  {
1323  // number of codimensions
1324  enum { numCodimensions = GridPartImp :: dimension + 1 };
1325  // first comdimension that is supported (not yet supported)
1326  enum { startingCodimension = 0 };
1327  // intersection codimensions (this is usually dimension + 1 )
1329  };
1330 
1342  template < class GridPartImp >
1344  : public AdaptiveIndexSetBase< AdaptiveLeafIndexSetTraits< GridPartImp > >
1345  {
1348 
1349  public:
1350  typedef typename BaseType :: GridType GridType;
1352 
1355  : BaseType(grid)
1356  {}
1357 
1360  : BaseType(gridPart)
1361  {}
1362 
1364  virtual std::string name () const
1365  {
1366  return "AdaptiveLeafIndexSet";
1367  }
1368 
1369  bool compress ()
1370  {
1371  const bool compressed = BaseType::compress();
1372 
1373 #ifndef NDEBUG
1374  if( this->grid_.comm().size() == 1 )
1375  {
1376  for( int codim = Traits::startingCodimension; codim < Traits::numCodimensions; ++codim )
1377  assert( this->codimUsed( codim ) ? this->size( codim ) == this->grid_.size( codim ) : true );
1378  }
1379 #endif // #ifndef NDEBUG
1380 
1381  return compressed;
1382  }
1383  };
1384 
1385 
1387  //
1388  // --IntersectionAdaptiveLeafIndexSet
1389  //
1391 
1392  template< class GridPartImp >
1394  : public AdaptiveIndexSetBaseTraits< GridPartImp, IntersectionAdaptiveLeafIndexSet< GridPartImp > >
1395  {
1396  // number of codimensions
1397  enum { numCodimensions = GridPartImp :: dimension + 2 };
1398  // intersection codimensions (this is usually dimension + 1 )
1400  // first comdimension that is supported (not yet supported)
1401  enum { startingCodimension = 0 };
1402  };
1403 
1415  template < class GridPartImp >
1417  : public AdaptiveIndexSetBase< IntersectionAdaptiveLeafIndexSetTraits< GridPartImp > >
1418  {
1421 
1422  public:
1423  typedef typename BaseType :: GridType GridType;
1427  : BaseType(grid)
1428  {}
1429 
1432  : BaseType(gridPart)
1433  {}
1434 
1436  virtual std::string name () const
1437  {
1438  return "IntersectionAdaptiveLeafIndexSet";
1439  }
1440 
1441  bool compress ()
1442  {
1443  const bool compressed = BaseType::compress();
1444 
1445 #ifndef NDEBUG
1446  if( this->grid_.comm().size() == 1 )
1447  {
1448  for( int codim = Traits::startingCodimension; codim < Traits::numCodimensions; ++codim )
1449  if( codim != Traits::intersectionCodimension )
1450  assert( this->size( codim ) == this->grid_.size( codim ) );
1451  }
1452 #endif // #ifndef NDEBUG
1453 
1454  return compressed;
1455  }
1456  };
1457 
1459  //
1460  // --DGAdaptiveLeafIndexSet
1461  //
1463 
1464  template< class GridPartImp >
1466  : public AdaptiveIndexSetBaseTraits< GridPartImp, DGAdaptiveLeafIndexSet< GridPartImp > >
1467  {
1468  // this index set only supports one codimension, codim zero
1469  enum { numCodimensions = 1 };
1470  // first comdimension that is supported (not yet supported)
1471  enum { startingCodimension = 0 };
1472  // intersection codimensions (this is usually dimension + 1 )
1474  };
1475 
1486  template < class GridPartImp >
1488  : public AdaptiveIndexSetBase< DGAdaptiveLeafIndexSetTraits< GridPartImp > >
1489  {
1492 
1493  public:
1494  typedef typename BaseType :: GridType GridType;
1498  : BaseType(grid)
1499  {}
1500 
1502  : BaseType(gridPart)
1503  {}
1504 
1506  virtual std::string name () const
1507  {
1508  return "DGAdaptiveLeafIndexSet";
1509  }
1510 
1511  bool compress ()
1512  {
1513  const bool compressed = BaseType::compress();
1514 
1515 #ifndef NDEBUG
1516  if( this->grid_.comm().size() == 1 )
1517  assert( this->size( 0 ) == this->grid_.size( 0 ) );
1518 #endif // #ifndef NDEBUG
1519 
1520  return compressed;
1521  }
1522  };
1523 
1524  } // namespace Fem
1525 
1526 } // namespace Dune
1527 
1528 #endif // #ifndef DUNE_FEM_ADAPTIVELEAFINDEXSET_HH
Definition: bindguard.hh:11
const GridEntityAccess< Entity >::GridEntityType & gridEntity(const Entity &entity)
Definition: gridpart.hh:412
typename Impl::Index< Range >::Type IndexType
Definition: hybrid.hh:69
static constexpr T min(T a)
Definition: utility.hh:93
static DUNE_PRIVATE void apply(Args &&... args)
Definition: forloop.hh:23
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:1345
BaseType ::GridType GridType
Definition: adaptiveleafindexset.hh:1350
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1364
AdaptiveLeafIndexSet(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:1354
BaseType ::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:1351
bool compress()
Definition: adaptiveleafindexset.hh:1369
AdaptiveLeafIndexSet(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:1359
Definition: adaptiveleafindexset.hh:1418
bool compress()
Definition: adaptiveleafindexset.hh:1441
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1436
IntersectionAdaptiveLeafIndexSet(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:1431
BaseType ::GridType GridType
Definition: adaptiveleafindexset.hh:1423
IntersectionAdaptiveLeafIndexSet(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:1426
BaseType ::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:1424
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:1489
BaseType ::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:1495
DGAdaptiveLeafIndexSet(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:1497
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1506
DGAdaptiveLeafIndexSet(const GridPartType &gridPart)
Definition: adaptiveleafindexset.hh:1501
BaseType ::GridType GridType
Definition: adaptiveleafindexset.hh:1494
bool compress()
Definition: adaptiveleafindexset.hh:1511
Definition: adaptiveleafindexset.hh:48
GridPartType ::GridType GridType
Definition: adaptiveleafindexset.hh:56
std::vector< GeometryType > Types
Definition: adaptiveleafindexset.hh:74
GridPart GridPartType
Definition: adaptiveleafindexset.hh:54
CodimIndexSetType ::IndexType IndexType
Definition: adaptiveleafindexset.hh:71
static const int dimension
Definition: adaptiveleafindexset.hh:59
CodimIndexSet< GridType > CodimIndexSetType
Definition: adaptiveleafindexset.hh:69
IndexSet IndexSetType
Definition: adaptiveleafindexset.hh:51
Definition: adaptiveleafindexset.hh:63
GridPartType ::template Codim< codim >::EntityType Entity
Definition: adaptiveleafindexset.hh:65
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:99
GridType::template Codim< 0 >::Entity GridElementType
Definition: adaptiveleafindexset.hh:109
BaseType ::Types Types
geometry type range type *‍/
Definition: adaptiveleafindexset.hh:128
void removeIndex(const GridElementType &entity)
Definition: adaptiveleafindexset.hh:940
void requestCodimensions(const std::vector< int > &codimensions) const
Definition: adaptiveleafindexset.hh:342
GridPartType ::GridType GridType
Definition: adaptiveleafindexset.hh:105
IndexType subIndex(const typename GridPartType::template Codim< cd >::EntityType &entity, int subNumber, unsigned int codim) const
return index for given subentity *‍/
Definition: adaptiveleafindexset.hh:619
AdaptiveIndexSetBase(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:361
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:406
void insertEntity(const GridElementType &entity)
please doc me *‍/
Definition: adaptiveleafindexset.hh:490
IndexType index(const Entity &entity) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:556
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:703
bool read(InStreamInterface< StreamTraits > &in)
please doc me *‍/
Definition: adaptiveleafindexset.hh:1257
GridPartType ::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition: adaptiveleafindexset.hh:134
IndexType subIndex(const Entity &entity, int subNumber, unsigned int codim) const
return index for given subentity *‍/
Definition: adaptiveleafindexset.hh:612
IndexType index(const typename GridPartType::template Codim< codim >::EntityType &entity) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:564
void setupIndexSet()
mark all indices of interest
Definition: adaptiveleafindexset.hh:1033
FaceType getIntersectionFace(const IntersectionType &intersection, const ElementType &inside) const
Definition: adaptiveleafindexset.hh:790
void insertIntersections(const GridElementType &entity) const
Definition: adaptiveleafindexset.hh:910
IndexType countElements(GeometryType type, const std::integral_constant< bool, false > &hasEntities) const
Definition: adaptiveleafindexset.hh:1185
void resize()
please doc me *‍/
Definition: adaptiveleafindexset.hh:507
int oldIndex(int hole, GeometryType type) const
return old index for given hole and type *‍/
Definition: adaptiveleafindexset.hh:672
void markAllBelowOld()
Definition: adaptiveleafindexset.hh:1059
int numberOfHoles(GeometryType type) const
return number of holes for given type *‍/
Definition: adaptiveleafindexset.hh:644
const std::vector< GeometryType > & geomTypes(const int codim) const
*‍/
Definition: adaptiveleafindexset.hh:457
void setupCodimSet(const std::integral_constant< bool, true > &hasEntities) const
Definition: adaptiveleafindexset.hh:1083
void insertTemporary(const GridElementType &entity)
Definition: adaptiveleafindexset.hh:932
Types types(const int codim) const
return range of geometry types *‍/
Definition: adaptiveleafindexset.hh:464
int numberOfHoles(const int codim) const
return number of holes of the sets indices
Definition: adaptiveleafindexset.hh:661
AdaptiveIndexSetBase(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:353
void removeEntity(const GridElementType &entity)
please doc me *‍/
Definition: adaptiveleafindexset.hh:498
static const int intersectionCodimension
intersection codimension (numCodim-1 if enabled, otherwise -1)
Definition: adaptiveleafindexset.hh:119
void markAllUsed()
Definition: adaptiveleafindexset.hh:990
int oldIndex(const int hole, const int codim) const
return old index, for dof manager only
Definition: adaptiveleafindexset.hh:680
void resizeVectors()
reallocate the vector for new size
Definition: adaptiveleafindexset.hh:808
static const int dimension
grid dimension *‍/
Definition: adaptiveleafindexset.hh:113
CodimIndexSetType & codimLeafSet(const int codim) const
Definition: adaptiveleafindexset.hh:335
BaseType ::IndexType IndexType
index type *‍/
Definition: adaptiveleafindexset.hh:125
FaceType getIntersectionFace(const IntersectionType &intersection) const
Definition: adaptiveleafindexset.hh:784
TraitsImp ::GridPartType GridPartType
Definition: adaptiveleafindexset.hh:104
IndexType subIndex(const IntersectionType &intersection, int subNumber, unsigned int codim) const
Definition: adaptiveleafindexset.hh:603
void checkHierarchy(const GridElementType &entity, bool wasNew)
Definition: adaptiveleafindexset.hh:955
BaseType ::template Codim< 0 >::Entity ElementType
type of codimension 0 Entity
Definition: adaptiveleafindexset.hh:131
bool contains(const EntityType &en) const
return true if entity has index *‍/
Definition: adaptiveleafindexset.hh:471
TraitsImp ::CodimIndexSetType CodimIndexSetType
Definition: adaptiveleafindexset.hh:107
void setupIntersections() const
Definition: adaptiveleafindexset.hh:1138
void insertIndex(const GridElementType &entity)
Definition: adaptiveleafindexset.hh:873
bool write(OutStreamInterface< StreamTraits > &out) const
please doc me *‍/
Definition: adaptiveleafindexset.hh:1229
GridPartType ::IntersectionType IntersectionType
type of intersections
Definition: adaptiveleafindexset.hh:137
bool codimUsed(const int codim) const
Definition: adaptiveleafindexset.hh:330
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:1012
static const int numCodimensions
number of supported codimensions
Definition: adaptiveleafindexset.hh:116
IndexType index(const IntersectionType &intersection) const
Definition: adaptiveleafindexset.hh:581
IndexType size(int codim) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:438
void setupCodimSet(const std::integral_constant< bool, false > &hasEntities) const
Definition: adaptiveleafindexset.hh:1109
IndexType size(GeometryType type) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:418
bool compress()
please doc me *‍/
Definition: adaptiveleafindexset.hh:827
int type() const
return type of index set, for GrapeDataIO
Definition: adaptiveleafindexset.hh:400
static const bool hasSingleGeometryType
true if only one geometry type is available
Definition: adaptiveleafindexset.hh:122
int newIndex(int hole, GeometryType type) const
return new index for given hole and type *‍/
Definition: adaptiveleafindexset.hh:695
Definition: adaptiveleafindexset.hh:1322
@ intersectionCodimension
Definition: adaptiveleafindexset.hh:1328
@ numCodimensions
Definition: adaptiveleafindexset.hh:1324
@ startingCodimension
Definition: adaptiveleafindexset.hh:1326
Definition: adaptiveleafindexset.hh:1395
@ intersectionCodimension
Definition: adaptiveleafindexset.hh:1399
@ startingCodimension
Definition: adaptiveleafindexset.hh:1401
@ numCodimensions
Definition: adaptiveleafindexset.hh:1397
Definition: adaptiveleafindexset.hh:1467
@ numCodimensions
Definition: adaptiveleafindexset.hh:1469
@ intersectionCodimension
Definition: adaptiveleafindexset.hh:1473
@ startingCodimension
Definition: adaptiveleafindexset.hh:1471
Definition: codimindexset.hh:29
int IndexType
Definition: codimindexset.hh:44
interface documentation for (grid part) index sets
Definition: common/indexset.hh:104
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