3#ifndef DUNE_ALBERTA_ENTITY_HH
4#define DUNE_ALBERTA_ENTITY_HH
6#include <dune/grid/common/entity.hh>
9#include <dune/grid/albertagrid/entityseed.hh>
10#include <dune/grid/albertagrid/geometry.hh>
20 template<
int codim,
class Gr
id,
bool leafIterator >
21 class AlbertaGridTreeIterator;
23 template<
class Gr
id >
24 class AlbertaGridHierarchicIterator;
26 template<
class Gr
id >
27 class AlbertaGridLeafIntersection;
29 template<
class Gr
id >
30 class AlbertaGridLeafIntersectionIterator;
41 template<
int codim,
int dim,
class Gr
id >
55 static const int dimension = dim;
56 static const int codimension = codim;
57 static const int mydimension = dimension - codimension;
62 typedef typename Grid::template Codim< cd >::Entity Entity;
65 typedef typename Grid::template Codim< codim >::Entity Entity;
66 typedef typename Grid::template Codim< codim >::EntitySeed EntitySeed;
67 typedef typename Grid::template Codim< codim >::Geometry Geometry;
69 typedef Alberta::ElementInfo< dimension > ElementInfo;
72 typedef typename Grid::Traits::template Codim< codim >::GeometryImpl GeometryImpl;
96 EntitySeed
seed ()
const {
return EntitySeed( AlbertaGridEntitySeed< codim, Grid >( elementInfo(),
subEntity() ) ); }
108 int n = mydimension+1;
109 int k = dimension-cd+1;
113 for (
int i=n-k+1; i<=n; i++)
115 for (
long i=2; i<=k; i++)
128 const ElementInfo &elementInfo ()
const {
return elementInfo_; }
131 bool equals (
const This &other )
const;
133 void clearElement ();
134 void setElement (
const ElementInfo &elementInfo,
int subEntity );
137 void setEntity (
const This &other );
154 return elementInfo().template twist< codimension >(
subEntity() );
162 ElementInfo elementInfo_;
180 template<
int dim,
class Gr
id >
189 friend class AlbertaGridLeafIntersection<
Grid >;
194 static const int dimension = dim;
195 static const int codimension = 0;
196 static const int mydimension = dimension - codimension;
198 template<
int codim >
201 typedef typename Grid::template Codim< codim >::Entity
213 typedef Dune::AlbertaGridLeafIntersectionIterator< Grid > AlbertaGridLeafIntersectionIterator;
214 typedef AlbertaGridLeafIntersectionIterator AlbertaGridLevelIntersectionIterator;
216 typedef Alberta::ElementInfo< dimension > ElementInfo;
230 int boundaryId ()
const;
239 EntitySeed
seed ()
const {
return EntitySeed( AlbertaGridEntitySeed< 0, Grid >(elementInfo() )); }
251 int n = mydimension+1;
252 int k = dimension-cd+1;
256 for (
int i=n-k+1; i<=n; i++)
258 for (
long i=2; i<=k; i++)
274 template<
int codim >
282 AlbertaGridLeafIntersectionIterator ileafbegin ()
const;
285 AlbertaGridLeafIntersectionIterator ileafend ()
const;
287 AlbertaGridLevelIntersectionIterator ilevelbegin ()
const
289 if(
grid().maxLevel() == 0 )
298 AlbertaGridLevelIntersectionIterator ilevelend ()
const
304 bool isLeaf ()
const;
308 Entity father ()
const;
312 return (this->
level()>0);
323 LocalGeometry geometryInFather ()
const;
329 HierarchicIterator hbegin (
int maxlevel)
const;
332 HierarchicIterator hend (
int maxlevel)
const;
338 bool mightVanish ()
const;
342 bool hasBoundaryIntersections ()
const ;
348 bool equals (
const This &i )
const;
353 const ElementInfo &elementInfo ()
const
358 void clearElement ();
359 void setElement (
const ElementInfo &elementInfo,
int subEntity );
362 void setEntity (
const This &other );
379 return elementInfo().template twist< codimension >(
subEntity() );
383 template<
int codim >
386 return elementInfo().template twist< codim >(
grid().generic2alberta( codim, i ) );
397 ElementInfo elementInfo_;
Definition: entity.hh:183
EntitySeed seed() const
obtain entity seed
Definition: entity.hh:239
int twist() const
obtain twist
Definition: entity.hh:377
bool hasFather() const
returns true if father entity exists
Definition: entity.hh:310
int subEntity() const
obtain number of the subentity within the element (in ALBERTA numbering)
Definition: entity.hh:371
int twist(int i) const
obtain twist of a subentity
Definition: entity.hh:384
const Grid & grid() const
obtain a reference to the grid
Definition: entity.hh:365
unsigned int subEntities(unsigned int cd) const
Obtain the number of subentities of a given codimension.
Definition: entity.hh:249
int twist() const
obtain twist
Definition: entity.hh:152
ALBERTA EL_INFO * getElInfo() const
needed for the LevelIterator and LeafIterator
Definition: entity.cc:60
int level() const
level of this element
Definition: entity.cc:92
EntitySeed seed() const
obtain entity seed
Definition: entity.hh:96
PartitionType partitionType() const
return partition type of this entity
Definition: entity.cc:38
Geometry geometry() const
geometry of this entity
Definition: entity.cc:101
unsigned int subEntities(unsigned int cd) const
Obtain the number of subentities of a given codimension.
Definition: entity.hh:106
const Grid & grid() const
obtain a reference to the grid
Definition: entity.hh:140
int subEntity() const
obtain number of the subentity within the element (in ALBERTA numbering)
Definition: entity.hh:146
GeometryType type() const
type of geometry of this entity
Definition: entity.cc:112
bool equals(const This &other) const
equality of entities
Definition: entity.cc:46
Definition: hierarchiciterator.hh:27
Definition: treeiterator.hh:184
[ provides Dune::Grid ]
Definition: agrid.hh:139
Default Implementations for EntityImp.
Definition: entity.hh:548
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:279
Grid abstract base class.
Definition: grid.hh:373
GridFamily::Traits::HierarchicIterator HierarchicIterator
A type that is a model of Dune::HierarchicIterator A type of iterator that allows to examine,...
Definition: grid.hh:486
@ dimensionworld
The dimension of the world the grid lives in.
Definition: grid.hh:393
Default exception for dummy implementations.
Definition: exceptions.hh:261
provides a wrapper for ALBERTA's el_info structure
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Dune namespace.
Definition: alignedallocator.hh:14
static constexpr T binomial(const T &n, const T &k) noexcept
calculate the binomial coefficient n over k as a constexpr
Definition: math.hh:128
Static tag representing a codimension.
Definition: dimension.hh:22