DUNE-FEM (unstable)

adaptiveleafindexset.hh
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
13#include <dune/fem/common/forloop.hh>
14
15#include <dune/fem/gridpart/codimindexset.hh>
16#include <dune/fem/gridpart/common/gridpart.hh>
17#include <dune/fem/gridpart/common/persistentindexset.hh>
18#include <dune/fem/io/file/iointerface.hh>
19#include <dune/fem/version.hh>
20
21namespace 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 >
47 class AdaptiveIndexSetBaseTraits
48 {
49 public:
50 // index set type derived from AdaptiveIndexSetBase
51 typedef IndexSet IndexSetType;
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
69 typedef CodimIndexSet< GridType > CodimIndexSetType;
70 // index type used
71 typedef typename CodimIndexSetType :: IndexType IndexType;
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 {
101 typedef PersistentAdaptiveIndexSet< TraitsImp > BaseType;
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
123
125 typedef typename BaseType :: IndexType IndexType;
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 // TODO: hasEntity should be replaced by hasEntityIterator here
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 &&
290 ! Capabilities::isLocallyAdaptive<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
348 Fem::ForLoop< CallSetUpCodimSet, 1, dimension >::apply( codim, *this );
349 }
350 }
351
353 AdaptiveIndexSetBase ( const GridType* grid )
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
377 {
378 // get level-0 view, this is already used in GridPtr (DFG parser)
379 auto macroView = grid_.levelGridView( 0 );
380 setupGeomTypes( macroView.indexSet() );
381 }
382
383 // build index set
385 }
386
387 protected:
388 template <class MacroIndexSet>
389 void setupGeomTypes(const MacroIndexSet& indexSet)
390 {
392 // resize vector of geometry types
393 geomTypes_.resize( dimension+1 );
394 for(int codim=0; codim <= dimension; ++codim )
395 {
396 const int size = indexSet.types( codim ).size();
397 // copy geometry types
398 geomTypes_[ codim ].resize( size );
399 std::copy_n( indexSet.types( codim ).begin(), size, geomTypes_[ codim ].begin() );
400 }
401 }
402
403 public:
405 int type () const
406 {
407 return myType;
408 }
409
411 virtual std::string name () const
412 {
413 return "AdaptiveIndexSetBase";
414 }
415
417 const GridPartType& gridPart() const
418 {
419 return gridPart_;
420 }
421
422 //****************************************************************
423 //
424 // INTERFACE METHODS for DUNE INDEX SETS
425 // --size
426 //
427 //****************************************************************
430 {
431 const int codim = dimension - type.dim();
432
433 // true if only one geometry type is present
434 const bool onlySingleGeometryType = hasSingleGeometryType || ( geomTypes( codim ).size() == 1 ) ;
435 // use size of codim index set if possible
436 if( codimAvailable( codim ) && onlySingleGeometryType )
437 {
438 if( codimUsed( codim ) )
439 return type == geomTypes( codim )[ 0 ] ? codimLeafSet( codim ).size() : 0;
440 }
441
442 // count entities for given geometry type
443 IndexType count = 0 ;
444 Fem::ForLoop< CountElements, 0, dimension > :: apply( *this, type, count );
445 return count;
446 }
447
449 IndexType size ( int codim ) const
450 {
451 assert( codim < numCodimensions );
453 {
454 return codimLeafSet( codim ).size();
455 }
456
457 // count size for all geometry types
458 IndexType count = 0 ;
459 const size_t types = geomTypes( codim ).size();
460 for( size_t i=0; i<types; ++i )
461 {
462 count += size( geomTypes( codim )[ i ] );
463 }
464 return count ;
465 }
466
468 const std::vector <GeometryType> & geomTypes (const int codim) const
469 {
470 assert( codim >= 0 && codim < int(geomTypes_.size()) );
471 return geomTypes_[ codim ];
472 }
473
475 Types types( const int codim ) const
476 {
477 return geomTypes( codim );
478 }
479
481 template <class EntityType>
482 bool contains (const EntityType & en) const
483 {
484 enum { codim = EntityType::codimension };
485 if( codimAvailable( codim ) )
486 {
487 assert( codimUsed( codim ) );
488 return codimLeafSet( codim ).exists( gridEntity( en ) );
489 }
490 else
491 return false;
492 }
493
494 //****************************************************************
495 //
496 // METHODS for Adaptation with DofManger
497 //
498 //****************************************************************
499
501 void insertEntity( const GridElementType &entity )
502 {
503 // here we have to add the support of higher codims
505 insertIndex( entity );
506 }
507
509 void removeEntity( const GridElementType &entity )
510 {
511 removeIndex( entity );
512 }
513
516
518 void resize ()
519 {
521
522 #if HAVE_MPI
523 if( CartesianNonAdaptiveGrid &&
524 grid_.comm().size() > 1 )
525 {
526 // only done for structured grids
527 clear();
528
529 // this should only be the case of YaspGrid
530 markAllBelowOld<Interior_Partition>();
531 if( pitype > Interior_Partition )
532 {
533 markAllBelowOld< pitype >();
534 }
535 compressed_ = true;
536 }
537 else
538 #endif
539 {
540 // use a hierarchic walk to mark new elements
541 markAllBelowOld< pitype > ();
542
543 #if HAVE_MPI
544 // only if ghost are really supported
545 if( pitype == All_Partition )
546 {
547 if( grid_.comm().size() > 1 )
548 {
549 // make sure that also ghosts have indices
550 markAllUsed<Ghost_Partition>();
551 }
552 }
553 #endif
554 }
555 }
556
558 bool compress ();
559
560 public:
562 // index methods
563 // --index
566 template< class Entity >
567 IndexType index ( const Entity &entity ) const
568 {
569 return index< Entity :: codimension >( entity );
570 }
571
573 template< int codim >
575 index ( const typename GridPartType::template Codim< codim >::EntityType &entity ) const
576 {
577 if( codimAvailable( codim ) )
578 {
579 if( (codim != 0) && ! codimUsed( codim ) )
580 setupCodimSet< codim >(std::integral_constant<bool,Dune::Capabilities::hasEntity < GridType, codim > :: v>());
581
582 return codimLeafSet( codim ).index( gridEntity( entity ) );
583 }
584 else
585 {
586 DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
587 return -1;
588 }
589 }
590
591 /* \brief return index for intersection */
592 IndexType index ( const IntersectionType &intersection ) const
593 {
594 enum { codim = intersectionCodimension };
595 if( codimAvailable( codim ) )
596 {
597 // this in only done on first call
598 setupIntersections();
599
600 // get corresponding face entity pointer
601 FaceType face = getIntersectionFace( intersection );
602
603 return codimLeafSet( codim ).index( gridEntity( face ) );
604 }
605 else
606 {
607 DUNE_THROW( NotImplemented, (name() + " does not support indices for intersections, intersectionCodim = ") << codim );
608 return -1;
609 }
610 }
611
612 /* \brief return index for sub entity of given intersection and subEntityNumber */
614 subIndex ( const IntersectionType &intersection,
615 int subNumber, unsigned int codim ) const
616 {
617 DUNE_THROW( NotImplemented, (name() + " does not support subIndices for intersections, intersectionCodim = ") << codim );
618 return -1;
619 }
620
622 template< class Entity >
623 IndexType subIndex ( const Entity &entity, int subNumber, unsigned int codim ) const
624 {
625 return subIndex< Entity::codimension >( entity, subNumber, codim );
626 }
627
629 template< int cd >
630 IndexType subIndex ( const typename GridPartType::template Codim< cd >::EntityType &entity,
631 int subNumber, unsigned int codim ) const
632 {
633 assert( (int( codim ) >= cd) && (int( codim ) <= dimension) );
634 if( !codimAvailable( codim ) )
635 DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
636
637 if( (codim != 0) && ! codimUsed( codim ) )
638 {
639 Fem::ForLoop< CallSetUpCodimSet, 1, dimension >::apply( codim, *this );
640 }
641
642 const CodimIndexSetType &codimSet = codimLeafSet( codim );
643 const IndexType idx = codimSet.subIndex( gridEntity( entity ), subNumber );
644 assert( (idx >= 0) && (idx < IndexType( codimSet.size() )) );
645 return idx;
646 }
647
649 //
650 // DoF adjustment methods, needed by AdaptiveDofMapper interface
651 //
653
656 {
657 const int codim = dimension - type.dim();
658 // this index set works only with single geometry types adaptively
659 assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
660
661 // if mapper is asking for types that are
662 // not in the index set then 0 should be returned
663 if( geomTypes( codim )[ 0 ] != type )
664 {
665 return 0;
666 }
667
668 return numberOfHoles( codim );
669 }
670
672 IndexType numberOfHoles ( const int codim ) const
673 {
674 if( codimAvailable( codim ) && codimUsed( codim ) )
675 {
676 return codimLeafSet( codim ).numberOfHoles();
677 }
678 else
679 return 0;
680 }
681
684 {
685 const int codim = dimension - type.dim();
686 assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
687 return oldIndex( hole, codim );
688 }
689
691 IndexType oldIndex (const IndexType hole, const int codim ) const
692 {
693 if( codimAvailable( codim ) )
694 {
695 assert( codimUsed( codim ) );
696 return codimLeafSet( codim ).oldIndex( hole );
697 }
698 else
699 {
700 DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
701 return IndexType(-1);
702 }
703 }
704
707 {
708 const int codim = dimension - type.dim();
709 assert( hasSingleGeometryType || geomTypes( codim ).size() == 1 );
710 return newIndex( hole, codim );
711 }
712
714 IndexType newIndex (const IndexType hole , const int codim ) const
715 {
716 if( codimAvailable( codim ) )
717 {
718 assert( codimUsed( codim ) );
719 return codimLeafSet( codim ).newIndex( hole );
720 }
721 else
722 {
723 DUNE_THROW( NotImplemented, (name() + " does not support indices for codim = ") << codim );
724 return IndexType(-1);
725 }
726 }
727
728 protected:
729 // Note: The following methods forward to Dune::Fem::CodimIndexSet, which
730 // expects a Dune::Grid as template argument; all arguments passed to
731 // members of Dune::Fem::CodimIndexSet must be compatible with the
732 // template grid type. If entities returned by the grid and the grid part
733 // respectively differ in type, Dune::Fem::AdaptiveLeafIndexSetBase will
734 // call the necessary operations from grid part entities to grid entites.
735
736 // memorise index
737 void insertIndex ( const GridElementType &entity );
738
739 // memorise indices for all intersections
740 void insertIntersections ( const GridElementType &entity ) const;
741
742 // insert index temporarily
743 void insertTemporary ( const GridElementType &entity );
744
745 // set indices to unsed so that they are cleaned on compress
746 void removeIndex ( const GridElementType &entity );
747
748 // check whether entity can be inserted or not
749 void checkHierarchy ( const GridElementType &entity, bool wasNew );
750
751 // mark indices that are still used (and give new indices to new elements)
752 template <PartitionIteratorType pt>
753 void markAllUsed ();
754
756 void clear();
757
760
761 // give all entities that lie below the old entities new numbers
762 // here we need the hierarchic iterator because for example for some
763 // grid more the one level of new elements can be created during adaption
764 // there for we start to give new number for all elements below the old
765 // element
766 template <PartitionIteratorType pt>
767 void markAllBelowOld ();
768
769 // mark indices that are still used (and give new indices to new elements)
770 template< int codim >
771 void setupCodimSet (const std::integral_constant<bool,true> &hasEntities) const;
772 template< int codim >
773 void setupCodimSet (const std::integral_constant<bool,false> &hasEntities) const;
774
775 // mark indices that are still used (and give new indices to new intersections)
776 void setupIntersections () const;
777
778 // count elements by iterating over grid and compare
779 // entities of given codim with given type
780 template< int codim >
781 inline IndexType countElements ( GeometryType type, const std::integral_constant<bool,true> &hasEntities ) const;
782 template< int codim >
783 inline IndexType countElements ( GeometryType type, const std::integral_constant<bool,false> &hasEntities ) const;
784
785 public:
787 template< class StreamTraits >
789
791 template< class StreamTraits >
793
794 protected:
795 FaceType getIntersectionFace( const IntersectionType& intersection ) const
796 {
797 ElementType inside = intersection.inside();
798 return getIntersectionFace( intersection, inside );
799 }
800
801 FaceType getIntersectionFace( const IntersectionType& intersection,
802 const ElementType& inside ) const
803 {
804 if( ! intersection.conforming() && intersection.neighbor() )
805 {
806 ElementType outside = intersection.outside();
807 // only if outside is more refined then inside
808 if( inside.level() < outside.level() )
809 return GetFaceEntity :: subEntity( outside, intersection.indexInOutside() );
810 }
811
812 // default: get subentity of inside
813 return GetFaceEntity :: subEntity( inside, intersection.indexInInside() );
814 }
815 };
816
817 template< class TraitsImp >
818 inline void
820 {
821 codimLeafSet( 0 ).resize();
822
823 // if more than one codimension is supported
824 if( numCodimensions > 1 )
825 {
826 for( int codim = 1; codim < numCodimensions; ++codim )
827 {
828 if( codimUsed( codim ) )
829 codimLeafSet( codim ).resize();
830 }
831 }
832 }
833
834
835 // --compress
836 template< class TraitsImp >
837 inline bool
839 {
840 // reset list of holes in any case
841 for( int codim = 0; codim < numCodimensions; ++codim )
842 {
843 if( codimUsed( codim ) )
844 codimLeafSet( codim ).clearHoles();
845 }
846
847 if( compressed_ )
848 {
849 // if set already compress, do noting for serial runs
850 // in parallel runs check sequence number of dof manager
851 if( (grid_.comm().size() == 1) || (sequence_ == dofManager_.sequence()) )
852 return false;
853 }
854
855 // prepare index sets for setup
856 for( int codim = 0; codim < numCodimensions; ++codim )
857 {
858 if( codimUsed( codim ) )
859 codimLeafSet( codim ).prepareCompress();
860 }
861
862 // mark all indices still needed
863 setupIndexSet();
864
865 // true if a least one index is moved
866 bool haveToCopy = codimLeafSet( 0 ).compress();
867 for( int codim = 1; codim < numCodimensions; ++codim )
868 {
869 if( codimUsed( codim ) )
870 haveToCopy |= codimLeafSet( codim ).compress();
871 }
872
873 // now status is compressed
874 compressed_ = true;
875 // update sequence number
876 sequence_ = dofManager_.sequence();
877
878 return haveToCopy;
879 }
880
881
882 template< class TraitsImp >
883 inline void
884 AdaptiveIndexSetBase< TraitsImp >::insertIndex ( const GridElementType &entity )
885 {
886#if HAVE_MPI
887 // we need special treatment for ghosts
888 // ghosts should not be inlcuded in holes list
889 if( entity.partitionType() == GhostEntity )
890 {
891 codimLeafSet( 0 ).insertGhost( entity );
892 const bool skipGhosts = (pitype != All_Partition);
893 // only for index sets upporting more than one codim
894 if( numCodimensions > 1 )
895 Fem::ForLoop< InsertGhostSubEntities, 1, dimension >::apply( *this, entity, skipGhosts );
896 }
897 else
898#endif // HAVE_MPI
899 {
900 codimLeafSet( 0 ).insert( entity );
901 // only for index sets supporting more than one codim
902 if( numCodimensions > 1 )
903 Fem::ForLoop< InsertSubEntities, 1, dimension >::apply( *this, entity );
904
905 }
906
907 assert( codimLeafSet( 0 ).exists( entity ) );
908
909 // insert intersections if this is enabled
910 if( intersectionCodimension > 0 )
911 {
912 insertIntersections( entity );
913 }
914
915 // now consecutivity is no longer guaranteed
916 compressed_ = false;
917 }
918
919 template< class TraitsImp >
920 inline void
921 AdaptiveIndexSetBase< TraitsImp >::insertIntersections ( const GridElementType &gridElement ) const
922 {
923 codimLeafSet( intersectionCodimension ).resize();
924
925 const ElementType &element = gridPart_.convert( gridElement );
926 const IntersectionIteratorType endiit = gridPart_.iend( element );
927 for( IntersectionIteratorType iit = gridPart_.ibegin( element );
928 iit != endiit ; ++ iit )
929 {
930 // get intersection
931 const IntersectionType& intersection = *iit ;
932
933 // get correct face pointer
934 FaceType face = getIntersectionFace( intersection, element );
935
936 // insert face into index set
937 codimLeafSet( intersectionCodimension ).insert( gridEntity( face ) );
938 }
939 }
940
941 template< class TraitsImp >
942 inline void
943 AdaptiveIndexSetBase< TraitsImp >::insertTemporary( const GridElementType &entity )
944 {
945 insertIndex( entity );
946 codimLeafSet( 0 ).markForRemoval( entity );
947 }
948
949 template< class TraitsImp >
950 inline void
951 AdaptiveIndexSetBase< TraitsImp >::removeIndex( const GridElementType &entity )
952 {
953 // remove entities (only mark them as unused)
954 codimLeafSet( 0 ).markForRemoval( entity );
955
956 // don't remove higher codim indices (will be done on compression
957
958 // now consecutivity is no longer guaranteed
959 compressed_ = false;
960 }
961
962
963 template< class TraitsImp >
964 inline void
965 AdaptiveIndexSetBase< TraitsImp >
966 ::checkHierarchy ( const GridElementType &entity, bool wasNew )
967 {
968 // for leaf entities, just insert the index
969 // this certainly the case for grids without hierarchy
970 if( entity.isLeaf() )
971 {
972 insertIndex( entity );
973 return;
974 }
975
976 bool isNew = wasNew ;
977 typedef typename GridType::HierarchicIterator HierarchicIterator;
978
979 if( isNew )
980 {
981 // this is a new entity, so insert it,
982 // but only temporarily because it's not a leaf entity
983 insertTemporary( entity );
984 }
985 else
986 {
987 // if we were a leaf entity, all children are new
988 isNew = codimLeafSet( 0 ).validIndex( entity );
989 }
990
991 // entity has children and we need to go deeper
992 const int childLevel = entity.level() + 1;
993 const HierarchicIterator end = entity.hend( childLevel );
994 for( HierarchicIterator it = entity.hbegin( childLevel ); it != end; ++it )
995 checkHierarchy( *it, isNew );
996 }
997
998
999 template< class TraitsImp >
1000 template< PartitionIteratorType pt >
1001 inline void
1002 AdaptiveIndexSetBase< TraitsImp >::markAllUsed ()
1003 {
1004 // make correct size of vectors
1005 resizeVectors();
1006
1007 // mark all indices as unused
1008 for( int codim = 0; codim < numCodimensions; ++codim )
1009 {
1010 if( codimUsed( codim ) )
1011 codimLeafSet( codim ).resetUsed();
1012 }
1013
1014 typedef typename GridPartType
1015 ::template Codim< 0 > :: template Partition< pt > :: IteratorType Iterator;
1016
1017 const Iterator end = gridPart_.template end< 0, pt >();
1018 for( Iterator it = gridPart_.template begin< 0, pt >(); it != end; ++it )
1019 insertIndex( gridEntity( *it ) );
1020 }
1021
1022 template< class TraitsImp >
1023 inline void
1025 {
1026 // for structured grids clear all information
1027 // this in only done when setting up grids or after
1028 // read of parallel data on serial grids
1029 if( CartesianNonAdaptiveGrid )
1030 {
1031 // mark all indices as unused
1032 for( int codim = 0; codim < numCodimensions; ++codim )
1033 {
1034 if( codimUsed( codim ) )
1035 {
1036 // clear all information
1037 codimLeafSet( codim ).clear();
1038 }
1039 }
1040 }
1041 }
1042
1043 template< class TraitsImp >
1044 inline void
1046 {
1047 // only done for structured grids
1048 clear();
1049
1050#if HAVE_MPI
1051 // for YaspGrid we need all interior indices first
1052 if( CartesianNonAdaptiveGrid &&
1053 grid_.comm().size() > 1 )
1054 {
1055 // we should only get here for YaspGrid
1056 markAllUsed<Interior_Partition> ();
1057 if( pitype > Interior_Partition )
1058 markAllUsed< pitype >();
1059 }
1060 else
1061#endif
1062 {
1063 // give all entities that lie on the leaf level new numbers
1064 markAllUsed< pitype > ();
1065 }
1066 }
1067
1068 template< class TraitsImp >
1069 template< PartitionIteratorType pt >
1070 inline void
1072 {
1073 // mark all indices as unused
1074 for( int codim = 0; codim < numCodimensions; ++codim )
1075 {
1076 if( codimUsed( codim ) )
1077 codimLeafSet( codim ).resetUsed();
1078 }
1079
1080 // get macro iterator
1081 auto macroView = grid_.levelGridView( 0 );
1082
1083 const auto macroend = macroView.template end< 0, pt >();
1084 for( auto macroit = macroView.template begin< 0, pt >();
1085 macroit != macroend; ++macroit )
1086 {
1087 checkHierarchy( *macroit, false );
1088 }
1089 }
1090
1091
1092 template< class TraitsImp >
1093 template< int codim >
1094 inline void
1095 AdaptiveIndexSetBase< TraitsImp >::setupCodimSet (const std::integral_constant<bool,true>&) const
1096 {
1097 // if codim is not available do nothing
1098 if( ! codimAvailable( codim ) ) return ;
1099
1100 // create codimLeafSet if not existing
1101 if( ! codimLeafSet_[ codim ] )
1102 {
1103 codimLeafSet_[ codim ].reset( new CodimIndexSetType( grid_, codim ) );
1104 }
1105
1106 // resize if necessary
1107 codimLeafSet( codim ).resize();
1108
1109 // walk over grid parts entity set and insert entities
1110 typedef typename GridPartType
1111 ::template Codim< codim >::template Partition< pitype > :: IteratorType Iterator;
1112
1113 const Iterator end = gridPart_.template end< codim, pitype >();
1114 for( Iterator it = gridPart_.template begin< codim, pitype >(); it != end; ++it )
1115 codimLeafSet( codim ).insert( gridEntity( *it ) );
1116 }
1117
1118 template< class TraitsImp >
1119 template< int codim >
1120 inline void
1121 AdaptiveIndexSetBase< TraitsImp >::setupCodimSet (const std::integral_constant<bool,false>&) const
1122 {
1123 // if codim is not available do nothing
1124 if( ! codimAvailable( codim ) ) return ;
1125
1126 // create codimLeafSet if not existing
1127 if( ! codimLeafSet_[ codim ] )
1128 {
1129 codimLeafSet_[ codim ].reset( new CodimIndexSetType( grid_, codim ) );
1130 }
1131
1132 // resize if necessary
1133 codimLeafSet( codim ).resize();
1134
1135 typedef typename GridPartType
1136 ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1137
1138 const Iterator end = gridPart_.template end< 0, pitype >();
1139 for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1140 {
1141 const ElementType& element = *it ;
1142 const GridElementType &gridElement = gridEntity( element );
1143 InsertSubEntities< codim >::apply( *this, gridElement );
1144 }
1145 }
1146
1147
1148 template< class TraitsImp >
1149 inline void
1150 AdaptiveIndexSetBase< TraitsImp >::setupIntersections() const
1151 {
1152 // if intersectionCodimension < 0 then this feature is disabled
1153 if( intersectionCodimension < 0 ) return ;
1154
1155 // do nothing if insections are already available
1156 if( codimUsed( intersectionCodimension ) ) return ;
1157
1158 // resize if necessary
1159 codimLeafSet( intersectionCodimension ).resize();
1160
1161 // walk over grid parts entity set and insert entities
1162 typedef typename GridPartType
1163 ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1164
1165 const Iterator end = gridPart_.template end< 0, pitype >();
1166 for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1167 {
1168 // insert all intersections of this entity
1169 insertIntersections( gridEntity( *it ) );
1170 }
1171 }
1172
1173 template< class TraitsImp >
1174 template< int codim >
1176 AdaptiveIndexSetBase< TraitsImp >::countElements ( GeometryType type, const std::integral_constant<bool,true>& ) const
1177 {
1178 typedef typename GridPartType
1179 ::template Codim< codim > :: template Partition< pitype > :: IteratorType Iterator;
1180
1181 const Iterator begin = gridPart_.template begin< codim, pitype >();
1182 const Iterator end = gridPart_.template end< codim, pitype >();
1183 IndexType count = 0;
1184 for( Iterator it = begin; it != end; ++it )
1185 {
1186 if( it->type() == type )
1187 {
1188 ++count;
1189 }
1190 }
1191 return count;
1192 }
1193
1194 template< class TraitsImp >
1195 template< int codim >
1197 AdaptiveIndexSetBase< TraitsImp >::countElements ( GeometryType type, const std::integral_constant<bool,false>& ) const
1198 {
1199 if( ! codimLeafSet_[ codim ] )
1200 return 0;
1201
1202 // make sure codimension is enabled
1203 assert( codimAvailable( codim ) );
1204
1205 // resize if necessary
1206 codimLeafSet( codim ).resize();
1207
1208 typedef typename GridPartType
1209 ::template Codim< 0 >::template Partition< pitype > :: IteratorType Iterator;
1210
1211 typedef typename GridPartType::ctype ctype;
1212
1213 const Iterator end = gridPart_.template end< 0, pitype >();
1214 IndexType count = 0;
1215 for( Iterator it = gridPart_.template begin< 0, pitype >(); it != end; ++it )
1216 {
1217 const ElementType& element = *it ;
1218 const GridElementType &gridElement = gridEntity( element );
1219 const int subEntities = gridElement.subEntities( codim );
1220 for (int i=0; i < subEntities; ++i)
1221 {
1222 if (! codimLeafSet( codim ).exists( gridElement, i) )
1223 {
1224 codimLeafSet( codim ).insertSubEntity( gridElement,i );
1226 general( gridElement.type() ).type( i, codim ) == type )
1227 {
1228 ++count;
1229 }
1230 }
1231 }
1232 }
1233
1234 return count;
1235 }
1236
1237
1238 template< class TraitsImp >
1239 template< class StreamTraits >
1242 {
1243 // write name for identification
1244 const std::string myname( name() );
1245 out << myname;
1246
1247 // write number of codimensions
1248 out << numCodimensions ;
1249
1250 // write whether codim is used
1251 for( int i = 0; i < numCodimensions; ++i )
1252 out << codimUsed( i );
1253
1254 // write all sets
1255 for( int i = 0; i < numCodimensions; ++i )
1256 {
1257 if( codimUsed( i ) )
1258 codimLeafSet( i ).write( out );
1259 }
1260
1261 // if we got until here writing was sucessful
1262 return true;
1263 }
1264
1265
1266 template< class TraitsImp >
1267 template< class StreamTraits >
1270 {
1271 {
1272 // read name and check compatibility
1273 std::string storedName;
1274 in >> storedName;
1275
1276 std::string myname( name() );
1277
1278 if( myname != storedName )
1279 {
1280 size_t length = std::min( myname.size(), storedName.size() );
1281 // only print the first character of whatever storedName is
1282 std::string found = storedName.substr(0, length-1 );
1284 "AdaptiveIndexSetBase::read: got " << found
1285 << " (expected " << myname << ")." );
1286 }
1287 }
1288
1289 // read number of codimensions
1290 int numCodim;
1291 in >> numCodim;
1292
1293 // make sure everything is correct
1294 // assert( numCodim == numCodimensions );
1295 if( numCodim != numCodimensions )
1296 DUNE_THROW(InvalidStateException,"AdaptiveIndexSetBase::read: got wrong number of codimensions" << numCodim << " instead of " << numCodimensions);
1297
1298 // read codim used
1299 for( int i = 0; i < numCodimensions; ++i )
1300 {
1301 bool codimInUse = false ;
1302 in >> codimInUse;
1303 if( codimInUse && ! codimLeafSet_[ i ] )
1304 {
1305 codimLeafSet_[ i ].reset( new CodimIndexSetType( grid_, (i == intersectionCodimension ) ? 1 : i ) );
1306 }
1307 }
1308
1309 for( int i = 0; i < numCodimensions; ++i )
1310 {
1311 if( codimUsed( i ) )
1312 codimLeafSet( i ).read( in );
1313 }
1314
1315 // in parallel runs we have to compress here
1316 if( grid_.comm().size() > 1 )
1317 compressed_ = false;
1318
1319 // if we got until here reading was sucessful
1320 return true;
1321 }
1322
1323
1324
1326 //
1327 // --AdaptiveLeafIndexSet
1328 //
1330
1331 template< class GridPartImp >
1332 struct AdaptiveLeafIndexSetTraits
1333 : public AdaptiveIndexSetBaseTraits< GridPartImp, AdaptiveLeafIndexSet< GridPartImp > >
1334 {
1335 // number of codimensions
1336 enum { numCodimensions = GridPartImp :: dimension + 1 };
1337 // first comdimension that is supported (not yet supported)
1338 enum { startingCodimension = 0 };
1339 // intersection codimensions (this is usually dimension + 1 )
1340 enum { intersectionCodimension = -1 };
1341 };
1342
1354 template < class GridPartImp >
1356 : public AdaptiveIndexSetBase< AdaptiveLeafIndexSetTraits< GridPartImp > >
1357 {
1359 typedef AdaptiveLeafIndexSetTraits< GridPartImp > Traits;
1360
1361 public:
1362 typedef typename BaseType :: GridType GridType;
1363 typedef typename BaseType :: GridPartType GridPartType;
1364
1366 AdaptiveLeafIndexSet (const GridType* grid)
1367 : BaseType(grid)
1368 {}
1369
1371 AdaptiveLeafIndexSet (const GridPartType& gridPart)
1373 {}
1374
1376 virtual std::string name () const
1377 {
1378 return "AdaptiveLeafIndexSet";
1379 }
1380
1381 bool compress ()
1382 {
1383 const bool compressed = BaseType::compress();
1384
1385#ifndef NDEBUG
1386 if( this->grid_.comm().size() == 1 )
1387 {
1388 for( int codim = Traits::startingCodimension; codim < Traits::numCodimensions; ++codim )
1389 assert( this->codimUsed( codim ) ?
1390 size_t(this->size( codim )) == size_t(this->grid_.size( codim )) : true );
1391 }
1392#endif // #ifndef NDEBUG
1393
1394 return compressed;
1395 }
1396 };
1397
1398
1400 //
1401 // --IntersectionAdaptiveLeafIndexSet
1402 //
1404
1405 template< class GridPartImp >
1406 struct IntersectionAdaptiveLeafIndexSetTraits
1407 : public AdaptiveIndexSetBaseTraits< GridPartImp, IntersectionAdaptiveLeafIndexSet< GridPartImp > >
1408 {
1409 // number of codimensions
1410 enum { numCodimensions = GridPartImp :: dimension + 2 };
1411 // intersection codimensions (this is usually dimension + 1 )
1412 enum { intersectionCodimension = numCodimensions - 1 };
1413 // first comdimension that is supported (not yet supported)
1414 enum { startingCodimension = 0 };
1415 };
1416
1428 template < class GridPartImp >
1429 class IntersectionAdaptiveLeafIndexSet
1430 : public AdaptiveIndexSetBase< IntersectionAdaptiveLeafIndexSetTraits< GridPartImp > >
1431 {
1432 typedef AdaptiveIndexSetBase< IntersectionAdaptiveLeafIndexSetTraits< GridPartImp > > BaseType;
1433 typedef IntersectionAdaptiveLeafIndexSetTraits< GridPartImp > Traits;
1434
1435 public:
1436 typedef typename BaseType :: GridType GridType;
1437 typedef typename BaseType :: GridPartType GridPartType;
1439 IntersectionAdaptiveLeafIndexSet (const GridType* grid)
1440 : BaseType(grid)
1441 {}
1442
1444 IntersectionAdaptiveLeafIndexSet (const GridPartType& gridPart)
1445 : BaseType(gridPart)
1446 {}
1447
1449 virtual std::string name () const
1450 {
1451 return "IntersectionAdaptiveLeafIndexSet";
1452 }
1453
1454 bool compress ()
1455 {
1456 const bool compressed = BaseType::compress();
1457
1458#ifndef NDEBUG
1459 if( this->grid_.comm().size() == 1 )
1460 {
1461 for( int codim = Traits::startingCodimension; codim < Traits::numCodimensions; ++codim )
1462 if( codim != Traits::intersectionCodimension )
1463 assert( size_t(this->size( codim )) == size_t(this->grid_.size( codim )) );
1464 }
1465#endif // #ifndef NDEBUG
1466
1467 return compressed;
1468 }
1469 };
1470
1472 //
1473 // --DGAdaptiveLeafIndexSet
1474 //
1476
1477 template< class GridPartImp >
1478 struct DGAdaptiveLeafIndexSetTraits
1479 : public AdaptiveIndexSetBaseTraits< GridPartImp, DGAdaptiveLeafIndexSet< GridPartImp > >
1480 {
1481 // this index set only supports one codimension, codim zero
1482 enum { numCodimensions = 1 };
1483 // first comdimension that is supported (not yet supported)
1484 enum { startingCodimension = 0 };
1485 // intersection codimensions (this is usually dimension + 1 )
1486 enum { intersectionCodimension = -1 };
1487 };
1488
1499 template < class GridPartImp >
1501 : public AdaptiveIndexSetBase< DGAdaptiveLeafIndexSetTraits< GridPartImp > >
1502 {
1504 typedef DGAdaptiveLeafIndexSetTraits< GridPartImp > Traits;
1505
1506 public:
1507 typedef typename BaseType :: GridType GridType;
1508 typedef typename BaseType :: GridPartType GridPartType;
1511 : BaseType(grid)
1512 {}
1513
1514 DGAdaptiveLeafIndexSet (const GridPartType& gridPart)
1515 : BaseType(gridPart)
1516 {}
1517
1519 virtual std::string name () const
1520 {
1521 return "DGAdaptiveLeafIndexSet";
1522 }
1523
1524 bool compress ()
1525 {
1526 const bool compressed = BaseType::compress();
1527
1528#ifndef NDEBUG
1529 if( this->grid_.comm().size() == 1 )
1530 assert( size_t(this->size( 0 )) == size_t(this->grid_.size( 0 )) );
1531#endif // #ifndef NDEBUG
1532
1533 return compressed;
1534 }
1535 };
1536
1537 } // namespace Fem
1538
1539} // namespace Dune
1540
1541#endif // #ifndef DUNE_FEM_ADAPTIVELEAFINDEXSET_HH
Wrapper class for entities.
Definition: entity.hh:66
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:99
IndexType subIndex(const typename GridPartType::template Codim< cd >::EntityType &entity, int subNumber, unsigned int codim) const
return index for given subentity *‍/
Definition: adaptiveleafindexset.hh:630
IndexType numberOfHoles(GeometryType type) const
return number of holes for given type *‍/
Definition: adaptiveleafindexset.hh:655
AdaptiveIndexSetBase(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:361
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:411
void insertEntity(const GridElementType &entity)
please doc me *‍/
Definition: adaptiveleafindexset.hh:501
IndexType index(const Entity &entity) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:567
bool read(InStreamInterface< StreamTraits > &in)
please doc me *‍/
Definition: adaptiveleafindexset.hh:1269
BaseType::template Codim< 0 >::Entity ElementType
type of codimension 0 Entity
Definition: adaptiveleafindexset.hh:131
IndexType subIndex(const Entity &entity, int subNumber, unsigned int codim) const
return index for given subentity *‍/
Definition: adaptiveleafindexset.hh:623
IndexType index(const typename GridPartType::template Codim< codim >::EntityType &entity) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:575
void setupIndexSet()
mark all indices of interest
Definition: adaptiveleafindexset.hh:1045
void resize()
please doc me *‍/
Definition: adaptiveleafindexset.hh:518
IndexType numberOfHoles(const int codim) const
return number of holes of the sets indices
Definition: adaptiveleafindexset.hh:672
Types types(const int codim) const
return range of geometry types *‍/
Definition: adaptiveleafindexset.hh:475
AdaptiveIndexSetBase(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:353
void removeEntity(const GridElementType &entity)
please doc me *‍/
Definition: adaptiveleafindexset.hh:509
static const int intersectionCodimension
intersection codimension (numCodim-1 if enabled, otherwise -1)
Definition: adaptiveleafindexset.hh:119
IndexType oldIndex(const IndexType hole, const int codim) const
return old index, for dof manager only
Definition: adaptiveleafindexset.hh:691
const GridPartType & gridPart() const
return const reference to the grid part
Definition: adaptiveleafindexset.hh:417
IndexType newIndex(IndexType hole, GeometryType type) const
return new index for given hole and type *‍/
Definition: adaptiveleafindexset.hh:706
IndexType newIndex(const IndexType hole, const int codim) const
return new index, for dof manager only returns index
Definition: adaptiveleafindexset.hh:714
void resizeVectors()
reallocate the vector for new size
Definition: adaptiveleafindexset.hh:819
GridPartType::IntersectionType IntersectionType
type of intersections
Definition: adaptiveleafindexset.hh:137
IndexType oldIndex(IndexType hole, GeometryType type) const
return old index for given hole and type *‍/
Definition: adaptiveleafindexset.hh:683
static const int dimension
grid dimension *‍/
Definition: adaptiveleafindexset.hh:113
bool contains(const EntityType &en) const
return true if entity has index *‍/
Definition: adaptiveleafindexset.hh:482
bool write(OutStreamInterface< StreamTraits > &out) const
please doc me *‍/
Definition: adaptiveleafindexset.hh:1241
void clear()
clear index set (only for structured grids)
Definition: adaptiveleafindexset.hh:1024
BaseType::IndexType IndexType
index type *‍/
Definition: adaptiveleafindexset.hh:125
BaseType::Types Types
geometry type range type *‍/
Definition: adaptiveleafindexset.hh:128
static const int numCodimensions
number of supported codimensions
Definition: adaptiveleafindexset.hh:116
IndexType size(int codim) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:449
const std::vector< GeometryType > & geomTypes(const int codim) const
*‍/
Definition: adaptiveleafindexset.hh:468
void setupGeomTypes(const MacroIndexSet &indexSet)
Definition: adaptiveleafindexset.hh:389
IndexType size(GeometryType type) const
return number of entities of given type *‍/
Definition: adaptiveleafindexset.hh:429
bool compress()
please doc me *‍/
Definition: adaptiveleafindexset.hh:838
int type() const
return type of index set, for GrapeDataIO
Definition: adaptiveleafindexset.hh:405
static const bool hasSingleGeometryType
true if only one geometry type is available
Definition: adaptiveleafindexset.hh:122
GridPartType::IntersectionIteratorType IntersectionIteratorType
type of intersection iterator
Definition: adaptiveleafindexset.hh:134
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:1357
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1376
AdaptiveLeafIndexSet(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:1366
AdaptiveLeafIndexSet(const GridPartType &gridPart)
Constructor.
Definition: adaptiveleafindexset.hh:1371
consecutive, persistent index set for the leaf level based on the grid's hierarchy index set
Definition: adaptiveleafindexset.hh:1502
DGAdaptiveLeafIndexSet(const GridType *grid)
Constructor.
Definition: adaptiveleafindexset.hh:1510
virtual std::string name() const
return name of index set
Definition: adaptiveleafindexset.hh:1519
abstract interface for an input stream
Definition: streams.hh:190
Traits::IndexType IndexType
index type
Definition: indexset.hh:136
abstract interface for an output stream
Definition: streams.hh:48
const GridType & grid() const
return const reference to the grid
Definition: persistentindexset.hh:161
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:375
Default exception for dummy implementations.
Definition: exceptions.hh:357
#define DUNE_THROW(E,...)
Definition: exceptions.hh:314
PartitionIteratorType
Parameter to be used for the parallel level- and leaf iterators.
Definition: gridenums.hh:136
@ All_Partition
all entities
Definition: gridenums.hh:141
@ Interior_Partition
only interior entities
Definition: gridenums.hh:137
@ GhostEntity
ghost entities
Definition: gridenums.hh:35
Dune namespace
Definition: alignedallocator.hh:13
constexpr std::integral_constant< std::size_t, sizeof...(II)> size(std::integer_sequence< T, II... >)
Return the size of the sequence.
Definition: integersequence.hh:75
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: capabilities.hh:58
Specialize with 'true' for if the codimension 0 entity of the grid has only one possible geometry typ...
Definition: capabilities.hh:27
Specialize with 'true' if the grid is a Cartesian grid. Cartesian grids satisfy the following propert...
Definition: capabilities.hh:48
Class providing access to the singletons of the reference elements.
Definition: referenceelements.hh:128
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Feb 16, 23:40, 2026)