3 #ifndef DUNE_GRID_IDENTITYGRID_HH
4 #define DUNE_GRID_IDENTITYGRID_HH
13 #include <dune/common/parallel/communication.hh>
30 template <
class HostGr
id>
34 template<
class Gr
id >
35 struct HostGridAccess;
37 template<
int dim,
class HostGr
id>
45 HostGrid::dimensionworld,
59 typename HostGrid::Traits::GlobalIdSet::IdType,
61 typename HostGrid::Traits::LocalIdSet::IdType,
62 CollectiveCommunication<No_Comm>,
82 template <
class HostGr
id>
85 typename HostGrid::ctype, IdentityGridFamily<HostGrid::dimension, HostGrid> >
95 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
98 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
102 template<
int codim_,
int dim_,
class Gr
idImp_>
123 typedef typename HostGrid::ctype
ctype;
132 leafIndexSet_(*this),
143 for (
size_t i=0; i<levelIndexSets_.size(); i++)
144 if (levelIndexSets_[i])
145 delete (levelIndexSets_[i]);
172 template<
int codim, PartitionIteratorType PiType>
179 template<
int codim, PartitionIteratorType PiType>
200 template<
int codim, PartitionIteratorType PiType>
207 template<
int codim, PartitionIteratorType PiType>
215 int size (
int level,
int codim)
const {
233 return levelIndexSets_[level]->size(type);
259 if (level < 0 || level >
maxLevel())
261 DUNE_THROW(
GridError,
"levelIndexSet of nonexisting level " << level <<
" requested!");
263 return *levelIndexSets_[level];
270 return leafIndexSet_;
275 template <
class EntitySeed >
285 return EntityImp(
this,
hostgrid_->entity(seed.
impl().hostEntitySeed()));
313 return hostgrid_->mark(refCount, getHostEntity<0>(e));
322 return hostgrid_->getMark(getHostEntity<0>(e));
346 return hostgrid_->leafGridView().overlapSize(codim);
352 return hostgrid_->leafGridView().ghostSize(codim);
358 return hostgrid_->levelGridView(level).overlapSize(codim);
364 return hostgrid_->levelGridView(level).ghostSize(codim);
374 void loadBalance(
int strategy,
int minlevel,
int depth,
int maxlevel,
int minelement){
375 DUNE_THROW(NotImplemented,
"IdentityGrid::loadBalance()");
402 return e.
impl().hostEntity_;
415 localIdSet_.update();
417 globalIdSet_.update();
422 for (
int i=levelIndexSets_.size(); i<=
maxLevel(); i++) {
425 levelIndexSets_.push_back(p);
429 if (levelIndexSets_[i])
430 levelIndexSets_[i]->update(*
this, i);
432 leafIndexSet_.update(*
this);
437 CollectiveCommunication<No_Comm> ccobj;
440 std::vector<IdentityGridLevelIndexSet<const IdentityGrid<HostGrid> >*> levelIndexSets_;
456 namespace Capabilities
461 template<
class HostGr
id,
int codim>
467 template<
class HostGr
id,
int codim>
476 template<
class HostGr
id,
int codim>
485 template<
class HostGr
id>
494 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:58
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:130
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=hasEntity<codim>:...
Definition: common/capabilities.hh:72
static const bool v
Definition: common/capabilities.hh:73
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: common/capabilities.hh:95
static const bool v
Definition: common/capabilities.hh:96
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:851
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:937
Index Set Interface base class.
Definition: indexidset.hh:76
auto size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:221
Id Set Interface.
Definition: indexidset.hh:450
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:518
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:414
GridFamily::Traits::template Codim< cd >::Entity Entity
A type that is a model of a Dune::Entity<cd,dim,...>.
Definition: common/grid.hh:422
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:984
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:986
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:86
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: identitygrid.hh:311
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: identitygrid.hh:257
IdentityGridFamily< HostGrid::dimension, HostGrid >::Traits Traits
the Traits
Definition: identitygrid.hh:120
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: identitygrid.hh:215
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: identitygrid.hh:232
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:173
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: identitygrid.hh:363
HostGrid HostGridType
Definition: identitygrid.hh:110
const CollectiveCommunication< No_Comm > & comm() const
dummy collective communication
Definition: identitygrid.hh:381
void postAdapt()
Clean up refinement markers.
Definition: identitygrid.hh:338
bool adapt()
Triggers the grid refinement process.
Definition: identitygrid.hh:332
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:201
HostGrid * hostgrid_
The host grid which contains the actual grid hierarchy structure.
Definition: identitygrid.hh:408
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:166
int size(int codim) const
number of leaf entities per codim in this process
Definition: identitygrid.hh:226
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: identitygrid.hh:245
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: identitygrid.hh:238
int maxLevel() const
Return maximum level defined in this grid.
Definition: identitygrid.hh:153
HostGrid::ctype ctype
The type used to store coordinates, inherited from the HostGrid.
Definition: identitygrid.hh:123
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:159
~IdentityGrid()
Desctructor.
Definition: identitygrid.hh:140
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:392
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: identitygrid.hh:277
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: identitygrid.hh:221
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:194
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:208
IdentityGridFamily< HostGrid::dimension, HostGrid > GridFamily
type of the used GridFamily for this grid
Definition: identitygrid.hh:117
void globalRefine(int refCount)
Definition: identitygrid.hh:296
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:180
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: identitygrid.hh:345
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: identitygrid.hh:268
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:400
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: identitygrid.hh:251
IdentityGrid(HostGrid &hostgrid)
Constructor.
Definition: identitygrid.hh:130
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:187
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: identitygrid.hh:357
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: identitygrid.hh:326
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: identitygrid.hh:351
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: identitygrid.hh:320
provides access to host grid objects from GeometryGrid
Definition: hostgridaccess.hh:27
Definition: identitygrid.hh:39
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:66
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.