1#ifndef DUNE_ALU3DGRIDENTITY_HH
2#define DUNE_ALU3DGRIDENTITY_HH
8#include <dune/grid/common/entity.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,
class Gr
idImp>
35 class ALU3dGridLeafIterator;
36 template<
int dim,
int dimworld, ALU3dGr
idElementType,
class >
45template<
int cd,
int dim,
class Gr
idImp>
47public EntityDefaultImplementation <cd,dim,GridImp,ALU3dGridEntity>
50 template <
class Gr
idType,
int dm,
int cdim>
53 template <
class ItemType>
54 static int getLevel(
const GridType & grid,
const ItemType & item )
63 template <
class Gr
idType>
64 struct GetLevel<GridType,dim,dim>
66 template <
class ItemType>
67 static int getLevel(
const GridType & grid,
const ItemType & item)
69 return (item.isLeafEntity()) ? grid.getLevelOfLeafVertex(item) : item.level();
73 enum { dimworld = GridImp::dimensionworld };
75 typedef typename GridImp::MPICommunicatorType Comm;
77 friend class ALU3dGrid< GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
85 typedef typename GridImp::Traits::template Codim< cd >::GeometryImpl GeometryImpl;
89 typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType
HItemType;
90 typedef typename ImplTraits::template Codim<dim, cd>::ImplementationType
ItemType;
110 GeometryType
type () const {
return geo_.type(); }
141 DUNE_THROW( NotImplemented,
"Method subIndex for higher codimension not implemented, yet." );
189template<
int dim,
class Gr
idImp>
191:
public EntityDefaultImplementation<0,dim,GridImp,ALU3dGridEntity>
193 static const int dimworld = std::remove_const< GridImp >::type::dimensionworld;
194 static const ALU3dGridElementType elementType = std::remove_const< GridImp >::type::elementType;
196 typedef typename GridImp::MPICommunicatorType Comm;
199 typedef typename ImplTraits::template Codim<dim, 0>::InterfaceType HElementType;
201 typedef typename ImplTraits::GEOElementType GEOElementType;
202 typedef typename ImplTraits::BNDFaceType BNDFaceType;
203 typedef typename ImplTraits::IMPLElementType IMPLElementType;
204 typedef typename ImplTraits::HBndSegType
HBndSegType;
206 enum { refine_element_t = ImplTraits::RefinementRules::refine_element_t };
207 enum { bisect_element_t = ImplTraits::RefinementRules::bisect_element_t };
208 enum { coarse_element_t = ImplTraits::RefinementRules::coarse_element_t };
209 enum { nosplit_element_t = ImplTraits::RefinementRules::nosplit_element_t };
211 typedef typename ImplTraits::MarkRuleType MarkRuleType;
213 friend class ALU3dGrid< GridImp::dimension, GridImp::dimensionworld, elementType, Comm >;
232 typedef typename GridImp :: ReferenceElementType ReferenceElementType;
234 typedef typename GridImp::Traits::template Codim< 0 >::GeometryImpl GeometryImpl;
235 typedef typename GridImp::Traits::template Codim< 0 >::LocalGeometryImpl LocalGeometryImpl;
251 typedef typename GridImp::Traits::template Codim< cd >::Twists::Twist
Twist;
256 typedef typename GridImp::template Codim<0>::EntitySeed
EntitySeed;
277 GeometryType
type ()
const;
285 template<
int cc>
int count ()
const ;
290 unsigned int subEntities (
unsigned int codim)
const;
294 template<
int codim >
297 template<
int codim >
301 bool isLeaf ()
const;
310 return (this->
level()>0);
322 LocalGeometry geometryInFather ()
const;
341 bool mightVanish ()
const;
344 bool hasBoundaryIntersections ()
const;
350 bool mark(
const int refCount,
const bool conformingRefinement )
const;
367 void reset (
int l );
385 int subIndex(
int i,
unsigned int codim)
const;
388 const IMPLElementType&
getItem ()
const {
return *item_; }
398 bool isGhost ()
const{
return ImplTraits::isGhost( ghost_ ); }
412 return (isGhost()) ? getGhost().ldbVertexIndex() :
getItem().ldbVertexIndex();
418 return (isGhost()) ? 0 :
getItem().weight();
424 return (isGhost()) ? getGhost().master() :
getItem().master();
452template<
int codim,
class Gr
idImp >
456 enum { dim = GridImp::dimension };
457 enum { dimworld = GridImp::dimensionworld };
459 typedef typename GridImp::MPICommunicatorType Comm;
463 friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType, Comm >;
466 typedef typename ImplTraits::template Codim<dim, codim>::InterfaceType HElementType;
468 typedef typename ImplTraits::HBndSegType HBndSegType;
469 typedef typename ImplTraits::BNDFaceType BNDFaceType;
471 enum { codimension = codim };
474 typedef typename GridImp::template Codim<codimension>::Entity
Entity;
548template<
class Gr
idImp>
556 typedef ALU3dGridEntityPointer <cd,GridImp>
ThisType;
557 enum {
dim = GridImp::dimension };
560 typedef typename GridImp::MPICommunicatorType
Comm;
564 friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType,
Comm >;
567 typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType
HElementType;
617template<
int cd,
class Gr
idImp>
623 typedef ALU3dGridEntityPointer <cd,GridImp>
ThisType;
624 enum {
dim = GridImp::dimension };
627 typedef typename GridImp::MPICommunicatorType
Comm;
631 friend class ALU3dGrid < GridImp::dimension, GridImp::dimensionworld, GridImp::elementType,
Comm >;
634 typedef typename ImplTraits::template Codim<dim, cd>::InterfaceType
HElementType;
682#if COMPILE_ALUGRID_INLINE
Provides proxy classes for IntersectionsIterators.
#define alugrid_assert(EX)
Definition: alugrid_assert.hh:20
Definition: alu3dinclude.hh:63
ALU3dGridElementType
Definition: topology.hh:12
Definition: alu3dinclude.hh:242
[ provides Dune::Grid ]
Definition: 3d/grid.hh:429
EntitySeed seed_
the information necessary to make sense of this entity
Definition: entity.hh:167
GridImp::template Codim< cd >::Geometry Geometry
Definition: entity.hh:95
GeometryType type() const
type of geometry of this entity
Definition: entity.hh:110
void removeElement()
reset item pointer to NULL
Definition: entity.hh:124
int level() const
level of this element
Definition: entity.hh:151
PartitionType partitionType() const
return partition type of this entity ( see grid.hh )
Definition: entity.hh:154
ImplTraits::template Codim< dim, cd >::InterfaceType HItemType
Definition: entity.hh:89
ALU3dGridEntity()
Constructor.
Definition: entity_imp.cc:221
PartitionType convertBndId(const HItemType &item) const
convert ALUGrid partition type to dune partition type
Definition: entity_imp.cc:283
Geometry geometry() const
geometry of this entity
Definition: entity_imp.cc:302
GridImp::template Codim< cd >::EntitySeed EntitySeed
typedef of my type
Definition: entity.hh:98
GridImp::template Codim< cd >::Entity Entity
Definition: entity.hh:94
void setEntity(const ALU3dGridEntity< cd, dim, GridImp > &org)
set item from other entity, mainly for copy constructor of entity pointer
Definition: entity_imp.cc:234
int subIndex(int i, unsigned int codim) const
Definition: entity.hh:139
ImplTraits::template Codim< dim, cd >::ImplementationType ItemType
Definition: entity.hh:90
EntitySeed seed() const
return seed of entity
Definition: entity.hh:148
const ItemType & getItem() const
Definition: entity.hh:145
void setElement(const HItemType &item)
Definition: entity_imp.cc:241
ImplTraits::HBndSegType HBndSegType
Definition: entity.hh:92
GeometryImpl geo_
the current geometry
Definition: entity.hh:164
ImplTraits::VertexType VertexType
Definition: entity.hh:91
ALU3dImplTraits< GridImp::elementType, Comm > ImplTraits
Definition: entity.hh:88
void setGhost(const HBndSegType &ghost)
setGhost is not valid for this codim
Definition: entity_imp.cc:273
int getIndex() const
index is unique within the grid hierarchy and per codim
Definition: entity.hh:158
bool equals(const ALU3dGridEntity< cd, dim, GridImp > &org) const
compare 2 elements by comparing the item pointers
Definition: entity.hh:131
Definition: iterator.hh:556
Definition: entity.hh:620
GridImp::MPICommunicatorType Comm
Definition: entity.hh:627
GridImp::template Codim< cd >::Entity Entity
type of Entity
Definition: entity.hh:649
static const int defaultValue
Definition: entity.hh:655
@ dimworld
Definition: entity.hh:625
ALU3dGridEntityPointerBase< cd, GridImp > BaseType
Definition: entity.hh:622
ALU3dGridEntityPointer(const ALU3dGridEntitySeedType &seed)
Constructor for EntityPointer that points to given entity.
Definition: entity.hh:664
ALU3dGridEntityPointer< cd, GridImp > ThisType
Definition: entity.hh:623
ALU3dGridEntityPointer()
Definition: entity.hh:670
@ dim
Definition: entity.hh:624
void updateEntityPointer(HElementType *item, int level)
Definition: entity_inline.hh:329
ImplTraits::HBndSegType HBndSegType
Definition: entity.hh:636
ImplTraits::BNDFaceType BNDFaceType
Definition: entity.hh:637
ImplTraits::template Codim< dim, cd >::InterfaceType HElementType
Definition: entity.hh:634
Definition: iterator.hh:722
Definition: iterator.hh:56
Leaf iterator.
Definition: iterator.hh:648
Definition: entity.hh:192
const IMPLElementType & getItem() const
Definition: entity.hh:388
GridImp::template Codim< 0 >::Entity Entity
Definition: entity.hh:246
const BNDFaceType & getGhost() const
Definition: entity.hh:391
GridImp::template Codim< 0 >::LocalGeometry LocalGeometry
Definition: entity.hh:239
BNDFaceType * ghost_
not zero if entity is ghost entity
Definition: entity.hh:438
GridImp::template Codim< 0 >::Geometry Geometry
Definition: entity.hh:238
bool hasFather() const
returns true if father entity exists
Definition: entity.hh:308
GridImp::template Codim< 0 >::EntitySeed EntitySeed
typedef of my type
Definition: entity.hh:256
IMPLElementType * item_
Definition: entity.hh:435
Codim< codim >::Entity subEntity(int i) const
GeometryImpl geo_
the entity's geometry
Definition: entity.hh:432
int getSubIndex(int i) const
EntitySeed seed() const
return key for this entity
Definition: entity.hh:401
Codim< codim >::Twist twist(int i) const
int weight() const
weight of entity (ie number of leaf elements underneath)
Definition: entity.hh:416
bool isGhost() const
returns true if entity is ghost
Definition: entity.hh:398
int master() const
return rank number of master process
Definition: entity.hh:422
int macroId() const
return macro id of this entity
Definition: entity.hh:410
GridImp::template Codim< cd >::Entity Entity
Definition: entity.hh:252
GridImp::Traits::template Codim< cd >::Twists::Twist Twist
Definition: entity.hh:251
Definition: entity.hh:454
void updateGhostPointer(HBndSegType &ghostFace)
Definition: entity_inline.hh:301
GridImp::template Codim< codimension >::Entity Entity
type of Entity
Definition: entity.hh:474
ThisType ALU3dGridEntityPointerType
typedef of my type
Definition: entity.hh:479
int level() const
ask for level of entities
Definition: entity.hh:515
ALU3dGridEntityPointerBase()
default empty constructor
Definition: entity_inline.hh:241
ALU3dGridEntitySeedType seed_
Definition: entity.hh:534
bool equals(const ALU3dGridEntityPointerType &i) const
equality
Definition: entity_inline.hh:293
EntityObject entity_
Definition: entity.hh:537
ALU3dGridEntitySeed< codimension, GridImp > ALU3dGridEntitySeedType
type of entity seed
Definition: entity.hh:485
ALU3dGridEntityPointer< codimension, GridImp > EntityPointerImp
make type of entity pointer implementation available in derived classes
Definition: entity.hh:482
Entity & dereference() const
dereferencing
Definition: entity.hh:506
ThisType & operator=(const ThisType &org)
assignment operator
Definition: entity_inline.hh:260
EntityImp & entityImp() const
Definition: entity.hh:540
void done()
has to be called when iterator is finished
Definition: entity_inline.hh:286
void clone(const ALU3dGridEntityPointerType &org)
Definition: entity_inline.hh:269
ALU3dGridEntity< codimension, dim, GridImp > EntityImp
Definition: entity.hh:476
void updateEntityPointer(HElementType *item, int level=-1)
Definition: entity_inline.hh:312
Entity EntityObject
Definition: entity.hh:475
ALU3dGridEntityPointer< cd, GridImp > ThisType
Definition: entity.hh:556
ALU3dGridEntityPointer(const HBndSegType &ghostFace)
Constructor for EntityPointer that points to an ghost.
Definition: entity.hh:593
ImplTraits::BNDFaceType BNDFaceType
Definition: entity.hh:570
ImplTraits::HBndSegType HBndSegType
Definition: entity.hh:569
GridImp::template Codim< cd >::Entity Entity
type of Entity
Definition: entity.hh:582
ALU3dGridEntityPointer(const ALU3dGridEntityType &entity)
Constructor for EntityPointer that points to an entity (interior or ghost)
Definition: entity.hh:604
ALU3dGridEntityPointer()
Definition: entity.hh:611
ImplTraits::template Codim< dim, cd >::InterfaceType HElementType
Definition: entity.hh:567
GridImp::MPICommunicatorType Comm
Definition: entity.hh:560
ALU3dGridEntityPointer(const ALU3dGridEntitySeedType &seed)
Constructor for EntityPointer that points to given entity.
Definition: entity.hh:598
ALU3dGridEntityPointerBase< 0, GridImp > BaseType
Definition: entity.hh:553
Definition: entityseed.hh:212
int level() const
return level
Definition: entityseed.hh:281
HElementType * item() const
get item from key
Definition: entityseed.hh:159
bool isValid() const
Definition: entityseed.hh:127
hierarchic index set of ALU3dGrid
Definition: indexsets.hh:39
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:246
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:346