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;
63 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
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,
83 ALU3dGridGeometricFaceInfoTetra< Comm >,
84 ALU3dGridGeometricFaceInfoHexa< Comm > >
::type GeometryInfoType;
86 typedef ElementTopologyMapping<GridImp::elementType> ElementTopo;
87 typedef FaceTopologyMapping<GridImp::elementType> FaceTopo;
89 enum { numFaces = EntityCount<GridImp::elementType>::numFaces };
90 enum { numVerticesPerFace =
91 EntityCount<GridImp::elementType>::numVerticesPerFace };
92 enum { numVertices = EntityCount<GridImp::elementType>::numVertices };
94 typedef ALU3dGridIntersectionIterator<GridImp> ThisType;
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;
295 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
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,
309 ALU3dGridGeometricFaceInfoTetra< Comm >,
310 ALU3dGridGeometricFaceInfoHexa< Comm > >
::type GeometryInfoType;
312 typedef ElementTopologyMapping<GridImp::elementType> ElementTopo;
313 typedef FaceTopologyMapping<GridImp::elementType> FaceTopo;
315 enum { numFaces = EntityCount<GridImp::elementType>::numFaces };
316 enum { numVerticesPerFace =
317 EntityCount<GridImp::elementType>::numVerticesPerFace };
318 enum { numVertices = EntityCount<GridImp::elementType>::numVertices };
320 typedef ALU3dGridIntersectionIterator<GridImp> BaseType;
321 typedef ALU3dGridLevelIntersectionIterator<GridImp> ThisType;
347 int wLevel,
bool end=
false);
355 void assign(
const ThisType & org);
361 template <
class EntityType>
362 void first(
const EntityType & en,
int wLevel);
379 void setNewFace(
const GEOFaceType& newFace);
382 void setFirstItem(
const HElementType & elem,
int wLevel);
385 void setInteriorItem(
const HElementType & elem,
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>
433 static int getLevel(
const GridImp & grid,
const ItemType & item,
int level)
435 return (level < 0) ? grid.getLevelOfLeafVertex(item) : level;
441 template <
class Gr
idImp,
class IteratorImp>
442 void firstItem(
const GridImp & grid, IteratorImp & it,
int level )
444 InternalIteratorType & iter = it.internalIterator();
448 assert( iter.size() > 0 );
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();
500 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp>
501 class ALU3dGridLevelIterator
502 :
public ALU3dGridEntityPointer< cd, GridImp >,
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;
581 template<
int cdim, PartitionIteratorType pitype,
class Gr
idImp>
582 class ALU3dGridLeafIterator
583 :
public ALU3dGridEntityPointer< cdim, GridImp >,
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;
632 IteratorType * iter_;
638 void assign (
const ThisType & org);
644 InternalIteratorType & internalIterator ()
653 template<
class Gr
idImp>
654 class ALU3dGridHierarchicIterator
655 :
public ALU3dGridEntityPointer<0,GridImp>
658 typedef ALU3dGridHierarchicIterator<GridImp> ThisType;
659 enum { dim = GridImp::dimension };
661 typedef typename GridImp::MPICommunicatorType Comm;
663 typedef ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits;
664 typedef typename ImplTraits::HElementType HElementType;
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,
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 releaseEntity()
release entity
Definition: alugrid/3d/iterator.hh:550
GridImp::ctype ctype
Definition: alugrid/3d/iterator.hh:728
void increment()
prefix increment
Definition: iterator.cc:238
Definition: alugrid/3d/entity.hh:24
GitterImplType::Objects::Hbnd4Default BNDFaceType
Definition: alu3dinclude.hh:264
int level() const
ask for level of entities
void releaseEntity()
release entity
Definition: alugrid/3d/iterator.hh:751
void increment()
increment
Definition: iterator.cc:428
Definition: alugrid/3d/entity.hh:22
int indexInInside() const
~ALU3dGridLeafIterator()
destructor deleting real iterator
Definition: iterator.cc:180
void increment()
prefix increment
Definition: iterator.cc:111
ALU3dGridHierarchicIterator(const FactoryType &factory, const HElementType &elem, int maxlevel, bool end)
the normal Constructor
Definition: iterator.cc:275
const IMPLElementType * item_
current element from which we started the intersection iterator
Definition: alugrid/3d/iterator.hh:270
GitterType::Geometric::hexa_GEO GEOElementType
Definition: alu3dinclude.hh:260
ThisType & operator=(const ThisType &org)
assignment of iterators
Definition: iterator.cc:103
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:18
ALU3DSPACE IteratorElType< cd, Comm >::val_t val_t
Definition: alugrid/3d/iterator.hh:529
NormalType & unitOuterNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
IteratorType InternalIteratorType
Definition: alugrid/3d/iterator.hh:528
size_t boundarySegmentIndex() const
return the boundary segment index
ConformanceState conformanceState() const
Description of conformance on the face.
NormalType unitOuterNormal_
Definition: alugrid/3d/iterator.hh:283
const BNDFaceType * ghost_
current pointer to ghost face if iterator was started from ghost element
Definition: alugrid/3d/iterator.hh:273
GridImp::template Codim< 1 >::Geometry Geometry
Definition: alugrid/3d/iterator.hh:109
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
int innerLevel_
Definition: alugrid/3d/iterator.hh:275
int twistInInside() const
returns twist of face compared to inner element
void increment()
increment iterator
Definition: alugrid/3d/iterator.hh:398
Definition: alugrid/3d/grid.hh:68
void firstItem(const GridImp &grid, IteratorImp &it, int level)
Definition: alugrid/3d/iterator.hh:442
Include standard header files.
Definition: agrid.hh:59
Definition: faceutility.hh:48
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/entity.hh:711
Definition: alugrid/3d/iterator.hh:405
GitterType::Geometric::tetra_GEO GEOElementType
Definition: alu3dinclude.hh:213
ThisType & operator=(const ThisType &org)
assignment of iterators
Definition: iterator.cc:200
Entity & dereference() const
dereference Entity, faster then the entity pointersmethod
Definition: iterator.cc:247
void setNewFace(const GEOFaceType &newFace)
Definition: alugrid/3d/entity.hh:588
GeometryInfoType geoProvider_
Definition: alugrid/3d/iterator.hh:264
Dune::Intersection< GridImp, Dune::ALU3dGridIntersectionIterator< GridImp > > Intersection
type of the intersection
Definition: alugrid/3d/iterator.hh:114
Ghost ghost
PartitionSet for the ghost partition.
Definition: partitionset.hh:238
ThisType & operator=(const ThisType &org)
the assignment operator
Definition: iterator.cc:347
void setFirstItem(const HElementType &elem, int wLevel)
Entity & dereference() const
dereference Entity, faster then the entity pointersmethod
Definition: iterator.cc:459
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:725
GridImp::template Codim< cd >::Entity Entity
type of Entity
Definition: alugrid/3d/entity.hh:717
Definition: topology.hh:13
GridImp::template Codim< 0 >::Entity Entity
Definition: alugrid/3d/iterator.hh:108
void first(const EntityType &en, int wLevel)
IntersectionIteratorType
Definition: alugrid/3d/iterator.hh:100
GridImp::Traits::template Codim< 1 >::GeometryImpl GeometryImpl
Definition: alugrid/3d/iterator.hh:102
Definition: alugrid/3d/iterator.hh:41
ALU3dGridEntityPointer< 0, GridImp > EntityPointer
Definition: alugrid/3d/iterator.hh:117
InternalIteratorType::val_t val_t
Definition: alugrid/3d/iterator.hh:401
GridImp::template Codim< 0 >::Entity Entity
Definition: alugrid/3d/iterator.hh:727
[ provides Dune::Grid ]
Definition: alugrid/3d/entity.hh:36
GridImp::Traits::template Codim< 1 >::LocalGeometryImpl LocalGeometryImpl
Definition: alugrid/3d/iterator.hh:103
int level() const
return level of iterator (level of item)
GeometryImpl intersectionGlobal_
Definition: alugrid/3d/iterator.hh:278
ALU3dGridIntersectionIterator(const FactoryType &factory, HElementType *el, int wLevel, bool end=false)
Definition: alugrid/3d/iterator.hh:100
Entity & dereference() const
dereference Entity, faster then the entity pointersmethod
Definition: iterator.cc:119
bool conforming() const
return true if intersection is conforming
Definition: alugrid/3d/iterator.hh:211
ALU3DSPACE ALU3dGridLevelIteratorWrapper< cd, pitype, Comm > IteratorType
Definition: alugrid/3d/iterator.hh:527
const GEOFaceType & face() const
Returns the ALU3dGrid face.
void releaseEntity()
release entity
Definition: alugrid/3d/iterator.hh:625
NormalType & outerNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
void buildLocalGeometries() const
FieldVector< alu3d_ctype, dimworld > NormalType
Definition: alugrid/3d/iterator.hh:116
ALU3dGridIntersectionIterator< GridImp > ImplementationType
Definition: alugrid/3d/iterator.hh:112
organize the memory management for entitys used by the NeighborIterator
Definition: alugrid/2d/grid.hh:68
Provides proxy classes for IntersectionsIterators.
Different resources needed by all grid implementations.
ALU3dGridLevelIterator< cd, pitype, GridImp > ThisType
typedef of my type
Definition: alugrid/3d/iterator.hh:525
Definition: alugrid/3d/entity.hh:32
ALU3dGridLeafIterator< cdim, pitype, GridImp > ThisType
Definition: alugrid/3d/iterator.hh:604
Definition: alugrid/3d/entity.hh:26
int twistInOutside() const
returns twist of face compared to outer element
GridImp::template Codim< cdim >::Entity Entity
Definition: alugrid/3d/iterator.hh:596
FaceInfoType connector_
Definition: alugrid/3d/iterator.hh:263
bool neighbor() const
return true if across the edge an neighbor on this level exists
void setInteriorItem(const HElementType &elem, const BNDFaceType &bnd, int wLevel)
void first(const EntityType &en, int wLevel)
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:106
bool neighbor() const
return true if across the face an neighbor on leaf exists
void increment()
increment iterator
const GEOFaceType & getItem() const
return current face
Definition: alugrid/3d/iterator.hh:217
void setItem(const GridImp &grid, IteratorImp &it, InternalIteratorType &iter, int level)
Definition: alugrid/3d/iterator.hh:459
Definition: alu3dinclude.hh:201
const ALU3dImplTraits< tetra, Comm >::GEOFaceType * getFace(const GEOTriangleBndType &bnd, int index) const
Geometry geometry() const
Intersection of a mesh entities of codimension 0 ("elements") with a "neighboring" element or with th...
Definition: albertagrid/dgfparser.hh:26
GeometryImpl intersectionSelfLocal_
Definition: alugrid/3d/iterator.hh:279
static int getLevel(const GridImp &grid, const ItemType &item, int level)
Definition: alugrid/3d/iterator.hh:409
static int getLevel(const GridImp &grid, const ItemType &item, int level)
Definition: alugrid/3d/iterator.hh:422
#define ALU3DSPACE
Definition: alu3dinclude.hh:26
ALU3DSPACE ALU3dGridLeafIteratorWrapper< cdim, pitype, Comm > IteratorType
Definition: alugrid/3d/iterator.hh:598
bool conformingRefinement() const
return true if conforming refinement is enabled
Definition: faceutility.hh:140
Definition: alugrid/3d/iterator.hh:100
static int getLevel(const GridImp &grid, const ItemType &item, int level)
Definition: alugrid/3d/iterator.hh:433
ALU3dGridLevelIntersectionIterator(const FactoryType &factory, HElementType *el, int wLevel, bool end=false)
GridImp::template Codim< 1 >::LocalGeometry LocalGeometry
Definition: alugrid/3d/iterator.hh:110
Definition: alugrid/3d/iterator.hh:100
void assign(const ThisType &org)
assignment of iterators
EntityPointer outside() const
access neighbor
int indexInOutside() const
int boundaryId() const
return information about the Boundary
int index_
Definition: alugrid/3d/iterator.hh:276
bool boundary() const
return true if intersection is with boundary.
bool conforming() const
return true if intersection is conforming
Definition: alugrid/3d/iterator.hh:368
ALU3dGridLeafIterator(const FactoryType &factory, int level)
Constructor for end iterators.
Definition: iterator.cc:143
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:339
LocalGeometry geometryInInside() const
GridImp::GridObjectFactoryType FactoryType
Definition: alugrid/3d/iterator.hh:594
GeometryType type() const
obtain the type of reference element for this intersection
void assign(const ALU3dGridIntersectionIterator< GridImp > &org)
assignment of iterators
ALUMemoryProvider< ThisType > StorageType
Definition: alugrid/3d/iterator.hh:119
const FactoryType & factory_
Definition: alugrid/3d/iterator.hh:267
NormalType & integrationOuterNormal(const FieldVector< alu3d_ctype, dim-1 > &local) const
Leaf iterator.
Definition: alugrid/3d/entity.hh:34
EntityPointer inside() const
access entity where iteration started
ALUMemoryProvider< ThisType > StorageType
Definition: alugrid/3d/iterator.hh:341
ALU3DSPACE IteratorElType< cdim, Comm >::val_t val_t
Definition: alugrid/3d/iterator.hh:602
int outsideLevel() const
Definition: alugrid/3d/iterator.hh:208
void done(const EntityType &en)
Definition: alugrid/3d/iterator.hh:222
GitterImplType::Objects::Hbnd3Default BNDFaceType
Definition: alu3dinclude.hh:217
IteratorType InternalIteratorType
Definition: alugrid/3d/iterator.hh:601
bool equals(const ALU3dGridIntersectionIterator< GridImp > &i) const
The copy constructor.
void incrementIterator(const GridImp &grid, IteratorImp &it, int level)
Definition: alugrid/3d/iterator.hh:475
LocalGeometry geometryInOutside() const
GeometryImpl intersectionNeighborLocal_
Definition: alugrid/3d/iterator.hh:280
Definition: alu3dinclude.hh:296