3#ifndef DUNE_ALU2DGRIDENTITY_HH
4#define DUNE_ALU2DGRIDENTITY_HH
9#include <dune/grid/common/entity.hh>
13#include <dune/grid/alugrid/2d/intersection.hh>
14#include <dune/grid/alugrid/2d/iterator.hh>
15#include <dune/grid/alugrid/2d/entityseed.hh>
19 template<
int cd,
int dim,
class Gr
idImp>
20 class ALU2dGridEntity;
21 template<
int cd, PartitionIteratorType pitype,
class Gr
idImp >
22 class ALU2dGridLevelIterator;
23 template<
int codim,
class Gr
idImp >
24 class ALU2dGridEntityPointer;
25 template<
int mydim,
int coorddim,
class Gr
idImp>
26 class ALU2dGridGeometry;
27 template<
class Gr
idImp>
28 class ALU2dGridHierarchicIterator;
29 template<
class Gr
idImp>
30 class ALU2dGridLevelIntersectionIterator;
31 template<
class Gr
idImp>
32 class ALU2dGridLeafIntersectionIterator;
33 template<
class Gr
idImp>
34 class ALU2dGridIntersectionIterator;
35 template<
int codim, PartitionIteratorType,
class Gr
idImp>
36 class ALU2dGridLeafIterator;
37 template<
int dim,
int dimworld, ALU2DSPACE ElementType eltype >
52 template<
int cd,
int dim,
class Gr
idImp>
56 static const int dimworld = GridImp::dimensionworld;
57 static const ALU2DSPACE ElementType eltype = GridImp::elementType;
59 friend class ALU2dGrid< dim, dimworld, eltype >;
60 friend class ALU2dGridIntersectionIterator < GridImp >;
61 friend class ALU2dGridIntersectionIterator < const GridImp >;
62 friend class ALU2dGridLevelIntersectionIterator < GridImp >;
63 friend class ALU2dGridLevelIntersectionIterator < const GridImp >;
64 friend class ALU2dGridLeafIntersectionIterator < GridImp >;
65 friend class ALU2dGridLeafIntersectionIterator < const GridImp >;
68 friend class ALU2dGridLevelIterator <0,
All_Partition,GridImp>;
69 friend class ALU2dGridLevelIterator <1,
All_Partition,GridImp>;
70 friend class ALU2dGridLevelIterator <2,
All_Partition,GridImp>;
71 friend class ALU2dGridLeafIterator <0,
All_Partition,GridImp>;
72 friend class ALU2dGridLeafIterator <1,
All_Partition,GridImp>;
73 friend class ALU2dGridLeafIterator <2,
All_Partition,GridImp>;
74 friend class ALU2dGridMakeableEntity<0,dim,GridImp>;
78 typedef typename ALU2dImplTraits< dimworld, eltype >::HElementType HElementType ;
80 typedef typename GridImp::Traits::template Codim< cd >::GeometryImpl GeometryImpl;
83 typedef typename GridImp :: GridObjectFactoryType FactoryType;
85 typedef typename Dune::ALU2dImplTraits< dimworld, eltype >::template Codim<cd>::InterfaceType ElementType;
86 typedef typename Dune::ALU2dImplTraits< dimworld, eltype >::template Codim<2>::InterfaceType VertexType;
89 typedef typename GridImp::template Codim<cd>::Entity
Entity;
91 typedef typename GridImp::template Codim<cd>::Geometry
Geometry;
94 typedef typename GridImp::template Codim<cd>::EntitySeed
EntitySeed;
97 typedef typename GridImp::template Codim<0>::EntityPointer
EntityPointer;
123 void setElement(
const HElementType & el,
const VertexType & vx);
152 const GridImp&
grid()
const {
return factory_.grid(); }
155 const FactoryType&
factory()
const {
return factory_; }
171 int getFace()
const {
return face_; }
178 const FactoryType& factory_;
181 mutable ElementType * item_;
184 mutable GeometryImpl geoObj_;
209 template<
int dim,
class Gr
idImp>
213 static const int dimworld = GridImp::dimensionworld;
214 static const ALU2DSPACE ElementType eltype = GridImp::elementType;
216 friend class ALU2dGrid< dim, dimworld, eltype >;
217 friend class ALU2dGridIntersectionIterator < GridImp >;
218 friend class ALU2dGridIntersectionIterator < const GridImp >;
219 friend class ALU2dGridLevelIntersectionIterator < GridImp >;
220 friend class ALU2dGridLevelIntersectionIterator < const GridImp >;
221 friend class ALU2dGridLeafIntersectionIterator < GridImp >;
222 friend class ALU2dGridLeafIntersectionIterator < const GridImp >;
225 friend class ALU2dGridLevelIterator <0,
All_Partition,GridImp>;
226 friend class ALU2dGridLevelIterator <1,
All_Partition,GridImp>;
227 friend class ALU2dGridLevelIterator <2,
All_Partition,GridImp>;
228 friend class ALU2dGridLeafIterator <0,
All_Partition,GridImp>;
229 friend class ALU2dGridLeafIterator <1,
All_Partition,GridImp>;
230 friend class ALU2dGridLeafIterator <2,
All_Partition,GridImp>;
231 friend class ALU2dGridMakeableEntity<0,dim,GridImp>;
235 typedef typename ALU2dImplTraits< dimworld, eltype >::HElementType HElementType ;
237 typedef typename GridImp::Traits::template Codim< 0 >::GeometryImpl GeometryImpl;
238 typedef typename GridImp::Traits::template Codim< 0 >::LocalGeometryImpl LocalGeometryImpl;
241 typedef typename GridImp :: GridObjectFactoryType FactoryType;
244 typedef typename GridImp::template Codim<0>::Geometry
Geometry;
249 typedef typename GridImp::template Codim<0>::EntitySeed
EntitySeed;
257 typedef typename GridImp::template Codim<0>::Entity
Entity;
265 typedef typename GridImp::template Codim<cd>::EntityPointer
EntityPointer;
290 return (cc==0) ? 1 : item_->numvertices();
322 ALU2dGridLevelIntersectionIteratorType ilevelbegin ()
const
324 return ALU2dGridLevelIntersectionIteratorType( *
this, this->
level(),
false);
326 ALU2dGridLevelIntersectionIteratorType ilevelend ()
const
328 return ALU2dGridLevelIntersectionIteratorType( *
this, this->
level(),
true);
330 ALU2dGridLeafIntersectionIteratorType ileafbegin ()
const
332 return ALU2dGridLeafIntersectionIteratorType( *
this, this->
level(),
false);
334 ALU2dGridLeafIntersectionIteratorType ileafend ()
const
336 return ALU2dGridLeafIntersectionIteratorType( *
this, this->
level(),
true);
349 return (this->
level()>0);
370 typename Codim<cc>::EntityPointer
entity (
int i)
const;
374 template<
int codim >
375 typename Codim< codim >::EntityPointer
subEntity (
int i )
const
382 if( item_->numvertices() == 3 )
385 switch (i) {
case 0 : j=2;
break;
390 else if ( codim == 2 )
392 if( item_->numvertices() == 4 )
394 switch (i) {
case 0 : j=0;
break;
400 return entity< codim >( j );
406#if ALU2DGRID_PARALLEL
407 return grid().rankManager().partitionType( item_->getIndex() );
438 return ((item_->is(ALU2DSPACE Refco::crs))==1);
443 return ((item_->wasRefined())==1);
492 const GridImp&
grid()
const {
return factory_.grid(); }
495 const FactoryType&
factory()
const {
return factory_; }
498 int getFace()
const {
return -1; }
510 template<
int cc>
int getSubIndex (
int i)
const;
512 int subIndex (
int i,
unsigned int codim)
const;
515 const FactoryType& factory_;
518 mutable HElementType *item_;
521 mutable GeometryImpl geoObj_;
524 mutable bool isLeaf_;
538 template<
int codim,
class Gr
idImp >
544 static const int dim = GridImp::dimension;
545 static const int dimworld = GridImp::dimensionworld;
546 static const ALU2DSPACE ElementType eltype = GridImp::elementType;
548 typedef typename Dune::ALU2dImplTraits< dimworld, eltype >::template Codim<codim>::InterfaceType ElementType;
551 typedef typename GridImp :: GridObjectFactoryType FactoryType;
553 enum { codimension = codim };
556 typedef typename GridImp::template Codim<codimension>::Entity
Entity;
559 typedef typename GridImp::template Codim<codimension>::EntitySeed
EntitySeed;
568 const ElementType &item,
626#include "entity_imp.cc"
void updateEntityPointer(ElementType *item, int face=-1, int level=-1)
update underlying item pointer and set entity
Entity & dereference() const
dereferencing
ALU2dGridEntity< codimension, dim, GridImp > EntityImp
tpye of stored entity (implementation)
Definition: entity.hh:561
void done()
has to be called when iterator is finished
ALU2dGridEntityPointer(const EntityImp &entity)
Constructor for EntityPointer init of Level- and LeafIterator.
int level() const
ask for level of entities
GridImp::template Codim< codimension >::EntitySeed EntitySeed
type of the seed
Definition: entity.hh:559
GridImp::template Codim< codimension >::Entity Entity
type of stored entity (interface)
Definition: entity.hh:556
ALU2dGridEntityPointer(const FactoryType &factory, const ElementType &item, int face=-1, int level=-1)
Constructor for EntityPointer that points to an element.
EntityObj * entity_
entity that this EntityPointer points to
Definition: entity.hh:621
const FactoryType & factory_
reference to entity factory
Definition: entity.hh:615
ThisType & operator=(const ThisType &org)
assigment operator
~ALU2dGridEntityPointer()
Destructor.
bool equals(const ThisType &i) const
equality
ALU2dGridEntityPointer(const FactoryType &factory, const EntitySeed &seed)
Constructor for EntityPointer init of Level- and LeafIterator.
const GridImp & grid() const
return reference top grid
Definition: entity.hh:602
ALU2dGridEntityPointer(const ThisType &org)
Copy Constructor.
ALU2dGridEntityPointer(const FactoryType &factory)
Constructor for EntityPointer init of Level- and LeafIterator.
EntitySeed seed_
the essential information
Definition: entity.hh:618
Definition: entity.hh:212
EntitySeed seed() const
return seed of entity
Definition: entity.hh:486
ALU2dGridEntityPointer< 0, GridImp > EntityPointer
tpye of entitypointer interface
Definition: entity.hh:260
int subBoundaryId(int i) const
The boundaryId of the i-th subentity of codimension cc
void setElement(const HElementType &element, int face=-1, int level=-1) const
EntityPointer father() const
void reset(int l)
set actual walk level
int level() const
level of this element
Geometry geometry() const
geometry of this entity
int getIndex() const
index is unique within the grid hierachie and per codim
Codim< codim >::EntityPointer subEntity(int i) const
Definition: entity.hh:375
GridImp::template Codim< 0 >::Entity Entity
type of entity interface
Definition: entity.hh:257
int getMark() const
return current adaptation mark of element
ALU2dGridIntersectionIteratorType iend() const
Definition: entity.hh:316
PartitionType partitionType() const
return partition type of this entity ( see grid.hh )
Definition: entity.hh:404
bool mightVanish() const
The former state() method has been replaced by:
Definition: entity.hh:436
bool hasFather() const
returns true if father entity exists
Definition: entity.hh:347
bool mark(int refCount) const
ALU2dGridEntity(const FactoryType &factory, int level)
Constructor creating empty Entity.
const GridImp & grid() const
return reference to grid
Definition: entity.hh:492
ALU2dGridEntity(const ALU2dGridEntity &org)
Constructor creating empty Entity.
Codim< cc >::EntityPointer entity(int i) const
GridImp::template Codim< 0 >::LocalGeometry LocalGeometry
type of corresponding interface local geometry
Definition: entity.hh:246
GeometryType type() const
return type of geometry
ALU2dGridHierarchicIterator< GridImp > hend(int maxLevel) const
Returns iterator to one past the last son.
Definition: entity.hh:362
int boundaryId() const
Id of the boundary which is associated with the entity, returns 0 for inner entities,...
Definition: entity.hh:297
GridImp::template Codim< 0 >::Geometry Geometry
type of our Geometry interface
Definition: entity.hh:244
int count() const
Definition: entity.hh:287
ALU2dGridHierarchicIterator< GridImp > hbegin(int maxLevel) const
Definition: entity.hh:356
LeafIntersectionIteratorWrapper< GridImp > ALU2dGridLeafIntersectionIteratorType
tpye of intersection iterator
Definition: entity.hh:252
const FactoryType & factory() const
return reference to factory
Definition: entity.hh:495
bool isLeaf() const
returns true if Entity is leaf (i.e. has no children)
GridImp::template Codim< 0 >::EntitySeed EntitySeed
typedef of my type
Definition: entity.hh:249
LocalGeometry geometryInFather() const
bool equals(const ALU2dGridEntity< 0, dim, GridImp > &org) const
compare 2 entities, which means compare the item pointers
void removeElement()
set item pointer to NULL
ALU2dGridIntersectionIteratorType ibegin() const
Definition: entity.hh:309
Geometry geometry() const
geometry of this entity
GridImp::template Codim< cd >::Geometry Geometry
type of corresponding interface geometry
Definition: entity.hh:91
void removeElement()
set item pointer to NULL
ElementType & getItem() const
return reference to current item
Definition: entity.hh:158
int boundaryId() const
Id of the boundary which is associated with the entity, returns 0 for inner entities,...
void setElement(const ElementType &element, int face=-1, int level=-1) const
set element as normal entity
GridImp::template Codim< cd >::Entity Entity
type of our interface entity
Definition: entity.hh:89
ALU2dGridEntity(const ALU2dGridEntity &org)
Copy Constructor.
FieldVector< alu2d_ctype, dim > & positionInOwnersFather() const
my position in local coordinates of the owners father
GeometryType type() const
return type of geometry
GridImp::template Codim< cd >::EntitySeed EntitySeed
typedef of my type
Definition: entity.hh:94
GridImp::template Codim< 0 >::EntityPointer EntityPointer
tpye of EntityPointer
Definition: entity.hh:97
const GridImp & grid() const
return reference to grid
Definition: entity.hh:152
EntitySeed seed() const
return seed of entity
Definition: entity.hh:165
ALU2dGridEntity(const FactoryType &factory, int level)
Constructor.
int level() const
level of this element
PartitionType partitionType() const
Definition: entity.hh:134
bool equals(const ALU2dGridEntity< cd, dim, GridImp > &org) const
compare 2 elements
const FactoryType & factory() const
return reference to factory
Definition: entity.hh:155
EntityPointer ownersFather() const
int getIndex() const
index is unique within the grid hierachie and per codim
hierarchic index set of ALU2dGrid
Definition: indexsets.hh:42
Hierarchic Iterator of ALU2dGrid.
Definition: iterator.hh:416
[ provides Dune::Grid ]
Definition: grid.hh:213
Default Implementations for EntityImp.
Definition: entity.hh:553
GridImp::ctype ctype DUNE_DEPRECATED_MSG("Use Geometry::ctype instead!")
define type used for coordinates in grid module
Definition: entity.hh:568
vector space out of a tensor product of fields.
Definition: fvector.hh:92
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:25
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:239
Class that wraps IntersectionIteratorImp of a grid and gets it's internal object from a object stack ...
Definition: intersectioniteratorwrapper.hh:334
Dune namespace.
Definition: alignment.hh:14
@ All_Partition
all entities
Definition: gridenums.hh:135
PartitionType
Attributes used in the generic overlap model.
Definition: gridenums.hh:24
@ InteriorEntity
all interior entities
Definition: gridenums.hh:25