Go to the documentation of this file.
3 #ifndef DUNE_GRID_IDENTITYGRID_HH
4 #define DUNE_GRID_IDENTITYGRID_HH
13 #include <dune/common/deprecated.hh>
14 #include <dune/common/parallel/collectivecommunication.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 CollectiveCommunication<IdentityGrid<HostGrid> >,
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]);
174 template<
int codim, PartitionIteratorType PiType>
181 template<
int codim, PartitionIteratorType PiType>
202 template<
int codim, PartitionIteratorType PiType>
209 template<
int codim, PartitionIteratorType PiType>
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 >
287 return EntityImp(
this,
hostgrid_->entity(this->getRealImplementation(seed).hostEntitySeed()));
315 return hostgrid_->mark(refCount, getHostEntity<0>(e));
324 return hostgrid_->getMark(getHostEntity<0>(e));
360 return hostgrid_->overlapSize(level,codim);
366 return hostgrid_->ghostSize(level,codim);
376 void loadBalance(
int strategy,
int minlevel,
int depth,
int maxlevel,
int minelement){
377 DUNE_THROW(NotImplemented,
"IdentityGrid::loadBalance()");
391 template<
class T,
template<
class>
class P,
int codim>
398 template<
class DataHandle>
402 template<
class DataHandle>
443 localIdSet_.update();
445 globalIdSet_.update();
450 for (
int i=levelIndexSets_.size(); i<=
maxLevel(); i++) {
453 levelIndexSets_.push_back(p);
457 if (levelIndexSets_[i])
458 levelIndexSets_[i]->update(*
this, i);
460 leafIndexSet_.update(*
this);
465 CollectiveCommunication<IdentityGrid> ccobj;
468 std::vector<IdentityGridLevelIndexSet<const IdentityGrid<HostGrid> >*> levelIndexSets_;
484 namespace Capabilities
489 template<
class HostGr
id,
int codim>
498 template<
class HostGr
id>
507 template<
class HostGr
id>
516 #endif // DUNE_GRID_IDENTITYGRID_HH
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23
void globalRefine(int refCount)
Definition: identitygrid.hh:298
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< IdentityGrid< HostGrid > >, DefaultLevelGridViewTraits, DefaultLeafGridViewTraits, IdentityGridEntitySeed > Traits
Definition: identitygrid.hh:68
Definition: identitygridindexsets.hh:246
Different resources needed by all grid implementations.
The implementation of entities in a IdentityGrid.
Definition: identitygridentity.hh:18
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: identitygrid.hh:365
The index and id sets for the IdentityGrid class.
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: identitygrid.hh:313
HostGrid * hostgrid_
The host grid which contains the actual grid hierarchy structure.
Definition: identitygrid.hh:436
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: identitygrid.hh:328
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:1034
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
Definition: common/entityseed.hh:28
Include standard header files.
Definition: agrid.hh:59
The IdentityGridLeafIterator class.
The EntitySeed class provides the minimal information needed to restore an Entity using the grid.
Definition: identitygridentityseed.hh:21
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
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:189
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: identitygrid.hh:247
HostGrid HostGridType
Definition: identitygrid.hh:112
The IdentityGridLeafIntersectionIterator and IdentityGridLevelIntersectionIterator classes.
int maxLevel() const
Return maximum level defined in this grid.
Definition: identitygrid.hh:155
The IdentityGridEntityPointer class.
Definition: identitygridintersections.hh:194
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:33
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:210
Definition: identitygridindexsets.hh:194
int size(int codim) const
number of leaf entities per codim in this process
Definition: identitygrid.hh:228
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleafiterator.hh:19
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: identitygrid.hh:217
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:428
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false)
Definition: common/capabilities.hh:86
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:161
Definition: identitygridindexsets.hh:18
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:414
Specialize with 'true' for all codims that a grid implements entities for. (default=false)
Definition: common/capabilities.hh:55
The IdentityGridLevelIterator class and its specializations.
The IdentityGridHierarchicIterator class.
An intersection with a leaf neighbor element.
Definition: identitygridintersections.hh:29
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1156
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
Definition: identitygridindexsets.hh:95
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:168
static const bool v
Definition: common/capabilities.hh:88
HostGrid::ctype ctype
The type used to store coordinates, inherited from the HostGrid.
Definition: identitygrid.hh:125
Id Set Interface.
Definition: common/grid.hh:347
Specialize with 'true' if implementation guarantees conforming level grids. (default=false)
Definition: common/capabilities.hh:77
Definition: identitygridgeometry.hh:17
Definition: defaultgridview.hh:221
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:215
A set of traits classes to store static information about grid implementation.
void communicate(CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: common/grid.hh:1023
void postAdapt()
Clean up refinement markers.
Definition: identitygrid.hh:340
The IdentityGridEntitySeed class.
Definition: common/geometry.hh:24
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridentity.hh:24
Index Set Interface base class.
Definition: common/grid.hh:346
The IdentityGridEntity class.
IdentityGridFamily< HostGrid::dimension, HostGrid >::Traits Traits
the Traits
Definition: identitygrid.hh:122
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: identitygrid.hh:234
static std::conditional< std::is_reference< InterfaceType >::value, typename std::add_lvalue_reference< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type, typename std::remove_const< typename ReturnImplementationType< typename std::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation(InterfaceType &&i)
return real implementation of interface class
Definition: common/grid.hh:1119
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:1159
static const bool v
Definition: common/capabilities.hh:57
GridFamily::Traits::template Codim< cd >::Entity Entity
A type that is a model of a Dune::Entity<cd,dim,...>.
Definition: common/grid.hh:423
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:420
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: identitygrid.hh:322
static const bool v
Definition: common/capabilities.hh:79
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: identitygrid.hh:253
const CollectiveCommunication< IdentityGrid > & comm() const
dummy collective communication
Definition: identitygrid.hh:409
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: identitygrid.hh:240
The IdentityGridGeometry class and its specializations.
Definition: defaultgridview.hh:23
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: identitygrid.hh:270
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: identitygrid.hh:223
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: identitygrid.hh:259
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: identitygrid.hh:359
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:196
Iterator over all element neighbors.
Definition: identitygridentity.hh:30
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: identitygrid.hh:279
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:182
~IdentityGrid()
Desctructor.
Definition: identitygrid.hh:142
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: identitygrid.hh:347
Iterator over the descendants of an entity.
Definition: identitygridentity.hh:33
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:203
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: identitygrid.hh:353
Definition: identitygrid.hh:40
bool adapt()
Triggers the grid refinement process.
Definition: identitygrid.hh:334
IdentityGrid(HostGrid &hostgrid)
Constructor.
Definition: identitygrid.hh:132
IdentityGridFamily< HostGrid::dimension, HostGrid > GridFamily
type of the used GridFamily for this grid
Definition: identitygrid.hh:119
Definition: identitygridentity.hh:27