4 #ifndef DUNE_ALU3DGRIDITERATOR_HH 5 #define DUNE_ALU3DGRIDITERATOR_HH 22 template<
int cd,
int dim,
class Gr
idImp>
23 class ALU3dGridEntity;
24 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp >
25 class ALU3dGridLevelIterator;
26 template<
int cd,
class Gr
idImp >
27 class ALU3dGridEntityPointer;
28 template<
int mydim,
int coorddim,
class Gr
idImp>
29 class ALU3dGridGeometry;
30 template<
class Gr
idImp>
31 class ALU3dGridHierarchicIterator;
32 template<
class Gr
idImp>
33 class ALU3dGridIntersectionIterator;
34 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp>
35 class ALU3dGridLeafIterator;
36 template< ALU3dGr
idElementType,
class >
38 template< ALU3dGr
idElementType,
class >
39 class ALU3dGridFaceInfo;
40 template< ALU3dGr
idElementType,
class >
54 template<
class Gr
idImp>
58 enum { dim = GridImp::dimension };
59 enum { dimworld = GridImp::dimensionworld };
61 typedef typename GridImp::MPICommunicatorType Comm;
65 typedef typename ImplTraits::HElementType HElementType ;
66 typedef typename ImplTraits::HBndSegType HBndSegType;
67 typedef typename ImplTraits::GEOElementType GEOElementType;
68 typedef typename ImplTraits::IMPLElementType IMPLElementType;
69 typedef typename ImplTraits::GEOFaceType GEOFaceType;
70 typedef typename ImplTraits::NeighbourPairType NeighbourPairType;
71 typedef typename ImplTraits::BNDFaceType BNDFaceType;
79 typedef typename std::unique_ptr< FaceInfoType > FaceInfoPointer;
81 typedef typename conditional<
82 tetra == GridImp::elementType,
90 enum { numVerticesPerFace =
102 typedef typename GridImp::Traits::template Codim< 1 >::GeometryImpl
GeometryImpl;
108 typedef typename GridImp::template Codim<0>::Entity
Entity;
109 typedef typename GridImp::template Codim<1>::Geometry
Geometry;
125 int wLevel,
bool end=
false);
145 EntityPointer
inside()
const;
195 NormalType &
unitOuterNormal (
const FieldVector<alu3d_ctype, dim-1>& local)
const ;
199 NormalType &
outerNormal (
const FieldVector<alu3d_ctype, dim-1>& local)
const;
222 template<
class EntityType >
void done (
const EntityType &en ) {
done(); }
225 void setFirstItem(
const HElementType & elem,
int wLevel);
229 const BNDFaceType& bnd,
int wLevel);
232 template <
class EntityType>
233 void first(
const EntityType & en,
int wLevel);
240 void setGhostFace(
const GEOFaceType& newFace);
248 getFace (
const GEOTriangleBndType &bnd,
int index )
const;
252 getFace (
const GEOQuadBndType &bnd,
int index )
const;
256 getFace (
const GEOTetraElementType &elem,
int index )
const;
259 getFace (
const GEOHexaElementType &elem,
int index )
const;
286 template<
class Gr
idImp>
290 enum { dim = GridImp::dimension };
291 enum { dimworld = GridImp::dimensionworld };
293 typedef typename GridImp::MPICommunicatorType Comm;
297 typedef typename ImplTraits::HElementType HElementType ;
298 typedef typename ImplTraits::GEOElementType GEOElementType;
299 typedef typename ImplTraits::IMPLElementType IMPLElementType;
300 typedef typename ImplTraits::GEOFaceType GEOFaceType;
301 typedef typename ImplTraits::NeighbourPairType NeighbourPairType;
302 typedef typename ImplTraits::BNDFaceType BNDFaceType;
305 typedef typename std::unique_ptr< FaceInfoType > FaceInfoPointer;
307 typedef typename conditional<
308 tetra == GridImp::elementType,
316 enum { numVerticesPerFace =
326 using BaseType :: item_;
327 using BaseType :: ghost_;
328 using BaseType :: innerLevel_;
329 using BaseType :: index_;
330 using BaseType :: connector_;
331 using BaseType :: geoProvider_;
332 using BaseType :: factory_;
333 using BaseType :: boundary;
334 using BaseType :: done ;
335 using BaseType :: getFace;
336 using BaseType :: neighbor ;
347 int wLevel,
bool end=
false);
355 void assign(
const ThisType & org);
361 template <
class EntityType>
362 void first(
const EntityType & en,
int wLevel);
382 void setFirstItem(
const HElementType & elem,
int wLevel);
386 const BNDFaceType& bnd,
int wLevel);
397 template <
class InternalIteratorType >
401 typedef typename InternalIteratorType :: val_t
val_t;
404 template <
class Gr
idImp,
int codim>
408 template <
class ItemType>
409 static int getLevel(
const GridImp & grid,
const ItemType & item,
int level )
412 return (level < 0) ? item.level() :
level;
417 template <
class Gr
idImp>
421 template <
class ItemType>
422 static int getLevel(
const GridImp & grid,
const ItemType & item,
int level )
428 template <
class Gr
idImp>
432 template <
class ItemType>
435 return (level < 0) ? grid.getLevelOfLeafVertex(item) :
level;
441 template <
class Gr
idImp,
class IteratorImp>
444 InternalIteratorType & iter = it.internalIterator();
448 assert( iter.size() > 0 );
449 setItem(grid,it,iter,level);
458 template <
class Gr
idImp,
class IteratorImp>
459 void setItem (
const GridImp & grid, IteratorImp & it, InternalIteratorType & iter,
int level)
461 enum { codim = IteratorImp :: codimension };
462 val_t & item = iter.item();
463 assert( item.first || item.second );
466 it.updateEntityPointer( item.first ,
467 GetLevel<GridImp,codim>::getLevel(grid, *(item.first) , level) );
470 it.updateGhostPointer( *item.second );
474 template <
class Gr
idImp,
class IteratorImp>
478 InternalIteratorType & iter = it.internalIterator();
488 setItem(grid,it,iter,level);
500 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp>
503 public ALU3dGridTreeIterator< ALU3DSPACE ALU3dGridLevelIteratorWrapper< cd, pitype, typename GridImp::MPICommunicatorType > >
505 enum { dim = GridImp::dimension };
506 enum { dimworld = GridImp::dimensionworld };
508 typedef typename GridImp::MPICommunicatorType Comm;
547 Entity & dereference () const;
550 void releaseEntity () {}
581 template<
int cdim, PartitionIteratorType pitype,
class Gr
idImp>
584 public ALU3dGridTreeIterator< ALU3DSPACE ALU3dGridLeafIteratorWrapper< cdim, pitype, typename GridImp::MPICommunicatorType > >
586 enum { dim = GridImp :: dimension };
589 enum { codim = cdim };
591 typedef typename GridImp::MPICommunicatorType Comm;
596 typedef typename GridImp::template Codim<cdim>::Entity
Entity;
622 Entity & dereference ()
const;
628 ThisType & operator = (
const ThisType & org);
632 IteratorType * iter_;
638 void assign (
const ThisType & org);
644 InternalIteratorType & internalIterator ()
653 template<
class Gr
idImp>
659 enum { dim = GridImp::dimension };
661 typedef typename GridImp::MPICommunicatorType Comm;
665 typedef typename ImplTraits::HBndSegType
HBndSegType;
667 template <
class Po
interType,
class CommT >
668 class GhostElementStorage;
671 template <
class Po
interType >
672 class GhostElementStorage< PointerType, No_Comm >
675 GhostElementStorage() {}
676 explicit GhostElementStorage(
const PointerType& ) {}
677 PointerType& operator * () { PointerType* p = 0; assert(
false ); abort();
return *p; }
678 const PointerType*
ghost ()
const {
return 0; }
679 PointerType* nextGhost ()
const {
return 0; }
680 PointerType* operator -> ()
const {
return 0; }
681 bool operator != (
const PointerType* )
const {
return false; }
682 bool operator ! ()
const {
return true ; }
683 GhostElementStorage& operator= (
const GhostElementStorage& ) {
return *
this; }
684 GhostElementStorage& operator= (
const PointerType* ) {
return *
this; }
685 bool valid ()
const {
return false; }
688 #if ALU3DGRID_PARALLEL 689 template <
class Po
interType >
691 class GhostElementStorage< PointerType, MPI_Comm >
695 const HBndSegType *
ghost_;
696 HBndSegType * nextGhost_;
698 GhostElementStorage() :
ghost_( 0 ), nextGhost_( 0 ) {}
699 explicit GhostElementStorage(
const PointerType& gh ) :
ghost_( &gh ), nextGhost_( 0 ) {}
700 GhostElementStorage(
const GhostElementStorage& org )
701 :
ghost_( org.ghost_ ), nextGhost_( org.nextGhost_ ) {}
703 PointerType& operator * () { assert( nextGhost_ );
return *nextGhost_; }
704 const PointerType*
ghost ()
const {
return ghost_; }
705 PointerType* nextGhost ()
const {
return nextGhost_; }
706 PointerType* operator -> () {
return nextGhost_; }
707 bool operator != (
const PointerType* p )
const {
return (nextGhost_ != p); }
708 bool operator ! ()
const {
return nextGhost_ == 0; }
709 GhostElementStorage& operator= (
const GhostElementStorage& org)
712 nextGhost_ = org.nextGhost_;
715 GhostElementStorage& operator= (PointerType* p)
720 bool valid ()
const {
return (ghost_ != 0); }
727 typedef typename GridImp::template Codim<0>::Entity
Entity;
728 typedef typename GridImp::ctype
ctype;
732 const HElementType & elem,
733 int maxlevel,
bool end );
737 const HBndSegType&
ghost,
748 Entity & dereference ()
const;
754 ThisType & operator = (
const ThisType & org);
758 void assign(
const ThisType & org);
761 int getLevel(
const HElementType* item)
const;
764 int getLevel(
const HBndSegType* face)
const;
767 template <
class HItemType>
768 HItemType* goNextElement (
const HItemType* startElem, HItemType * oldEl);
771 const HElementType * elem_;
774 GhostElementStorage< HBndSegType, Comm > ghostElem_;
783 #include "iterator_imp.cc" void done(const EntityType &en)
Definition: alugrid/3d/iterator.hh:222
GridImp::template Codim< 0 >::Entity Entity
Definition: alugrid/3d/iterator.hh:727
ImplTraits::HBndSegType HBndSegType
Definition: alugrid/3d/entity.hh:700
ALU3dGridIntersectionIterator(const FactoryType &factory, HElementType *el, int wLevel, bool end=false)
const GEOFaceType & face() const
Returns the ALU3dGrid face.
Definition: faceutility.hh:48
Definition: alugrid/3d/iterator.hh:41
bool conformingRefinement() const
return true if conforming refinement is enabled
Definition: faceutility.hh:140
ALU3DSPACE ALU3dGridLevelIteratorWrapper< cd, pitype, Comm > IteratorType
Definition: alugrid/3d/iterator.hh:527
Definition: alugrid/3d/iterator.hh:398
[ provides Dune::Grid ]
Definition: alugrid/3d/entity.hh:36
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: albertagrid/dgfparser.hh:26
IntersectionIteratorType
Definition: alugrid/3d/iterator.hh:100
GeometryImpl intersectionSelfLocal_
Definition: alugrid/3d/iterator.hh:279
Definition: alugrid/3d/grid.hh:68
GeometryImpl intersectionGlobal_
Definition: alugrid/3d/iterator.hh:278
void first(const EntityType &en, int wLevel)
const BNDFaceType * ghost_
current pointer to ghost face if iterator was started from ghost element
Definition: alugrid/3d/iterator.hh:273
Geometry geometry() const
Dune::Intersection< GridImp, Dune::ALU3dGridIntersectionIterator< GridImp > > Intersection
type of the intersection
Definition: alugrid/3d/iterator.hh:114
bool equals(const ALU3dGridIntersectionIterator< GridImp > &i) const
The copy constructor.
organize the memory management for entitys used by the NeighborIterator
Definition: alugrid/2d/grid.hh:68
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:339
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
NormalType & unitOuterNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
Definition: alugrid/3d/iterator.hh:405
LocalGeometry geometryInOutside() const
ALU3DSPACE IteratorElType< cd, Comm >::val_t val_t
Definition: alugrid/3d/iterator.hh:529
void setItem(const GridImp &grid, IteratorImp &it, InternalIteratorType &iter, int level)
Definition: alugrid/3d/iterator.hh:459
Definition: topology.hh:13
ALUMemoryProvider< ThisType > StorageType
Definition: alugrid/3d/iterator.hh:341
void incrementIterator(const GridImp &grid, IteratorImp &it, int level)
Definition: alugrid/3d/iterator.hh:475
GeometryType type() const
obtain the type of reference element for this intersection
Provides proxy classes for IntersectionsIterators.
void releaseEntity()
release entity
Definition: alugrid/3d/iterator.hh:625
NormalType & outerNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
Definition: alugrid/3d/entity.hh:32
NormalType & integrationOuterNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
int index_
Definition: alugrid/3d/iterator.hh:276
static int getLevel(const GridImp &grid, const ItemType &item, int level)
Definition: alugrid/3d/iterator.hh:422
Definition: alu3dinclude.hh:201
Definition: alugrid/3d/entity.hh:26
const IMPLElementType * item_
current element from which we started the intersection iterator
Definition: alugrid/3d/iterator.hh:270
IteratorType InternalIteratorType
Definition: alugrid/3d/iterator.hh:528
int outsideLevel() const
Definition: alugrid/3d/iterator.hh:208
ALU3DSPACE IteratorElType< cdim, Comm >::val_t val_t
Definition: alugrid/3d/iterator.hh:602
ImplTraits::template Codim< cd >::InterfaceType HElementType
Definition: alugrid/3d/entity.hh:698
bool conforming() const
return true if intersection is conforming
Definition: alugrid/3d/iterator.hh:211
void releaseEntity()
release entity
Definition: alugrid/3d/iterator.hh:751
int indexInOutside() const
int indexInInside() const
Definition: topology.hh:16
FieldVector< alu3d_ctype, dimworld > NormalType
Definition: alugrid/3d/iterator.hh:116
Definition: alugrid/common/declaration.hh:20
EntityPointer inside() const
access entity where iteration started
bool conforming() const
return true if intersection is conforming
Definition: alugrid/3d/iterator.hh:368
static int getLevel(const GridImp &grid, const ItemType &item, int level)
Definition: alugrid/3d/iterator.hh:409
LocalGeometry geometryInInside() const
Definition: faceutility.hh:364
EntityPointer outside() const
access neighbor
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:594
Definition: alugrid/3d/entity.hh:588
int boundaryId() const
return information about the Boundary
Definition: alugrid/3d/iterator.hh:100
GridImp::template Codim< 1 >::Geometry Geometry
Definition: alugrid/3d/iterator.hh:109
Definition: topology.hh:126
Definition: alugrid/3d/entity.hh:30
void setNewFace(const GEOFaceType &newFace)
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:18
void setFirstItem(const HElementType &elem, int wLevel)
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:106
void firstItem(const GridImp &grid, IteratorImp &it, int level)
Definition: alugrid/3d/iterator.hh:442
Leaf iterator.
Definition: alugrid/3d/entity.hh:34
void assign(const ALU3dGridIntersectionIterator< GridImp > &org)
assignment of iterators
const GEOFaceType & getItem() const
return current face
Definition: alugrid/3d/iterator.hh:217
GridImp::Traits::template Codim< 1 >::GeometryImpl GeometryImpl
Definition: alugrid/3d/iterator.hh:102
const FactoryType & factory_
Definition: alugrid/3d/iterator.hh:267
FaceInfoType connector_
Definition: alugrid/3d/iterator.hh:263
GridImp::ctype ctype
Definition: alugrid/3d/iterator.hh:728
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:725
Definition: faceutility.hh:320
ALU3DSPACE ALU3dGridLeafIteratorWrapper< cdim, pitype, Comm > IteratorType
Definition: alugrid/3d/iterator.hh:598
ALUMemoryProvider< ThisType > StorageType
Definition: alugrid/3d/iterator.hh:119
GridImp::template Codim< cd >::Entity Entity
type of Entity
Definition: alugrid/3d/entity.hh:717
Definition: alu3dinclude.hh:296
InternalIteratorType::val_t val_t
Definition: alugrid/3d/iterator.hh:401
ALU3dGridIntersectionIterator< GridImp > ImplementationType
Definition: alugrid/3d/iterator.hh:112
Include standard header files.
Definition: agrid.hh:59
GridImp::template Codim< cdim >::Entity Entity
Definition: alugrid/3d/iterator.hh:596
#define ALU3DSPACE
Definition: alu3dinclude.hh:26
void increment()
increment iterator
int twistInOutside() const
returns twist of face compared to outer element
ConformanceState conformanceState() const
Description of conformance on the face.
Definition: alugrid/3d/iterator.hh:100
IteratorType InternalIteratorType
Definition: alugrid/3d/iterator.hh:601
ALU3dGridLeafIterator< cdim, pitype, GridImp > ThisType
Definition: alugrid/3d/iterator.hh:604
bool boundary() const
return true if intersection is with boundary.
const ALU3dImplTraits< tetra, Comm >::GEOFaceType * getFace(const GEOTriangleBndType &bnd, int index) const
void setInteriorItem(const HElementType &elem, const BNDFaceType &bnd, int wLevel)
int level() const
return level of iterator (level of item)
bool neighbor() const
return true if across the face an neighbor on leaf exists
Different resources needed by all grid implementations.
Ghost ghost
PartitionSet for the ghost partition.
Definition: partitionset.hh:238
Definition: alugrid/3d/entity.hh:24
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/entity.hh:711
GeometryImpl intersectionNeighborLocal_
Definition: alugrid/3d/iterator.hh:280
NormalType unitOuterNormal_
Definition: alugrid/3d/iterator.hh:283
ALU3dGridEntityPointer< 0, GridImp > EntityPointer
Definition: alugrid/3d/iterator.hh:117
int innerLevel_
Definition: alugrid/3d/iterator.hh:275
GeometryInfoType geoProvider_
Definition: alugrid/3d/iterator.hh:264
Definition: alugrid/3d/entity.hh:22
static int getLevel(const GridImp &grid, const ItemType &item, int level)
Definition: alugrid/3d/iterator.hh:433
GridImp::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl
Definition: alugrid/3d/iterator.hh:103
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: alugrid/3d/iterator.hh:110
int twistInInside() const
returns twist of face compared to inner element
size_t boundarySegmentIndex() const
return the boundary segment index
Definition: alugrid/3d/iterator.hh:100
Definition: topology.hh:40
void buildLocalGeometries() const
GridImp::template Codim< 0 >::Entity Entity
Definition: alugrid/3d/iterator.hh:108