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 >
44 template<
int,
typename>
45 struct DummyIdentityGridEntityPointer
51 template<
int dim,
class HostGr
id>
65 HostGrid::dimensionworld,
69 DummyIdentityGridEntityPointer,
80 typename HostGrid::Traits::GlobalIdSet::IdType,
82 typename HostGrid::Traits::LocalIdSet::IdType,
83 CollectiveCommunication<IdentityGrid<HostGrid> >,
100 :
public BaseTraits::template
Codim<codim>
109 const typename BaseTraits::Grid,
132 template <
class HostGr
id>
135 typename HostGrid::ctype, IdentityGridFamily<HostGrid::dimension, HostGrid> >
145 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
148 template<
int codim, PartitionIteratorType pitype,
class Gr
idImp_>
152 template<
int codim_,
int dim_,
class Gr
idImp_>
173 typedef typename HostGrid::ctype
ctype;
181 hostgrid_(&hostgrid),
182 leafIndexSet_(*this),
193 for (
size_t i=0; i<levelIndexSets_.size(); i++)
194 if (levelIndexSets_[i])
195 delete (levelIndexSets_[i]);
204 return hostgrid_->maxLevel();
222 template<
int codim, PartitionIteratorType PiType>
229 template<
int codim, PartitionIteratorType PiType>
250 template<
int codim, PartitionIteratorType PiType>
257 template<
int codim, PartitionIteratorType PiType>
265 int size (
int level,
int codim)
const {
266 return hostgrid_->size(level,codim);
272 return hostgrid_->numBoundarySegments();
277 return leafIndexSet().size(codim);
283 return levelIndexSets_[level]->size(type);
290 return leafIndexSet().size(type);
309 if (level < 0 || level > maxLevel())
311 DUNE_THROW(
GridError,
"levelIndexSet of nonexisting level " << level <<
" requested!");
313 return *levelIndexSets_[level];
320 return leafIndexSet_;
332 template <
class EntitySeed >
333 DUNE_DEPRECATED_MSG(
"entityPointer() is deprecated and will be removed after the release of dune-grid 2.4. Use entity() instead to directly obtain an Entity object.")
344 return EntityPointer(EntityPointerImp(
this, hostgrid_->entity(this->getRealImplementation(seed).hostEntitySeed())));
348 template <
class EntitySeed >
358 return EntityImp(
this, hostgrid_->entity(this->getRealImplementation(seed).hostEntitySeed()));
371 hostgrid_->globalRefine(refCount);
386 return hostgrid_->mark(refCount, getHostEntity<0>(e));
395 return hostgrid_->getMark(getHostEntity<0>(e));
400 return hostgrid_->preAdapt();
407 return hostgrid_->adapt();
412 return hostgrid_->postAdapt();
419 return hostgrid_->overlapSize(codim);
425 return hostgrid_->ghostSize(codim);
431 return hostgrid_->overlapSize(level,codim);
437 return hostgrid_->ghostSize(level,codim);
447 void loadBalance(
int strategy,
int minlevel,
int depth,
int maxlevel,
int minelement){
448 DUNE_THROW(NotImplemented,
"IdentityGrid::loadBalance()");
462 template<
class T,
template<
class>
class P,
int codim>
469 template<
class DataHandle>
473 template<
class DataHandle>
499 DUNE_DEPRECATED_MSG(
"getHostEntityPointer() is deprecated and will be removed after the release of dune-grid 2.4. Use getHostEntity() instead to obtain a reference to the host entity object.")
502 return this->getRealImplementation(e).hostEntity_;
508 return this->getRealImplementation(e).hostEntity_;
521 localIdSet_.update();
523 globalIdSet_.update();
528 for (
int i=levelIndexSets_.size(); i<=maxLevel(); i++) {
531 levelIndexSets_.push_back(p);
534 for (
int i=0; i<=maxLevel(); i++)
535 if (levelIndexSets_[i])
536 levelIndexSets_[i]->
update(*
this, i);
538 leafIndexSet_.update(*
this);
546 std::vector<IdentityGridLevelIndexSet<const IdentityGrid<HostGrid> >*> levelIndexSets_;
562 namespace Capabilities
567 template<
class HostGr
id,
int codim>
576 template<
class HostGr
id>
577 struct DUNE_DEPRECATED_MSG("Capabilities::
isParallel will be removed after dune-grid-2.4.")
isParallel<IdentityGrid<HostGrid> >
579 static const bool DUNE_DEPRECATED_MSG(
"Capabilities::isParallel will be removed after dune-grid-2.4.") v =
isParallel<HostGrid>::v;
585 template<class HostGrid>
594 template<
class HostGr
id>
603 #endif // DUNE_GRID_IDENTITYGRID_HH Definition: identitygridentity.hh:21
Id Set Interface.
Definition: common/grid.hh:362
Definition: identitygridgeometry.hh:17
Specialize with 'true' if implementation guarantees conforming level grids. (default=false) ...
Definition: common/capabilities.hh:98
Definition: identitygrid.hh:92
The IdentityGridEntityPointer class.
void postAdapt()
Clean up refinement markers.
Definition: identitygrid.hh:411
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: identitygridentity.hh:30
const HostGrid::Traits::template Codim< codim >::Entity & getHostEntity(const typename Traits::template Codim< codim >::Entity &e) const
Definition: identitygrid.hh:506
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:491
The IdentityGridLeafIntersectionIterator and IdentityGridLevelIntersectionIterator classes...
HostGrid::ctype ctype
The type used to store coordinates, inherited from the HostGrid.
Definition: identitygrid.hh:173
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: identitygrid.hh:282
The IdentityGridHierarchicIterator class.
int size(int codim) const
number of leaf entities per codim in this process
Definition: identitygrid.hh:276
HostGrid * hostgrid_
The host grid which contains the actual grid hierarchy structure.
Definition: identitygrid.hh:514
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false) ...
Definition: common/capabilities.hh:107
Dune::EntityPointer< const typename BaseTraits::Grid, IdentityGridEntityPointer< codim, const typename BaseTraits::Grid, typename HostGrid::template Codim< codim >::EntityPointer > > EntityPointer
Definition: identitygrid.hh:112
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: identitygrid.hh:301
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178
The IdentityGridLevelIterator class and its specializations.
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:1346
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: identitygrid.hh:399
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:251
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
IdentityGridFamily< HostGrid::dimension, HostGrid >::Traits Traits
the Traits
Definition: identitygrid.hh:170
int maxLevel() const
Return maximum level defined in this grid.
Definition: identitygrid.hh:203
Wrapper class for entities.
Definition: common/entity.hh:61
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:244
Definition: identitygridindexsets.hh:246
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: identitygrid.hh:436
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: identitygrid.hh:288
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: identitygrid.hh:307
Definition: identitygridintersections.hh:195
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:223
Wrapper class for pointers to entities.
Definition: common/entitypointer.hh:112
Definition: common/geometry.hh:24
The index and id sets for the IdentityGrid class.
Traits::template Codim< EntitySeed::codimension >::EntityPointer entityPointer(const EntitySeed &seed) const
Create EntityPointer from EntitySeed.
Definition: identitygrid.hh:335
IdentityGrid(HostGrid &hostgrid)
Constructor.
Definition: identitygrid.hh:180
The IdentityGridGeometry class and its specializations.
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: identitygrid.hh:350
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:545
Definition: identitygrid.hh:52
The IdentityGridEntity class.
Index Set Interface base class.
Definition: common/grid.hh:361
const CollectiveCommunication< IdentityGrid > & comm() const
dummy collective communication
Definition: identitygrid.hh:480
An intersection with a leaf neighbor elementMesh entities of codimension 0 ("elements") allow to visi...
Definition: identitygridintersections.hh:29
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: identitygridentity.hh:33
Definition: defaultgridview.hh:223
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: identitygrid.hh:295
Definition: identitygridindexsets.hh:18
~IdentityGrid()
Desctructor.
Definition: identitygrid.hh:190
Definition: identitygrid.hh:99
The IdentityGridLeafIterator class.
The implementation of entities in a IdentityGridA Grid is a container of grid entities. An entity is parametrized by the codimension. An entity of codimension c in dimension d is a d-c dimensional object.
Definition: identitygridentity.hh:18
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: identitygrid.hh:318
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridentity.hh:24
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:216
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: identitygrid.hh:393
void globalRefine(int refCount)
Definition: identitygrid.hh:369
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: identitygrid.hh:418
Definition: identitygridindexsets.hh:95
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: identitygrid.hh:424
Definition: identitygridindexsets.hh:194
Definition: defaultgridview.hh:23
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:258
Types for GridView.
Definition: common/grid.hh:420
The IdentityGridEntitySeed class.
void update(const GridImp &grid, int level)
Set up the index set.
Definition: identitygridindexsets.hh:81
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
Include standard header files.
Definition: agrid.hh:59
Definition: common/entityseed.hh:28
bool adapt()
Triggers the grid refinement process.
Definition: identitygrid.hh:405
The EntitySeed class provides the minimal information needed to restore an Entity using the grid...
Definition: identitygridentityseed.hh:21
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: identitygrid.hh:384
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: identitygrid.hh:271
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:230
HostGrid HostGridType
Definition: identitygrid.hh:160
A set of traits classes to store static information about grid implementation.
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:237
Specialize with 'true' for all codims that a grid implements entities for. (default=false) ...
Definition: common/capabilities.hh:57
Different resources needed by all grid implementations.
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1343
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: identitygrid.hh:430
Specialize with 'true' if implementation supports parallelism. (default=false)
Definition: common/capabilities.hh:68
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleafiterator.hh:19
IdentityGridFamily< HostGrid::dimension, HostGrid > GridFamily
type of the used GridFamily for this grid
Definition: identitygrid.hh:167
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: identitygrid.hh:265
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:33
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:437
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:209
Definition: identitygridentity.hh:27
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23