1 #ifndef DUNE_ALU3DGRIDENTITY_HH
2 #define DUNE_ALU3DGRIDENTITY_HH
8 #include <dune/grid/common/entity.hh>
21 template<
int cd,
int dim,
class Gr
idImp>
22 class ALU3dGridEntity;
23 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp >
24 class ALU3dGridLevelIterator;
25 template<
int cd,
class Gr
idImp >
26 class ALU3dGridEntityPointer;
27 template<
int mydim,
int coorddim,
class Gr
idImp>
28 class ALU3dGridGeometry;
29 template<
class Gr
idImp>
30 class ALU3dGridHierarchicIterator;
31 template<
class Gr
idImp>
32 class ALU3dGridIntersectionIterator;
33 template<
int codim, PartitionIteratorType,
class Gr
idImp>
34 class ALU3dGridLeafIterator;
35 template<
int dim,
int dimworld, ALU3dGr
idElementType,
class >
44 template<
int cd,
int dim,
class Gr
idImp>
46 public EntityDefaultImplementation <cd,dim,GridImp,ALU3dGridEntity>
49 template <
class Gr
idType,
int dm,
int cdim>
52 template <
class ItemType>
53 static int getLevel(
const GridType & grid,
const ItemType & item )
62 template <
class Gr
idType>
63 struct GetLevel<GridType,dim,dim>
65 template <
class ItemType>
66 static int getLevel(
const GridType & grid,
const ItemType & item)
68 return (item.isLeafEntity()) ? grid.getLevelOfLeafVertex(item) : item.level();
72 enum { dimworld = GridImp::dimensionworld };
74 typedef typename GridImp::MPICommunicatorType Comm;
76 friend class ALU3dGrid< GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
84 typedef typename GridImp::Traits::template Codim< cd >::GeometryImpl GeometryImpl;
88 typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType
HItemType;
89 typedef typename ImplTraits::template Codim<dim, cd>::ImplementationType
ItemType;
96 #if !DUNE_VERSION_NEWER(DUNE_GRID,2,5)
144 DUNE_THROW( NotImplemented,
"Method subIndex for higher codimension not implemented, yet." );
192 template<
int dim,
class Gr
idImp>
194 :
public EntityDefaultImplementation<0,dim,GridImp,ALU3dGridEntity>
196 static const int dimworld = std::remove_const< GridImp >::type::dimensionworld;
197 static const ALU3dGridElementType elementType = std::remove_const< GridImp >::type::elementType;
199 typedef typename GridImp::MPICommunicatorType Comm;
202 typedef typename ImplTraits::template Codim<dim, 0>::InterfaceType HElementType;
204 typedef typename ImplTraits::GEOElementType GEOElementType;
205 typedef typename ImplTraits::BNDFaceType BNDFaceType;
206 typedef typename ImplTraits::IMPLElementType IMPLElementType;
207 typedef typename ImplTraits::HBndSegType
HBndSegType;
209 enum { refine_element_t = ImplTraits::RefinementRules::refine_element_t };
210 enum { bisect_element_t = ImplTraits::RefinementRules::bisect_element_t };
211 enum { coarse_element_t = ImplTraits::RefinementRules::coarse_element_t };
212 enum { nosplit_element_t = ImplTraits::RefinementRules::nosplit_element_t };
214 typedef typename ImplTraits::MarkRuleType MarkRuleType;
216 friend class ALU3dGrid< GridImp::dimension, GridImp::dimensionworld, elementType, Comm >;
235 typedef typename GridImp :: ReferenceElementType ReferenceElementType;
237 typedef typename GridImp::Traits::template Codim< 0 >::GeometryImpl GeometryImpl;
238 typedef typename GridImp::Traits::template Codim< 0 >::LocalGeometryImpl LocalGeometryImpl;
250 #if !DUNE_VERSION_NEWER(DUNE_GRID,2,5)
257 typedef typename GridImp::Traits::template Codim< cd >::Twists::Twist
Twist;
259 #if !DUNE_VERSION_NEWER(DUNE_GRID,2,5)
265 typedef typename GridImp::template Codim<0>::EntitySeed
EntitySeed;
286 GeometryType
type ()
const;
294 template<
int cc>
int count ()
const ;
299 unsigned int subEntities (
unsigned int codim)
const;
303 template<
int codim >
306 template<
int codim >
310 bool isLeaf ()
const;
319 return (this->
level()>0);
331 LocalGeometry geometryInFather ()
const;
350 bool mightVanish ()
const;
353 bool hasBoundaryIntersections ()
const;
359 bool mark(
const int refCount,
const bool conformingRefinement )
const;
376 void reset (
int l );
394 int subIndex(
int i,
unsigned int codim)
const;
397 const IMPLElementType&
getItem ()
const {
return *item_; }
407 bool isGhost ()
const{
return ImplTraits::isGhost( ghost_ ); }
421 return (isGhost()) ? getGhost().ldbVertexIndex() :
getItem().ldbVertexIndex();
427 return (isGhost()) ? 0 :
getItem().weight();
433 return (isGhost()) ? getGhost().master() :
getItem().master();
461 template<
int codim,
class Gr
idImp >
465 enum { dim = GridImp::dimension };
466 enum { dimworld = GridImp::dimensionworld };
468 typedef typename GridImp::MPICommunicatorType Comm;
472 friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
475 typedef typename ImplTraits::template Codim<dim, codim>::InterfaceType HElementType;
477 typedef typename ImplTraits::HBndSegType HBndSegType;
478 typedef typename ImplTraits::BNDFaceType BNDFaceType;
483 typedef typename GridImp::template Codim<codimension>::Entity
Entity;
550 return GridImp :: getRealImplementation(
entity_);
557 template<
class Gr
idImp>
566 enum {
dim = GridImp::dimension };
569 typedef typename GridImp::MPICommunicatorType
Comm;
573 friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType,
Comm >;
576 typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType
HElementType;
626 template<
int cd,
class Gr
idImp>
633 enum {
dim = GridImp::dimension };
636 typedef typename GridImp::MPICommunicatorType
Comm;
640 friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType,
Comm >;
643 typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType
HElementType;
691 #if COMPILE_ALUGRID_INLINE
#define alugrid_assert(EX)
Definition: alugrid_assert.hh:20
Provides proxy classes for IntersectionsIterators.
Definition: alu3dinclude.hh:80
ALU3dGridElementType
Definition: topology.hh:12
Definition: alu3dinclude.hh:259
[ provides Dune::Grid ]
Definition: alugrid/3d/grid.hh:463
EntitySeed seed_
the information necessary to make sense of this entity
Definition: entity.hh:170
GridImp::template Codim< cd >::Geometry Geometry
Definition: entity.hh:94
GeometryType type() const
type of geometry of this entity
Definition: entity.hh:113
void removeElement()
reset item pointer to NULL
Definition: entity.hh:127
int level() const
level of this element
Definition: entity.hh:154
PartitionType partitionType() const
return partition type of this entity ( see grid.hh )
Definition: entity.hh:157
ALU3dGridEntity()
Constructor.
Definition: entity_imp.cc:28
PartitionType convertBndId(const HItemType &item) const
convert ALUGrid partition type to dune partition type
Definition: entity_imp.cc:90
Geometry geometry() const
geometry of this entity
Definition: entity_imp.cc:109
ImplTraits::template Codim< dim, cd >::InterfaceType HItemType
Definition: entity.hh:88
GridImp::template Codim< cd >::EntitySeed EntitySeed
typedef of my type
Definition: entity.hh:101
GridImp::template Codim< cd >::Entity Entity
Definition: entity.hh:93
ImplTraits::template Codim< dim, cd >::ImplementationType ItemType
Definition: entity.hh:89
void setEntity(const ALU3dGridEntity< cd, dim, GridImp > &org)
set item from other entity, mainly for copy constructor of entity pointer
Definition: entity_imp.cc:41
int subIndex(int i, unsigned int codim) const
Definition: entity.hh:142
EntitySeed seed() const
return seed of entity
Definition: entity.hh:151
const ItemType & getItem() const
Definition: entity.hh:148
void setElement(const HItemType &item)
Definition: entity_imp.cc:48
GridImp::template Codim< 0 >::EntityPointer EntityPointer
Definition: entity.hh:97
ImplTraits::HBndSegType HBndSegType
Definition: entity.hh:91
GeometryImpl geo_
the current geometry
Definition: entity.hh:167
ImplTraits::VertexType VertexType
Definition: entity.hh:90
ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits
Definition: entity.hh:87
void setGhost(const HBndSegType &ghost)
setGhost is not valid for this codim
Definition: entity_imp.cc:80
int getIndex() const
index is unique within the grid hierarchy and per codim
Definition: entity.hh:161
bool equals(const ALU3dGridEntity< cd, dim, GridImp > &org) const
compare 2 elements by comparing the item pointers
Definition: entity.hh:134
Definition: iterator.hh:554
Definition: entity.hh:629
GridImp::MPICommunicatorType Comm
Definition: entity.hh:636
GridImp::template Codim< cd >::Entity Entity
type of Entity
Definition: entity.hh:658
static const int defaultValue
Definition: entity.hh:664
@ dimworld
Definition: entity.hh:634
ImplTraits::template Codim< dim, cd >::InterfaceType HElementType
Definition: entity.hh:643
ALU3dGridEntityPointerBase< cd, GridImp > BaseType
Definition: entity.hh:631
ALU3dGridEntityPointer(const ALU3dGridEntitySeedType &seed)
Constructor for EntityPointer that points to given entity.
Definition: entity.hh:673
ALU3dGridEntityPointer< cd, GridImp > ThisType
Definition: entity.hh:632
ALU3dGridEntityPointer()
Definition: entity.hh:679
@ dim
Definition: entity.hh:633
void updateEntityPointer(HElementType *item, int level)
Definition: entity_inline.hh:326
ImplTraits::HBndSegType HBndSegType
Definition: entity.hh:645
ImplTraits::BNDFaceType BNDFaceType
Definition: entity.hh:646
Definition: iterator.hh:713
Definition: iterator.hh:56
Leaf iterator.
Definition: iterator.hh:639
Definition: entity.hh:195
GridImp::template Codim< 0 >::Entity Entity
Definition: entity.hh:249
const BNDFaceType & getGhost() const
Definition: entity.hh:400
BNDFaceType * ghost_
not zero if entity is ghost entity
Definition: entity.hh:447
GridImp::template Codim< 0 >::Geometry Geometry
Definition: entity.hh:241
bool hasFather() const
returns true if father entity exists
Definition: entity.hh:317
GridImp::template Codim< 0 >::EntitySeed EntitySeed
typedef of my type
Definition: entity.hh:265
IMPLElementType * item_
Definition: entity.hh:444
GridImp::template Codim< 0 >::EntityPointer EntityPointer
Definition: entity.hh:251
Codim< codim >::Entity subEntity(int i) const
GeometryImpl geo_
the entity's geometry
Definition: entity.hh:441
int getSubIndex(int i) const
GridImp::template Codim< 0 >::LocalGeometry LocalGeometry
Definition: entity.hh:242
EntitySeed seed() const
return key for this entity
Definition: entity.hh:410
const IMPLElementType & getItem() const
Definition: entity.hh:397
Codim< codim >::Twist twist(int i) const
int weight() const
weight of entity (ie number of leaf elements underneath)
Definition: entity.hh:425
bool isGhost() const
returns true if entity is ghost
Definition: entity.hh:407
int master() const
return rank number of master process
Definition: entity.hh:431
int macroId() const
return macro id of this entity
Definition: entity.hh:419
GridImp::template Codim< cd >::Entity Entity
Definition: entity.hh:258
GridImp::Traits::template Codim< cd >::Twists::Twist Twist
Definition: entity.hh:257
GridImp::template Codim< cd >::EntityPointer EntityPointer
Definition: entity.hh:260
Definition: entity.hh:463
void updateGhostPointer(HBndSegType &ghostFace)
Definition: entity_inline.hh:298
GridImp::template Codim< codimension >::Entity Entity
type of Entity
Definition: entity.hh:483
ThisType ALU3dGridEntityPointerType
typedef of my type
Definition: entity.hh:488
int level() const
ask for level of entities
Definition: entity.hh:524
ALU3dGridEntityPointerBase()
default empty constructor
Definition: entity_inline.hh:238
EntityImp & entityImp() const
Definition: entity.hh:549
ALU3dGridEntitySeedType seed_
Definition: entity.hh:543
bool equals(const ALU3dGridEntityPointerType &i) const
equality
Definition: entity_inline.hh:290
EntityObject entity_
Definition: entity.hh:546
ALU3dGridEntitySeed< codimension, GridImp > ALU3dGridEntitySeedType
type of entity seed
Definition: entity.hh:494
Entity & dereference() const
dereferencing
Definition: entity.hh:515
ALU3dGridEntityPointer< codimension, GridImp > EntityPointerImp
make type of entity pointer implementation available in derived classes
Definition: entity.hh:491
@ codimension
Definition: entity.hh:480
ThisType & operator=(const ThisType &org)
assignment operator
Definition: entity_inline.hh:257
void done()
has to be called when iterator is finished
Definition: entity_inline.hh:283
void clone(const ALU3dGridEntityPointerType &org)
Definition: entity_inline.hh:266
ALU3dGridEntity< codimension, dim, GridImp > EntityImp
Definition: entity.hh:485
void updateEntityPointer(HElementType *item, int level=-1)
Definition: entity_inline.hh:309
Entity EntityObject
Definition: entity.hh:484
ALU3dGridEntityPointer< cd, GridImp > ThisType
Definition: entity.hh:565
ALU3dGridEntityPointer(const HBndSegType &ghostFace)
Constructor for EntityPointer that points to an ghost.
Definition: entity.hh:602
ImplTraits::BNDFaceType BNDFaceType
Definition: entity.hh:579
ImplTraits::HBndSegType HBndSegType
Definition: entity.hh:578
GridImp::template Codim< cd >::Entity Entity
type of Entity
Definition: entity.hh:591
ALU3dGridEntityPointer(const ALU3dGridEntityType &entity)
Constructor for EntityPointer that points to an entity (interior or ghost)
Definition: entity.hh:613
ALU3dGridEntityPointer()
Definition: entity.hh:620
ImplTraits::template Codim< dim, cd >::InterfaceType HElementType
Definition: entity.hh:576
GridImp::MPICommunicatorType Comm
Definition: entity.hh:569
ALU3dGridEntityPointer(const ALU3dGridEntitySeedType &seed)
Constructor for EntityPointer that points to given entity.
Definition: entity.hh:607
ALU3dGridEntityPointerBase< 0, GridImp > BaseType
Definition: entity.hh:562
int level() const
return level
Definition: entityseed.hh:281
bool isValid() const
Definition: entityseed.hh:127
HElementType * item() const
get item from key
Definition: entityseed.hh:159
hierarchic index set of ALU3dGrid
Definition: indexsets.hh:38
Factory class for ALUGrids.
Definition: gridfactory.hh:30
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:253
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:357