5#ifndef DUNE_GRID_IDENTITYGRID_HH
6#define DUNE_GRID_IDENTITYGRID_HH
15#include <dune/common/parallel/communication.hh>
32 template <
class HostGr
id>
36 template<
class Gr
id >
39 template<
int dim,
class HostGr
id>
47 HostGrid::dimensionworld,
61 typename HostGrid::Traits::GlobalIdSet::IdType,
63 typename HostGrid::Traits::LocalIdSet::IdType,
64 Communication<No_Comm>,
84 template <
class HostGr
id>
87 typename HostGrid::ctype, IdentityGridFamily<HostGrid::dimension, HostGrid> >
97 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
100 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
104 template<
int codim_,
int dim_,
class Gr
idImp_>
125 typedef typename HostGrid::ctype
ctype;
134 leafIndexSet_(*this),
145 for (
size_t i=0; i<levelIndexSets_.size(); i++)
146 if (levelIndexSets_[i])
147 delete (levelIndexSets_[i]);
161 typename Traits::template Codim<codim>::LevelIterator
lbegin (
int level)
const {
168 typename Traits::template Codim<codim>::LevelIterator
lend (
int level)
const {
174 template<
int codim, PartitionIteratorType PiType>
175 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lbegin (
int level)
const {
181 template<
int codim, PartitionIteratorType PiType>
182 typename Traits::template Codim<codim>::template Partition<PiType>::LevelIterator
lend (
int level)
const {
189 typename Traits::template Codim<codim>::LeafIterator
leafbegin()
const {
196 typename Traits::template Codim<codim>::LeafIterator
leafend()
const {
202 template<
int codim, PartitionIteratorType PiType>
203 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafbegin()
const {
209 template<
int codim, PartitionIteratorType PiType>
210 typename Traits::template Codim<codim>::template Partition<PiType>::LeafIterator
leafend()
const {
217 int size (
int level,
int codim)
const {
235 return levelIndexSets_[level]->size(type);
261 if (level < 0 || level >
maxLevel())
263 DUNE_THROW(
GridError,
"levelIndexSet of nonexisting level " << level <<
" requested!");
265 return *levelIndexSets_[level];
272 return leafIndexSet_;
277 template <
class EntitySeed >
278 typename Traits::template Codim<EntitySeed::codimension>::Entity
287 return EntityImp(
this,
hostgrid_->entity(seed.
impl().hostEntitySeed()));
313 bool mark(
int refCount,
const typename Traits::template Codim<0>::Entity & e)
315 return hostgrid_->mark(refCount, getHostEntity<0>(e));
322 int getMark(
const typename Traits::template Codim<0>::Entity & e)
const
324 return hostgrid_->getMark(getHostEntity<0>(e));
348 return hostgrid_->leafGridView().overlapSize(codim);
354 return hostgrid_->leafGridView().ghostSize(codim);
360 return hostgrid_->levelGridView(level).overlapSize(codim);
366 return hostgrid_->levelGridView(level).ghostSize(codim);
376 void loadBalance(
int strategy,
int minlevel,
int depth,
int maxlevel,
int minelement){
377 DUNE_THROW(NotImplemented,
"IdentityGrid::loadBalance()");
402 const typename HostGrid::Traits::template Codim<codim>::Entity&
getHostEntity(
const typename Traits::template Codim<codim>::Entity& e)
const
404 return e.
impl().hostEntity_;
417 localIdSet_.update();
419 globalIdSet_.update();
424 for (
int i=levelIndexSets_.size(); i<=
maxLevel(); i++) {
427 levelIndexSets_.push_back(p);
431 if (levelIndexSets_[i])
432 levelIndexSets_[i]->update(*
this, i);
434 leafIndexSet_.update(*
this);
439 Communication<No_Comm> ccobj;
442 std::vector<IdentityGridLevelIndexSet<const IdentityGrid<HostGrid> >*> levelIndexSets_;
458 namespace Capabilities
463 template<
class HostGr
id,
int codim>
469 template<
class HostGr
id,
int codim>
478 template<
class HostGr
id,
int codim>
487 template<
class HostGr
id>
496 template<
class HostGr
id>
The IdentityGridLevelIterator class.
The IdentityGridLeafIterator class.
The IdentityGridLeafIntersectionIterator and IdentityGridLevelIntersectionIterator classes.
The index and id sets for the IdentityGrid class.
The IdentityGridHierarchicIterator class.
The IdentityGridGeometry class and its specializations.
The IdentityGridEntitySeed class.
The IdentityGridEntity class.
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:58
static const bool v
Definition: common/capabilities.hh:59
specialize with 'true' for all codims that a grid provides an iterator for (default=hasEntity<codim>:...
Definition: common/capabilities.hh:74
static const bool v
Definition: common/capabilities.hh:75
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: common/capabilities.hh:97
static const bool v
Definition: common/capabilities.hh:98
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:106
static const bool v
Definition: common/capabilities.hh:107
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:115
static const bool v
Definition: common/capabilities.hh:116
Definition: defaultgridview.hh:26
Definition: defaultgridview.hh:219
Implementation & impl()
access to the underlying implementation
Definition: common/entity.hh:80
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:26
Implementation & impl()
access to the underlying implementation
Definition: common/entityseed.hh:59
static constexpr int codimension
codimension of underlying entity
Definition: common/entityseed.hh:30
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:20
Definition: common/grid.hh:862
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:948
Index Set Interface base class.
Definition: indexidset.hh:78
auto size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:223
Id Set Interface.
Definition: indexidset.hh:452
detected_or_fallback_t< DeprecatedCollectiveCommunication_t, Communication_t, typename GridFamily::Traits > Communication
A type that is a model of Dune::Communication. It provides a portable way for communication on the se...
Definition: common/grid.hh:525
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:995
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:997
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:88
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: identitygrid.hh:313
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:189
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: identitygrid.hh:259
IdentityGridFamily< HostGrid::dimension, HostGrid >::Traits Traits
the Traits
Definition: identitygrid.hh:122
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: identitygrid.hh:270
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: identitygrid.hh:217
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: identitygrid.hh:234
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:394
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: identitygrid.hh:365
HostGrid HostGridType
Definition: identitygrid.hh:112
void postAdapt()
Clean up refinement markers.
Definition: identitygrid.hh:340
bool adapt()
Triggers the grid refinement process.
Definition: identitygrid.hh:334
HostGrid * hostgrid_
The host grid which contains the actual grid hierarchy structure.
Definition: identitygrid.hh:410
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: identitygrid.hh:247
int size(int codim) const
number of leaf entities per codim in this process
Definition: identitygrid.hh:228
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:196
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:182
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: identitygrid.hh:240
int maxLevel() const
Return maximum level defined in this grid.
Definition: identitygrid.hh:155
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:175
HostGrid::ctype ctype
The type used to store coordinates, inherited from the HostGrid.
Definition: identitygrid.hh:125
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:168
~IdentityGrid()
Desctructor.
Definition: identitygrid.hh:142
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: identitygrid.hh:223
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: identitygrid.hh:253
IdentityGridFamily< HostGrid::dimension, HostGrid > GridFamily
type of the used GridFamily for this grid
Definition: identitygrid.hh:119
void globalRefine(int refCount)
Definition: identitygrid.hh:298
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:210
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: identitygrid.hh:347
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:161
IdentityGrid(HostGrid &hostgrid)
Constructor.
Definition: identitygrid.hh:132
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:402
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: identitygrid.hh:359
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: identitygrid.hh:328
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: identitygrid.hh:353
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: identitygrid.hh:279
const Communication< No_Comm > & comm() const
dummy communication
Definition: identitygrid.hh:383
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: identitygrid.hh:322
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:203
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
Definition: identitygrid.hh:41
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, Communication< No_Comm >, DefaultLevelGridViewTraits, DefaultLeafGridViewTraits, IdentityGridEntitySeed > Traits
Definition: identitygrid.hh:68
The implementation of entities in a IdentityGrid.
Definition: identitygridentity.hh:55
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleveliterator.hh:21
Definition: identitygridintersectioniterator.hh:84
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: identitygridintersectioniterator.hh:29
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: identitygridhierarchiciterator.hh:26
The EntitySeed class provides the minimal information needed to restore an Entity using the grid.
Definition: identitygridentityseed.hh:24
Definition: identitygridgeometry.hh:21
Definition: identitygridindexsets.hh:26
Definition: identitygridindexsets.hh:103
Definition: identitygridindexsets.hh:199
Definition: identitygridindexsets.hh:251
An intersection with a leaf neighbor elementMesh entities of codimension 0 ("elements") allow to visi...
Definition: identitygridintersections.hh:33
Definition: identitygridintersections.hh:192
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleafiterator.hh:22
A set of traits classes to store static information about grid implementation.
Different resources needed by all grid implementations.