Dune Core Modules (2.9.0)

iterator.hh
1#ifndef DUNE_ALU3DGRIDITERATOR_HH
2#define DUNE_ALU3DGRIDITERATOR_HH
3
4// System includes
5#include <type_traits>
6
7// Dune includes
10#include <dune/alugrid/common/memory.hh>
11#include <dune/alugrid/common/twists.hh>
12
13// Local includes
14#include "alu3dinclude.hh"
15#include "topology.hh"
16#include "faceutility.hh"
17#include "alu3diterators.hh"
18
19namespace Dune {
20 // Forward declarations
21 template<int cd, int dim, class GridImp>
22 class ALU3dGridEntity;
23 template<int cd, PartitionIteratorType pitype, class GridImp >
24 class ALU3dGridLevelIterator;
25 template<int cd, class GridImp >
26 class ALU3dGridEntityPointer;
27 template<int mydim, int coorddim, class GridImp>
28 class ALU3dGridGeometry;
29 template<class GridImp>
30 class ALU3dGridHierarchicIterator;
31 template<class GridImp>
32 class ALU3dGridIntersectionIterator;
33 template<int codim, PartitionIteratorType pitype, class GridImp>
34 class ALU3dGridLeafIterator;
35 template< int, int, ALU3dGridElementType, class >
36 class ALU3dGrid;
37 template< int, int, ALU3dGridElementType, class >
38 class ALU3dGridFaceInfo;
39 template< ALU3dGridElementType, class >
40 class ALU3dGridGeometricFaceInfo;
41
42//**********************************************************************
43//
44// --ALU3dGridIntersectionIterator
45// --IntersectionIterator
53template<class GridImp>
55//: public IntersectionIteratorDefaultImplementation <GridImp,ALU3dGridIntersectionIterator>
56{
57 enum { dim = GridImp::dimension };
58 enum { dimworld = GridImp::dimensionworld };
59
60 typedef typename GridImp::MPICommunicatorType Comm;
61
62 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
63
64 typedef typename ImplTraits::HElementType HElementType ;
65 typedef typename ImplTraits::HBndSegType HBndSegType;
66 typedef typename ImplTraits::GEOElementType GEOElementType;
67 typedef typename ImplTraits::IMPLElementType IMPLElementType;
68 typedef typename ImplTraits::GEOFaceType GEOFaceType;
69 typedef typename ImplTraits::NeighbourPairType NeighbourPairType;
70 typedef typename ImplTraits::BNDFaceType BNDFaceType;
71
72 typedef typename ALU3dImplTraits< tetra, Comm >::GEOElementType GEOTetraElementType;
73 typedef typename ALU3dImplTraits< tetra, Comm >::BNDFaceType GEOTriangleBndType;
74 typedef typename ALU3dImplTraits< hexa, Comm >::GEOElementType GEOHexaElementType;
75 typedef typename ALU3dImplTraits< hexa, Comm >::BNDFaceType GEOQuadBndType;
76
77 typedef ALU3dGridFaceInfo< dim, dimworld, GridImp::elementType, Comm > FaceInfoType;
78
79 typedef typename std::conditional<
80 tetra == GridImp::elementType,
83
86
87 enum { numFaces = (dim==3) ? EntityCount<GridImp::elementType>::numFaces : (GridImp::elementType==tetra ? 3 : 4) };
88 enum { numVerticesPerFace =
89 GeometryInfoType::numVerticesPerFace };
90 enum { numVertices = (dim==3) ? EntityCount<GridImp::elementType>::numVertices : (GridImp::elementType==tetra ? 3 : 4)};
91
93
94 friend class ALU3dGridEntity<0,dim,GridImp>;
95 friend class IntersectionIteratorWrapper<GridImp,ThisType>;
96
97protected:
98 enum IntersectionIteratorType { IntersectionLeaf , IntersectionLevel, IntersectionBoth };
99
100 typedef typename GridImp::Traits::template Codim< 1 >::GeometryImpl GeometryImpl;
101 typedef typename GridImp::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl;
102
103public:
104 typedef ALUTwists< (dim == 3 ) ? GridImp::elementType == tetra ? 3 : 4 : 2, dim-1 > Twists;
105 typedef typename Twists::Twist Twist;
106
107 typedef typename GridImp::template Codim<0>::Entity Entity;
108 typedef typename GridImp::template Codim<0>::EntityImp EntityImp;
109
110 typedef typename GridImp::template Codim<1>::Geometry Geometry;
111 typedef typename GridImp::template Codim<1>::LocalGeometry LocalGeometry;
112
116
118
120 explicit ALU3dGridIntersectionIterator( const bool levelIntersectionIterator = false );
121
124
127
129 bool equals (const ALU3dGridIntersectionIterator<GridImp> & i) const;
130
132 void increment ();
133
135 EntityImp outside() const;
136
138 EntityImp inside() const;
139
141 bool boundary () const;
142
144 bool neighbor () const;
145
147 int boundaryId () const;
148
150 size_t boundarySegmentIndex() const;
151
153 int segmentId() const;
154
159 LocalGeometry geometryInInside () const;
160
165 Geometry geometry () const;
166
168 GeometryType type () const;
169
172 int indexInInside () const;
173
177 LocalGeometry geometryInOutside () const;
178
181 int indexInOutside () const;
182
184 Twist twistInInside () const;
185
187 Twist twistInOutside () const;
188
192
196
200
202 int level () const;
203
204 int outsideLevel () const { return connector_.outsideLevel(); }
205
207 bool conforming () const
208 {
209 return (connector_.conformanceState() == FaceInfoType::CONFORMING);
210 }
211
213 const GEOFaceType& getItem() const { return connector_.face(); }
214
216 int weight() const
217 {
218 return this->getItem().weight();
219 }
220
221protected:
222 // set interator to end iterator
223 void done () ;
224 template< class EntityType > void done ( const EntityType &en ) { done(); }
225
226 // reset IntersectionIterator to first neighbour
227 void setFirstItem(const HElementType & elem, int wLevel);
228
229 // reset IntersectionIterator to first neighbour
230 void setInteriorItem(const HElementType & elem,
231 const BNDFaceType& bnd, int wLevel);
232
233 // reset IntersectionIterator to first neighbour
234 void first(const EntityImp& en, int wLevel, const GridImp& grid );
235
236 // set new face
237 void setNewFace(const GEOFaceType& newFace);
238
239private:
240 // set new face (only LeafIntersectionIterator)
241 void setGhostFace(const GEOFaceType& newFace);
242
243protected:
244 // generate local geometries
245 void buildLocalGeometries() const;
246
247 // get the face corresponding to the index
248 const typename ALU3dImplTraits< tetra, Comm >::GEOFaceType *
249 getFace ( const GEOTriangleBndType &bnd, int index ) const;
250
251 // get the face corresponding to the index
252 const typename ALU3dImplTraits< hexa, Comm >::GEOFaceType *
253 getFace ( const GEOQuadBndType &bnd, int index ) const;
254
255 // get the face corresponding to the index
256 const typename ALU3dImplTraits< tetra, Comm >::GEOFaceType *
257 getFace ( const GEOTetraElementType &elem, int index ) const;
258
259 const typename ALU3dImplTraits< hexa, Comm >::GEOFaceType *
260 getFace ( const GEOHexaElementType &elem, int index ) const;
261
264 mutable FaceInfoType connector_;
265 mutable GeometryInfoType geoProvider_; // need to initialise
266
268 const IMPLElementType* item_;
269
271 const BNDFaceType* ghost_;
272
274 const GridImp* grid_;
275
276 mutable int innerLevel_;
277 mutable int index_;
278
279 mutable GeometryImpl intersectionGlobal_;
280 mutable LocalGeometryImpl intersectionSelfLocal_;
281 mutable LocalGeometryImpl intersectionNeighborLocal_;
282
283 // unit outer normal
284 mutable NormalType unitOuterNormal_;
285
286public:
287 // used by SharedPointer
288 void invalidate() { done(); }
289 // refCount used by SharedPointer
290 unsigned int refCount_;
291};
292
293template<class GridImp>
294class ALU3dGridLevelIntersectionIterator :
295public ALU3dGridIntersectionIterator<GridImp>
296{
297 enum { dim = GridImp::dimension };
298 enum { dimworld = GridImp::dimensionworld };
299
300 typedef typename GridImp::MPICommunicatorType Comm;
301
302 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
303
304 typedef typename ImplTraits::HElementType HElementType ;
305 typedef typename ImplTraits::GEOElementType GEOElementType;
306 typedef typename ImplTraits::IMPLElementType IMPLElementType;
307 typedef typename ImplTraits::GEOFaceType GEOFaceType;
308 typedef typename ImplTraits::NeighbourPairType NeighbourPairType;
309 typedef typename ImplTraits::BNDFaceType BNDFaceType;
310
311 typedef ALU3dGridFaceInfo< dim, dimworld, GridImp::elementType, Comm > FaceInfoType;
312
313 typedef typename std::conditional<
314 tetra == GridImp::elementType,
315 ALU3dGridGeometricFaceInfoTetra< dim, dimworld, Comm >,
316 ALU3dGridGeometricFaceInfoHexa< dim, dimworld, Comm > >::type GeometryInfoType;
317
318 typedef ElementTopologyMapping<GridImp::elementType> ElementTopo;
319 typedef FaceTopologyMapping<GridImp::elementType> FaceTopo;
320
321 enum { numFaces = (dim==3) ? EntityCount<GridImp::elementType>::numFaces : (GridImp::elementType==tetra ? 3 : 4) };
322 enum { numVerticesPerFace =
323 GeometryInfoType::numVerticesPerFace };
324 enum { numVertices = (dim==3) ? EntityCount<GridImp::elementType>::numVertices : (GridImp::elementType==tetra ? 3 : 4)};
325
326 typedef ALU3dGridIntersectionIterator<GridImp> BaseType;
327 typedef ALU3dGridLevelIntersectionIterator<GridImp> ThisType;
328
329 typedef typename BaseType :: EntityImp EntityImp;
330
331 friend class ALU3dGridEntity<0,dim,GridImp>;
332 friend class IntersectionIteratorWrapper<GridImp,ThisType>;
333protected:
334 using BaseType :: item_;
335 using BaseType :: ghost_;
336 using BaseType :: grid_;
337 using BaseType :: innerLevel_;
338 using BaseType :: index_;
339 using BaseType :: connector_;
340 using BaseType :: geoProvider_;
341 using BaseType :: boundary;
342 using BaseType :: done ;
343 using BaseType :: getFace;
344 using BaseType :: neighbor ;
345
346public:
348 ALU3dGridLevelIntersectionIterator();
349
351 ALU3dGridLevelIntersectionIterator(const ThisType & org);
352
354 void assign(const ThisType & org);
355
357 void increment ();
358
359 // reset IntersectionIterator to first neighbour
360 void first(const EntityImp& en, int wLevel, const GridImp& grid );
361
363 bool neighbor () const;
364
366 bool conforming () const
367 {
368 alugrid_assert ( ( ! connector_.conformingRefinement() ) ?
369 ( !neighbor() || this->connector_.conformanceState() == FaceInfoType::CONFORMING ) : true );
370 // for conforming refinement use base implementation
371 // otherwise its true
372 return connector_.conformingRefinement() ?
373 BaseType :: conforming() : true ;
374 }
375
376private:
377 // set new face
378 void setNewFace(const GEOFaceType& newFace);
379
380 // reset IntersectionIterator to first neighbour
381 void setFirstItem(const HElementType & elem, int wLevel);
382
383 // reset IntersectionIterator to first neighbour
384 void setInteriorItem(const HElementType & elem,
385 const BNDFaceType& bnd, int wLevel);
386
387 bool levelNeighbor_;
388 bool isLeafItem_;
389};
390
392//
393// --IterationImpl
394//
396template <class InternalIteratorType >
397class ALU3dGridTreeIterator
398{
399public:
400 typedef typename InternalIteratorType :: val_t val_t;
401
402 // here the items level will do
403 template <class GridImp, int dim, int codim>
404 class GetLevel
405 {
406 public:
407 template <class ItemType>
408 static int getLevel(const GridImp & grid, const ItemType & item, int level )
409 {
410 alugrid_assert ( & item );
411 return (level < 0) ? item.level() : level;
412 }
413 };
414
415 // level is not needed for codim = 0
416 template <class GridImp, int dim>
417 class GetLevel<GridImp,dim,0>
418 {
419 public:
420 template <class ItemType>
421 static int getLevel(const GridImp & grid, const ItemType & item, int level )
422 {
423 return level;
424 }
425 };
426
427 template <class GridImp, int dim>
428 class GetLevel<GridImp, dim, dim>
429 {
430 public:
431 template <class ItemType>
432 static int getLevel(const GridImp & grid, const ItemType & item, int level)
433 {
434 return (level < 0) ? grid.getLevelOfLeafVertex(item) : level;
435 }
436 };
437
438protected:
439 // set iterator to first item
440 template <class GridImp, class IteratorImp>
441 void firstItem(const GridImp & grid, IteratorImp & it, int level )
442 {
443 InternalIteratorType & iter = it.internalIterator();
444 iter.first();
445 ValidItem<IteratorImp::codimension, GridImp> validate;
446 while(!validate(grid,iter))
447 {
448 iter.next();
449 if(iter.done())
450 {
451 it.removeIter();
452 return ;
453 }
454 }
455 if( ! iter.done() )
456 {
457 alugrid_assert ( iter.size() > 0 );
458 setItem(grid,it,iter,level);
459 }
460 else
461 {
462 it.removeIter();
463 }
464 }
465
466 // set the iterators entity to actual item
467 template <class GridImp, class IteratorImp>
468 void setItem (const GridImp & grid, IteratorImp & it, InternalIteratorType & iter, int level)
469 {
470 enum { codim = IteratorImp :: codimension };
471 val_t & item = iter.item();
472 alugrid_assert ( item.first || item.second );
473 if( item.first )
474 {
475 it.updateEntityPointer( item.first ,
476 GetLevel<GridImp,GridImp::dimension,codim>::getLevel(grid, *(item.first) , level) );
477 }
478 else
479 it.updateGhostPointer( *item.second );
480 }
481
482 // increment iterator
483 template <class GridImp, class IteratorImp>
484 void incrementIterator(const GridImp & grid, IteratorImp & it, int level)
485 {
486 // if iter_ is zero, then end iterator
487 InternalIteratorType & iter = it.internalIterator();
488 ValidItem<IteratorImp::codimension, GridImp> validate;
489 do{
490 iter.next();
491
492 if(iter.done())
493 {
494 it.removeIter();
495 return ;
496 }
497
498 }while(!(validate(grid,iter) ) );
499
500 setItem(grid,it,iter,level);
501 return ;
502 }
503
504private:
505 // in 2d check if item is valid
506 template <int codim, class GridImp>
507 struct ValidItem
508 {
509 bool operator()(const GridImp & grid, InternalIteratorType & iter)
510 {
511 if(GridImp::dimension ==3 || iter.done()) return true;
512 else if (GridImp::dimension == 2)
513 {
514 typedef typename ALU3dImplTraits<GridImp::elementType, typename GridImp::MPICommunicatorType>::template Codim<GridImp::dimension, codim>::ImplementationType GEOElementType;
515 val_t & item = iter.item();
516 alugrid_assert ( item.first || item.second );
517 if( item.first )
518 {
519 GEOElementType* elem = static_cast<GEOElementType*> (item.first);
520 //an element is valid if the 2d flag is set
521 return elem->is2d();
522 }
523 //if we have a ghost entity, it is the right one, as we did not insert non-2d elements into the ghostlist
524 // see alu3diterators.hh method updateGhostlist
525 else if( item.second )
526 return true;
527 }
528 return false;
529 }
530 };
531
532 template <class GridImp>
533 struct ValidItem<0, GridImp>
534 {
535 bool operator()(const GridImp & grid, InternalIteratorType & iter)
536 {
537 return true;
538 }
539 };
540
541};
542
543//**********************************************************************
544//
545// --ALU3dGridLevelIterator
546// --LevelIterator
550template<int cd, PartitionIteratorType pitype, class GridImp>
552: public ALU3dGridEntityPointer< cd, GridImp >,
553 public ALU3dGridTreeIterator<typename ALU3DSPACE IteratorSTI<
554 typename ALU3DSPACE IteratorElType< (GridImp::dimension == 2 && cd == 2) ? 3 : cd, typename GridImp::MPICommunicatorType >::val_t > >
555 //ALU3DSPACE ALU3dGridLevelIteratorWrapper< (GridImp::dimension == 2 && cd == 2) ? 3 : cd, pitype, typename GridImp::MPICommunicatorType > >
556{
557 enum { dim = GridImp::dimension };
558 enum { dimworld = GridImp::dimensionworld };
559
560 typedef typename GridImp::MPICommunicatorType Comm;
561
562 friend class ALU3dGridEntity<3,dim,GridImp>;
563 friend class ALU3dGridEntity<2,dim,GridImp>;
564 friend class ALU3dGridEntity<1,dim,GridImp>;
565 friend class ALU3dGridEntity<0,dim,GridImp>;
566 friend class ALU3dGrid< dim, dimworld, GridImp::elementType, Comm >;
567
568 friend class ALU3dGridTreeIterator<
569 typename ALU3DSPACE IteratorSTI<
570 typename ALU3DSPACE IteratorElType< (GridImp::dimension == 2 && cd == 2) ? 3 : cd, typename GridImp::MPICommunicatorType >::val_t >
571 //ALU3DSPACE ALU3dGridLevelIteratorWrapper< (GridImp::dimension == 2 && cd == 2) ? 3 : cd, pitype, Comm >
572 >;
573 typedef ALU3dGridEntityPointer< cd, GridImp > BaseType;
574
575public:
576 typedef typename GridImp::template Codim<cd>::Entity Entity;
577 typedef ALU3dGridVertexList< Comm > VertexListType;
578
580 typedef ALU3dGridLevelIterator<cd,pitype,GridImp> ThisType;
581 // the wrapper for the original iterator of the ALU3dGrid
582 //typedef typename ALU3DSPACE ALU3dGridLevelIteratorWrapper< (GridImp::dimension == 2 && cd == 2) ? 3 : cd, pitype, Comm > IteratorType;
583
584 typedef typename ALU3DSPACE IteratorElType< (GridImp::dimension == 2 && cd == 2) ? 3 : cd, Comm >::val_t val_t;
585 typedef typename ALU3DSPACE IteratorSTI< val_t > IteratorType ;
586 typedef IteratorType InternalIteratorType;
587
589 ALU3dGridLevelIterator () : grid_( nullptr ), iter_(), level_( 0 ) {}
590
592 ALU3dGridLevelIterator(const GridImp& grid, int level, bool);
593
595 ALU3dGridLevelIterator(const GridImp& grid, int level);
596
598 ALU3dGridLevelIterator(const ThisType & org);
599
600 // destructor
602
604 void increment ();
605
607 void releaseEntity () {}
608
610 ThisType & operator = (const ThisType & org);
611private:
613 void assign (const ThisType & org);
614
615 const GridImp &grid () const { alugrid_assert( grid_ ); return *grid_; }
616
617 // reference to factory class (ie grid)
618 const GridImp *grid_;
619
620 // the internal iterator
621 std::unique_ptr< IteratorType > iter_ ;
622
623 // actual level
624 int level_;
625
626 // deletes iter_
627 void removeIter ();
628
629 IteratorType & internalIterator ()
630 {
631 alugrid_assert ( iter_ );
632 return *iter_;
633 }
634};
635
636//********************************************************************
637//
638// --ALU3dGridLeafIterator
639// --LeafIterator
640//
641//********************************************************************
643template<int cdim, PartitionIteratorType pitype, class GridImp>
645: public ALU3dGridEntityPointer< cdim, GridImp >,
646 public ALU3dGridTreeIterator<typename ALU3DSPACE IteratorSTI<
647 typename ALU3DSPACE IteratorElType< (GridImp::dimension == 2 && cdim == 2) ? 3 : cdim, typename GridImp::MPICommunicatorType >::val_t > >
648{
649 enum { dim = GridImp :: dimension };
650
651 friend class ALU3dGridEntity<cdim,dim,GridImp>;
652 enum { codim = cdim };
653
654 typedef typename GridImp::MPICommunicatorType Comm;
655
656 typedef ALU3dGridEntityPointer< cdim, GridImp > BaseType;
657
658public:
659 typedef typename GridImp::template Codim<cdim>::Entity Entity;
660
661 typedef typename ALU3DSPACE IteratorElType< (GridImp::dimension == 2 && cdim == 2) ? 3 : cdim, Comm >::val_t val_t;
662 typedef typename ALU3DSPACE IteratorSTI< val_t > IteratorType ;
663 friend class ALU3dGridTreeIterator< IteratorType > ;
664
665 typedef IteratorType InternalIteratorType;
666
668
670 ALU3dGridLeafIterator () : grid_( nullptr ), iter_() {}
671
673 ALU3dGridLeafIterator(const GridImp& grid, int level);
674
676 ALU3dGridLeafIterator(const GridImp& grid, int level , bool isBegin);
677
679 ALU3dGridLeafIterator(const ThisType & org);
680
683
685 void increment ();
686
688 void releaseEntity () {}
689
691 ThisType & operator = (const ThisType & org);
692
693private:
694 const GridImp &grid () const { alugrid_assert( grid_ ); return *grid_; }
695
696 // reference to grid class (ie grid)
697 const GridImp *grid_;
698
699 // the internal iterator
700 std::unique_ptr< IteratorType > iter_;
701
703 void assign (const ThisType & org);
704
705 // deletes iter_
706 void removeIter () ;
707
708 // return reference to iter_
709 InternalIteratorType & internalIterator ()
710 {
711 alugrid_assert ( iter_ );
712 return *iter_;
713 }
714};
715
716// - HierarchicIteraor
717// --HierarchicIterator
718template<class GridImp>
719class ALU3dGridHierarchicIterator
720: public ALU3dGridEntityPointer<0,GridImp>
721// public HierarchicIteratorDefaultImplementation <GridImp,ALU3dGridHierarchicIterator>
722{
723 typedef ALU3dGridHierarchicIterator<GridImp> ThisType;
724 enum { dim = GridImp::dimension };
725
726 typedef typename GridImp::MPICommunicatorType Comm;
727
728 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
729 typedef typename ImplTraits::HElementType HElementType;
730 typedef typename ImplTraits::HBndSegType HBndSegType;
731
732 template < class PointerType, class CommT >
733 class GhostElementStorage;
734
736 template < class PointerType >
737 class GhostElementStorage< PointerType, ALUGridNoComm >
738 {
739 public:
740 GhostElementStorage() {}
741 explicit GhostElementStorage( const PointerType& ) {}
742 PointerType& operator * () { PointerType* p = 0; alugrid_assert ( false ); abort(); return *p; }
743 const PointerType* ghost () const { return 0; }
744 PointerType* nextGhost () const { return 0; }
745 PointerType* operator -> () const { return 0; }
746 bool operator != (const PointerType* ) const { return false; }
747 bool operator ! () const { return true ; }
748 GhostElementStorage& operator= (const GhostElementStorage& ) { return *this; }
749 GhostElementStorage& operator= (const PointerType* ) { return *this; }
750 bool valid () const { return false; }
751 };
752
754 template < class PointerType >
755 class GhostElementStorage< PointerType, ALUGridMPIComm >
756 {
757 private:
758 // pointers to ghost and current ghost
759 const HBndSegType * ghost_;
760 HBndSegType * nextGhost_;
761 public:
762 GhostElementStorage() : ghost_( 0 ), nextGhost_( 0 ) {}
763 explicit GhostElementStorage( const PointerType& gh ) : ghost_( &gh ), nextGhost_( 0 ) {}
764 GhostElementStorage( const GhostElementStorage& org )
765 : ghost_( org.ghost_ ), nextGhost_( org.nextGhost_ ) {}
766
767 PointerType& operator * () { alugrid_assert ( nextGhost_ ); return *nextGhost_; }
768 const PointerType* ghost () const { return ghost_; }
769 PointerType* nextGhost () const { return nextGhost_; }
770 PointerType* operator -> () { return nextGhost_; }
771 bool operator != (const PointerType* p ) const { return (nextGhost_ != p); }
772 bool operator ! () const { return nextGhost_ == 0; }
773 GhostElementStorage& operator= (const GhostElementStorage& org)
774 {
775 ghost_ = org.ghost_;
776 nextGhost_ = org.nextGhost_;
777 return *this;
778 }
779 GhostElementStorage& operator= (PointerType* p)
780 {
781 nextGhost_ = p;
782 return *this;
783 }
784 bool valid () const { return (ghost_ != 0); }
785 };
786
787public:
788 typedef typename GridImp::template Codim<0>::Entity Entity;
789 typedef typename GridImp::ctype ctype;
790
792 ALU3dGridHierarchicIterator(const HElementType & elem,
793 int maxlevel, bool end );
794
796 ALU3dGridHierarchicIterator(const HBndSegType& ghost,
797 int maxlevel,
798 bool end);
799
801 ALU3dGridHierarchicIterator(const ThisType &org);
802
804 ALU3dGridHierarchicIterator();
805
807 void increment();
808
810 void releaseEntity () {}
811
813 ThisType & operator = (const ThisType & org);
814
815private:
816 // assign iterator
817 void assign(const ThisType & org);
818
820 int getLevel(const HElementType* item) const;
821
823 int getLevel(const HBndSegType* face) const;
824
825 // go to next valid element
826 template <class HItemType>
827 HItemType* goNextElement (const HItemType* startElem, HItemType * oldEl);
828
830 const HElementType * elem_;
831
832 // pointers to ghost and current ghost
833 GhostElementStorage< HBndSegType, Comm > ghostElem_;
834
836 int maxlevel_;
837};
838
839
840} // end namespace Dune
841
842#if COMPILE_ALUGRID_INLINE
843 #include "iterator.cc"
844#endif
845#endif // header guard
int level() const
ask for level of entities
Definition: entity.hh:510
Definition: entity.hh:48
Definition: faceutility.hh:367
Definition: faceutility.hh:323
Definition: iterator.hh:56
int indexInOutside() const
Definition: iterator_imp.cc:298
NormalType integrationOuterNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
Definition: iterator_imp.cc:348
NormalType unitOuterNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
Definition: iterator_imp.cc:385
size_t boundarySegmentIndex() const
return the boundary segment index
Definition: iterator_imp.cc:419
EntityImp outside() const
access neighbor
Definition: iterator_imp.cc:237
int boundaryId() const
return information about the Boundary
Definition: iterator_imp.cc:411
int level() const
return level of iterator (level of item)
Definition: iterator_imp.cc:502
Twist twistInInside() const
returns twist of face compared to inner element
Definition: iterator_imp.cc:305
int segmentId() const
return the segment id (non-consecutive)
Definition: iterator_imp.cc:429
const BNDFaceType * ghost_
current pointer to ghost face if iterator was started from ghost element
Definition: iterator.hh:271
const GEOFaceType & getItem() const
return current face
Definition: iterator.hh:213
NormalType outerNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
Definition: iterator_imp.cc:356
void increment()
increment iterator
Definition: iterator_imp.cc:181
LocalGeometry geometryInOutside() const
Definition: iterator_imp.cc:338
Geometry geometry() const
Definition: iterator_imp.cc:394
bool equals(const ALU3dGridIntersectionIterator< GridImp > &i) const
The copy constructor.
Definition: iterator_imp.cc:171
EntityImp inside() const
access entity where iteration started
Definition: iterator_imp.cc:254
const GridImp * grid_
pointer to grid implementation
Definition: iterator.hh:274
LocalGeometry geometryInInside() const
Definition: iterator_imp.cc:289
ALU3dGridIntersectionIterator(const bool levelIntersectionIterator=false)
The default Constructor.
Definition: iterator_imp.cc:26
FaceInfoType connector_
Definition: iterator.hh:264
Twist twistInOutside() const
returns twist of face compared to outer element
Definition: iterator_imp.cc:312
bool neighbor() const
return true if across the face an neighbor on leaf exists
Definition: iterator_imp.cc:274
GeometryType type() const
obtain the type of reference element for this intersection
Definition: iterator_imp.cc:403
void assign(const ALU3dGridIntersectionIterator< GridImp > &org)
assignment of iterators
Definition: iterator_imp.cc:145
const IMPLElementType * item_
current element from which we started the intersection iterator
Definition: iterator.hh:268
bool conforming() const
return true if intersection is conforming
Definition: iterator.hh:207
int weight() const
return communication weight
Definition: iterator.hh:216
Dune::Intersection< GridImp, Dune::ALU3dGridIntersectionIterator< GridImp > > Intersection
type of the intersection
Definition: iterator.hh:115
bool boundary() const
return true if intersection is with boundary.
Definition: iterator_imp.cc:268
int indexInInside() const
Definition: iterator_imp.cc:281
Leaf iterator.
Definition: iterator.hh:648
void increment()
prefix increment
Definition: iterator.cc:222
void releaseEntity()
release entity
Definition: iterator.hh:688
ThisType & operator=(const ThisType &org)
assignment of iterators
Definition: iterator.cc:185
ALU3dGridLeafIterator()
default constructor
Definition: iterator.hh:670
~ALU3dGridLeafIterator()
destructor deleting real iterator
Definition: iterator.cc:169
Definition: iterator.hh:556
void increment()
prefix increment
Definition: iterator.cc:117
void releaseEntity()
release entity
Definition: iterator.hh:607
ThisType & operator=(const ThisType &org)
assignment of iterators
Definition: iterator.cc:109
ALU3dGridLevelIterator< cd, pitype, GridImp > ThisType
typedef of my type
Definition: iterator.hh:580
ALU3dGridLevelIterator()
default constructor
Definition: iterator.hh:589
[ provides Dune::Grid ]
Definition: grid.hh:434
Definition: topology.hh:40
Definition: topology.hh:151
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:125
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:23
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:164
Different resources needed by all grid implementations.
topology of a Cartesian grid
EnableIfInterOperable< T1, T2, bool >::type operator!=(const ForwardIteratorFacade< T1, V1, R1, D > &lhs, const ForwardIteratorFacade< T2, V2, R2, D > &rhs)
Checks for inequality.
Definition: iteratorfacades.hh:259
Provides proxy classes for IntersectionsIterators.
constexpr Ghost ghost
PartitionSet for the ghost partition.
Definition: partitionset.hh:284
Dune namespace.
Definition: alignedallocator.hh:13
void assign(T &dst, const T &src, bool mask)
masked Simd assignment (scalar version)
Definition: simd.hh:447
@ conforming
use only conforming bisection refinement
Definition: declaration.hh:25
Definition: alu3dinclude.hh:328
Static tag representing a codimension.
Definition: dimension.hh:24
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 21, 23:30, 2024)