3 #ifndef DUNE_GRID_IDENTITYGRID_HH
4 #define DUNE_GRID_IDENTITYGRID_HH
13 #include <dune/common/deprecated.hh>
14 #include <dune/common/parallel/communication.hh>
31 template <
class HostGr
id>
35 template<
class Gr
id >
36 struct HostGridAccess;
38 template<
int dim,
class HostGr
id>
46 HostGrid::dimensionworld,
60 typename HostGrid::Traits::GlobalIdSet::IdType,
62 typename HostGrid::Traits::LocalIdSet::IdType,
63 CollectiveCommunication<No_Comm>,
83 template <
class HostGr
id>
86 typename HostGrid::ctype, IdentityGridFamily<HostGrid::dimension, HostGrid> >
96 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
99 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
103 template<
int codim_,
int dim_,
class Gr
idImp_>
124 typedef typename HostGrid::ctype
ctype;
133 leafIndexSet_(*this),
144 for (
size_t i=0; i<levelIndexSets_.size(); i++)
145 if (levelIndexSets_[i])
146 delete (levelIndexSets_[i]);
160 typename Traits::template Codim<codim>::LevelIterator
lbegin (
int level)
const {
167 typename Traits::template Codim<codim>::LevelIterator
lend (
int level)
const {
173 template<
int codim, PartitionIteratorType PiType>
174 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lbegin (
int level)
const {
180 template<
int codim, PartitionIteratorType PiType>
181 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lend (
int level)
const {
188 typename Traits::template Codim<codim>::LeafIterator
leafbegin()
const {
195 typename Traits::template Codim<codim>::LeafIterator
leafend()
const {
201 template<
int codim, PartitionIteratorType PiType>
202 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafbegin()
const {
208 template<
int codim, PartitionIteratorType PiType>
209 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafend()
const {
216 int size (
int level,
int codim)
const {
234 return levelIndexSets_[level]->size(type);
260 if (level < 0 || level >
maxLevel())
262 DUNE_THROW(
GridError,
"levelIndexSet of nonexisting level " << level <<
" requested!");
264 return *levelIndexSets_[level];
271 return leafIndexSet_;
276 template <
class EntitySeed >
277 typename Traits::template Codim<EntitySeed::codimension>::Entity
286 return EntityImp(
this,
hostgrid_->entity(seed.
impl().hostEntitySeed()));
312 bool mark(
int refCount,
const typename Traits::template Codim<0>::Entity & e)
314 return hostgrid_->mark(refCount, getHostEntity<0>(e));
321 int getMark(
const typename Traits::template Codim<0>::Entity & e)
const
323 return hostgrid_->getMark(getHostEntity<0>(e));
347 return hostgrid_->leafGridView().overlapSize(codim);
353 return hostgrid_->leafGridView().ghostSize(codim);
359 return hostgrid_->levelGridView(level).overlapSize(codim);
365 return hostgrid_->levelGridView(level).ghostSize(codim);
375 void loadBalance(
int strategy,
int minlevel,
int depth,
int maxlevel,
int minelement){
376 DUNE_THROW(NotImplemented,
"IdentityGrid::loadBalance()");
401 const typename HostGrid::Traits::template Codim<codim>::Entity&
getHostEntity(
const typename Traits::template Codim<codim>::Entity& e)
const
403 return e.
impl().hostEntity_;
416 localIdSet_.update();
418 globalIdSet_.update();
423 for (
int i=levelIndexSets_.size(); i<=
maxLevel(); i++) {
426 levelIndexSets_.push_back(p);
430 if (levelIndexSets_[i])
431 levelIndexSets_[i]->update(*
this, i);
433 leafIndexSet_.update(*
this);
438 CollectiveCommunication<No_Comm> ccobj;
441 std::vector<IdentityGridLevelIndexSet<const IdentityGrid<HostGrid> >*> levelIndexSets_;
457 namespace Capabilities
462 template<
class HostGr
id,
int codim>
468 template<
class HostGr
id,
int codim>
477 template<
class HostGr
id>
486 template<
class HostGr
id>
The IdentityGridEntity class.
The IdentityGridEntitySeed class.
The IdentityGridGeometry class and its specializations.
The IdentityGridHierarchicIterator class.
The index and id sets for the IdentityGrid class.
The IdentityGridLeafIntersectionIterator and IdentityGridLevelIntersectionIterator classes.
The IdentityGridLeafIterator class.
The IdentityGridLevelIterator class.
Include standard header files.
Definition: agrid.hh:59
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:180
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:56
static const bool v
Definition: common/capabilities.hh:57
specialize with 'true' for all codims that a grid provides an iterator for (default=false)
Definition: common/capabilities.hh:72
static const bool v
Definition: common/capabilities.hh:73
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:104
static const bool v
Definition: common/capabilities.hh:105
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:113
static const bool v
Definition: common/capabilities.hh:114
Definition: defaultgridview.hh:24
Definition: defaultgridview.hh:206
Implementation & impl()
access to the underlying implementation
Definition: common/entity.hh:78
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:24
Implementation & impl()
access to the underlying implementation
Definition: common/entityseed.hh:57
@ codimension
Definition: common/entityseed.hh:28
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:18
Definition: common/grid.hh:855
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:941
Index Set Interface base class.
Definition: indexidset.hh:76
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:220
Id Set Interface.
Definition: indexidset.hh:441
GridFamily::Traits::CollectiveCommunication CollectiveCommunication
A type that is a model of Dune::CollectiveCommunication. It provides a portable way for collective co...
Definition: common/grid.hh:519
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1065
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:1067
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:87
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: identitygrid.hh:312
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: identitygrid.hh:258
IdentityGridFamily< HostGrid::dimension, HostGrid >::Traits Traits
the Traits
Definition: identitygrid.hh:121
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: identitygrid.hh:216
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: identitygrid.hh:233
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:174
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: identitygrid.hh:364
HostGrid HostGridType
Definition: identitygrid.hh:111
const CollectiveCommunication< No_Comm > & comm() const
dummy collective communication
Definition: identitygrid.hh:382
void postAdapt()
Clean up refinement markers.
Definition: identitygrid.hh:339
bool adapt()
Triggers the grid refinement process.
Definition: identitygrid.hh:333
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:202
HostGrid * hostgrid_
The host grid which contains the actual grid hierarchy structure.
Definition: identitygrid.hh:409
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:167
int size(int codim) const
number of leaf entities per codim in this process
Definition: identitygrid.hh:227
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: identitygrid.hh:246
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: identitygrid.hh:239
int maxLevel() const
Return maximum level defined in this grid.
Definition: identitygrid.hh:154
HostGrid::ctype ctype
The type used to store coordinates, inherited from the HostGrid.
Definition: identitygrid.hh:124
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:160
~IdentityGrid()
Desctructor.
Definition: identitygrid.hh:141
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:393
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: identitygrid.hh:278
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: identitygrid.hh:222
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:195
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:209
IdentityGridFamily< HostGrid::dimension, HostGrid > GridFamily
type of the used GridFamily for this grid
Definition: identitygrid.hh:118
void globalRefine(int refCount)
Definition: identitygrid.hh:297
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:181
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: identitygrid.hh:346
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: identitygrid.hh:269
const HostGrid::Traits::template Codim< codim >::Entity & getHostEntity(const typename Traits::template Codim< codim >::Entity &e) const
Returns the hostgrid entity encapsulated in given IdentityGrid entity.
Definition: identitygrid.hh:401
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: identitygrid.hh:252
IdentityGrid(HostGrid &hostgrid)
Constructor.
Definition: identitygrid.hh:131
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:188
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: identitygrid.hh:358
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: identitygrid.hh:327
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: identitygrid.hh:352
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: identitygrid.hh:321
provides access to host grid objects from GeometryGrid
Definition: hostgridaccess.hh:27
Definition: identitygrid.hh:40
GridTraits< dim, HostGrid::dimensionworld, Dune::IdentityGrid< HostGrid >, IdentityGridGeometry, IdentityGridEntity, IdentityGridLevelIterator, IdentityGridLeafIntersection, IdentityGridLevelIntersection, IdentityGridLeafIntersectionIterator, IdentityGridLevelIntersectionIterator, IdentityGridHierarchicIterator, IdentityGridLeafIterator, IdentityGridLevelIndexSet< const IdentityGrid< HostGrid > >, IdentityGridLeafIndexSet< const IdentityGrid< HostGrid > >, IdentityGridGlobalIdSet< const IdentityGrid< HostGrid > >, typename HostGrid::Traits::GlobalIdSet::IdType, IdentityGridLocalIdSet< const IdentityGrid< HostGrid > >, typename HostGrid::Traits::LocalIdSet::IdType, CollectiveCommunication< No_Comm >, DefaultLevelGridViewTraits, DefaultLeafGridViewTraits, IdentityGridEntitySeed > Traits
Definition: identitygrid.hh:67
The implementation of entities in a IdentityGrid.
Definition: identitygridentity.hh:53
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleveliterator.hh:19
Definition: identitygridintersectioniterator.hh:82
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: identitygridintersectioniterator.hh:27
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: identitygridhierarchiciterator.hh:24
The EntitySeed class provides the minimal information needed to restore an Entity using the grid.
Definition: identitygridentityseed.hh:22
Definition: identitygridgeometry.hh:19
Definition: identitygridindexsets.hh:24
Definition: identitygridindexsets.hh:101
Definition: identitygridindexsets.hh:197
Definition: identitygridindexsets.hh:249
An intersection with a leaf neighbor elementMesh entities of codimension 0 ("elements") allow to visi...
Definition: identitygridintersections.hh:31
Definition: identitygridintersections.hh:190
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleafiterator.hh:20
A set of traits classes to store static information about grid implementation.
Different resources needed by all grid implementations.