36 #ifndef OPM_ENTITY_HEADER
37 #define OPM_ENTITY_HEADER
39 #include <dune/geometry/type.hh>
40 #include <dune/grid/common/gridenums.hh>
42 #include "PartitionTypeIndicator.hpp"
43 #include "EntityRep.hpp"
52 template<
int,PartitionIteratorType>
class Iterator;
72 enum { codimension = codim };
73 enum { dimension = 3 };
74 enum { mydimension = dimension - codimension };
75 enum { dimensionworld = 3 };
78 typedef cpgrid::EntityPointer<codim> EntityPointerType;
81 typedef EntityPointerType EntityPointer;
82 typedef EntityPointerType EntitySeed;
102 typedef double ctype;
121 :
EntityRep<codim>(entityrep), pgrid_(&grid)
127 :
EntityRep<codim>(index_arg, orientation_arg), pgrid_(&grid)
178 t.makeCube(3 - codim);
183 unsigned int subEntities (
const unsigned int cc )
const;
191 typename Codim<cc>::EntityPointer
subEntity(
int i)
const;
194 inline LevelIntersectionIterator
ilevelbegin()
const;
197 inline LevelIntersectionIterator
ilevelend()
const;
200 inline LeafIntersectionIterator
ileafbegin()
const;
203 inline LeafIntersectionIterator
ileafend()
const;
251 const Entity& impl()
const
266 const CpGridData* pgrid_;
279 class EntityPointer :
public cpgrid::Entity<codim>
282 typedef cpgrid::Entity<codim>
Entity;
283 typedef const Entity& Reference;
304 :
Entity(grid, index_arg, orientation_arg)
334 #include "Iterators.hpp"
335 #include "Entity.hpp"
336 #include "Intersection.hpp"
344 static_assert(codim == 0,
"");
351 static_assert(codim == 0,
"");
358 static_assert(codim == 0,
"");
365 static_assert(codim == 0,
"");
386 return pgrid_->partition_type_indicator_->getPartitionType(*
this);
391 #include <dune/grid/cpgrid/CpGridData.hpp>
392 #include <dune/grid/cpgrid/Intersection.hpp>
399 inline unsigned int numFaces(
const OrientedEntityTable<0, 1>& cell_to_face,
402 return cell_to_face[e].size();
406 unsigned int numFaces(
const OrientedEntityTable<0, 1>&,
const Entity<codim>&)
418 }
else if ( codim == 0 ){
420 return Detail::numFaces(pgrid_->cell_to_face_, *
this);
421 }
else if ( cc == 3 ) {
431 return pgrid_->geomVector<codim>()[*
this];
438 static_assert(codim == 0,
"");
443 }
else if (cc == 3) {
444 assert(i >= 0 && i < 8);
446 typename Codim<cc>::EntityPointer se(*pgrid_, corner_index,
true);
449 OPM_THROW(std::runtime_error,
"No subentity exists of codimension " << cc);
459 Iter end = ileafend();
460 for (Iter it = ileafbegin(); it != end; ++it) {
461 if (it->boundary())
return true;
475 #endif // OPM_ENTITY_HEADER
EntitySeed seed() const
Return an entity seed.
Definition: Entity.hpp:145
HierarchicIterator hbegin(int) const
Dummy first child iterator.
Definition: Entity.hpp:371
Definition: Entity.hpp:88
LeafIntersectionIterator ileafbegin() const
Start iterator for the cell-cell intersections of this entity.
Definition: Entity.hpp:356
bool hasBoundaryIntersections() const
Returns true if any of my intersections are on the boundary.
Definition: Entity.hpp:454
int index() const
The (positive) index of an entity.
Definition: EntityRep.hpp:126
Entity()
Constructor taking a grid and an integer entity representation.
Definition: Entity.hpp:114
LevelIntersectionIterator ilevelend() const
End iterator for the cell-cell intersections of this entity.
Definition: Entity.hpp:349
bool isNew() const
Returns true, if the entity has been created during the last call to adapt(). Dummy.
Definition: Entity.hpp:212
This class encapsulates geometry for both vertices, intersections and cells.
Definition: CpGridData.hpp:92
EntityPointer(const CpGridData &grid, EntityRep< codim > entityrep)
Constructor taking a grid and an entity representation.
Definition: Entity.hpp:297
unsigned int subEntities(const unsigned int cc) const
The count of subentities of codimension cc.
Definition: Entity.hpp:413
Struct that hods all the data needed to represent a Cpgrid.
Definition: CpGridData.hpp:105
Iterator intended to be used as LeafIterator and LevelIterator (no difference due to no adaptivity) f...
Definition: Entity.hpp:52
EntityPointer()
Construction empty entity pointer.
Definition: Entity.hpp:286
LeafIntersectionIterator ileafend() const
End iterator for the cell-cell intersections of this entity.
Definition: Entity.hpp:363
EntityPointerType father() const
Dummy, returning this.
Definition: Entity.hpp:231
PartitionType partitionType() const
For now, the grid is serial and the only partitionType() is InteriorEntity.
Definition: Entity.hpp:384
const Entity * operator->() const
Const member by pointer operator.
Definition: Entity.hpp:309
void compactify()
Minimizes memory usage.
Definition: Entity.hpp:325
Entity(const CpGridData &grid, int index_arg, bool orientation_arg)
Constructor taking a grid, entity index and orientation.
Definition: Entity.hpp:126
EntityPointer(const CpGridData &grid, int index_arg, bool orientation_arg)
Constructor taking a grid, entity index and orientation.
Definition: Entity.hpp:303
bool operator==(const EntityRep &other) const
Equality operator.
Definition: EntityRep.hpp:174
bool isLeaf() const
The entity is always on the leaf grid, since we have no refinement.
Definition: Entity.hpp:160
bool operator==(const Entity &other) const
Equality.
Definition: Entity.hpp:132
bool hasFather() const
No hierarchy in this grid.
Definition: Entity.hpp:224
bool isRegular() const
Refinement is not defined for CpGrid.
Definition: Entity.hpp:166
LocalGeometry geometryInFather() const
Dummy, returning default geometry.
Definition: Entity.hpp:238
const Geometry & geometry() const
Returns the geometry of the entity (does not depend on its orientation).
Definition: Entity.hpp:429
Class representing a pointer to an entity.
Definition: Entity.hpp:50
LevelIntersectionIterator ilevelbegin() const
Start iterator for the cell-cell intersections of this entity.
Definition: Entity.hpp:342
const Entity & operator*() const
Const dereferencing operator.
Definition: Entity.hpp:316
Only needs to provide interface for doing nothing.
Definition: Iterators.hpp:88
Codim< cc >::EntityPointer subEntity(int i) const
Obtain subentity.
int count() const
The count of subentities of codimension cc.
Definition: Entity.hpp:187
Represents an entity of a given codim, with positive or negative orientation.
Definition: CpGridData.hpp:94
bool isValid() const
isValid method for EntitySeed
Definition: Entity.hpp:467
bool mightVanish() const
Returns true, if entity might disappear during the next call to adapt(). Dummy.
Definition: Entity.hpp:218
int level() const
We do not support refinement, so level() is always 0.
Definition: Entity.hpp:154
GeometryType type() const
Using the cube type for all entities now (cells and vertices).
Definition: Entity.hpp:175
Definition: Intersection.hpp:286
EntityPointer(const Entity &e)
Construction from entity.
Definition: Entity.hpp:291
bool operator!=(const Entity &other) const
Inequality.
Definition: Entity.hpp:138
Entity(const CpGridData &grid, EntityRep< codim > entityrep)
Constructor taking a grid and an entity representation.
Definition: Entity.hpp:120
HierarchicIterator hend(int) const
Dummy beyond last child iterator.
Definition: Entity.hpp:378