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>
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;
182 leafIndexSet_(*this),
193 for (
size_t i=0; i<levelIndexSets_.size(); i++)
194 if (levelIndexSets_[i])
195 delete (levelIndexSets_[i]);
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 {
283 return levelIndexSets_[level]->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 >
349 typename Traits::template Codim<EntitySeed::codimension>::Entity
358 return EntityImp(
this,
hostgrid_->entity(this->getRealImplementation(seed).hostEntitySeed()));
386 return hostgrid_->mark(refCount, getHostEntity<0>(e));
395 return hostgrid_->getMark(getHostEntity<0>(e));
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.")
521 localIdSet_.update();
523 globalIdSet_.update();
528 for (
int i=levelIndexSets_.size(); i<=
maxLevel(); i++) {
531 levelIndexSets_.push_back(p);
535 if (levelIndexSets_[i])
536 levelIndexSets_[i]->update(*
this, i);
538 leafIndexSet_.update(*
this);
543 CollectiveCommunication<IdentityGrid> ccobj;
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
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:258
Definition: identitygridindexsets.hh:194
The IdentityGridEntitySeed class.
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
Return refinement mark for entity.
Definition: identitygrid.hh:393
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:168
int size(GeometryType type) const
number of leaf entities per codim and geometry type in this process
Definition: identitygrid.hh:288
Index Set Interface base class.
Definition: common/grid.hh:361
Definition: common/entityseed.hh:28
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
An intersection with a leaf neighbor elementMesh entities of codimension 0 ("elements") allow to visi...
Definition: identitygridintersections.hh:29
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:23
The index and id sets for the IdentityGrid class.
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: identitygrid.hh:271
Definition: identitygridentity.hh:27
int size(int level, GeometryType type) const
number of entities per level, codim and geometry type in this process
Definition: identitygrid.hh:282
Definition: identitygridentity.hh:21
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
Types for GridView.
Definition: common/grid.hh:420
int size(int codim) const
number of leaf entities per codim in this process
Definition: identitygrid.hh:276
Wrapper class for entities.
Definition: common/entity.hh:61
IdentityGridFamily< HostGrid::dimension, HostGrid > GridFamily
type of the used GridFamily for this grid
Definition: identitygrid.hh:167
Specialize with 'true' if implementation supports parallelism. (default=false)
Definition: common/capabilities.hh:68
void postAdapt()
Clean up refinement markers.
Definition: identitygrid.hh:411
Specialize with 'true' if implementation guarantees conforming level grids. (default=false) ...
Definition: common/capabilities.hh:98
The IdentityGridEntityPointer class.
IdentityGridFamily< HostGrid::dimension, HostGrid >::Traits Traits
the Traits
Definition: identitygrid.hh:170
Traits::template Codim< codim >::LeafIterator leafend() const
one past the end of the sequence of leaf entities
Definition: identitygrid.hh:244
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:1305
provides access to host grid objects from GeometryGrid
Definition: identitygrid.hh:37
unsigned int overlapSize(int level, int codim) const
Size of the overlap on a given level.
Definition: identitygrid.hh:430
Wrapper class for pointers to entities.
Definition: common/entitypointer.hh:112
int size(int level, int codim) const
Number of grid entities per level and codim.
Definition: identitygrid.hh:265
Specialize with 'true' if implementation guarantees a conforming leaf grid. (default=false) ...
Definition: common/capabilities.hh:107
const Traits::LocalIdSet & localIdSet() const
Access to the LocalIdSet.
Definition: identitygrid.hh:301
Id Set Interface.
Definition: common/grid.hh:362
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:251
The IdentityGridLevelIterator class and its specializations.
Definition: identitygridgeometry.hh:17
Traits::template Codim< EntitySeed::codimension >::EntityPointer entityPointer(const EntitySeed &seed) const
Create EntityPointer from EntitySeed.
Definition: identitygrid.hh:335
Definition: identitygrid.hh:92
unsigned int overlapSize(int codim) const
Size of the overlap on the leaf level.
Definition: identitygrid.hh:418
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:16
Definition: identitygridindexsets.hh:95
Specialize with 'true' for all codims that a grid implements entities for. (default=false) ...
Definition: common/capabilities.hh:57
The IdentityGridHierarchicIterator class.
~IdentityGrid()
Desctructor.
Definition: identitygrid.hh:190
Different resources needed by all grid implementations.
Definition: identitygridintersections.hh:195
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleafiterator.hh:19
Definition: defaultgridview.hh:23
const HostGrid::Traits::template Codim< codim >::Entity & getHostEntity(const typename Traits::template Codim< codim >::Entity &e) const
Definition: identitygrid.hh:506
Provides a meta grid that is identical to its host.
Definition: identitygrid.hh:33
void communicate(CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
Definition: common/grid.hh:1209
HostGrid::ctype ctype
The type used to store coordinates, inherited from the HostGrid.
Definition: identitygrid.hh:173
static const bool v
Definition: common/capabilities.hh:59
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:84
Definition: identitygridindexsets.hh:246
Definition: identitygrid.hh:52
HostGrid::Traits::template Codim< codim >::EntityPointer getHostEntityPointer(const typename Traits::template Codim< codim >::Entity &e) const
Returns the hostgrid entity encapsulated in given IdentityGrid entity.
Definition: identitygrid.hh:500
The IdentityGridEntity class.
unsigned int ghostSize(int level, int codim) const
Size of the ghost cell layer on a given level.
Definition: identitygrid.hh:436
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: identitygrid.hh:399
int maxLevel() const
Return maximum level defined in this grid.
Definition: identitygrid.hh:203
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:1343
const Traits::GlobalIdSet & globalIdSet() const
Access to the GlobalIdSet.
Definition: identitygrid.hh:295
IdentityGrid(HostGrid &hostgrid)
Constructor.
Definition: identitygrid.hh:180
Definition: common/geometry.hh:24
void globalRefine(int refCount)
Definition: identitygrid.hh:369
Traits::template Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
Create Entity from EntitySeed.
Definition: identitygrid.hh:350
The IdentityGridGeometry class and its specializations.
Definition: identitygridindexsets.hh:18
Iterator over all element neighborsMesh entities of codimension 0 ("elements") allow to visit all nei...
Definition: identitygridentity.hh:30
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:1346
The IdentityGridLeafIntersectionIterator and IdentityGridLevelIntersectionIterator classes...
const CollectiveCommunication< IdentityGrid > & comm() const
dummy collective communication
Definition: identitygrid.hh:480
Dune::EntityPointer< const typename BaseTraits::Grid, IdentityGridEntityPointer< codim, const typename BaseTraits::Grid, typename HostGrid::template Codim< codim >::EntityPointer > > EntityPointer
Definition: identitygrid.hh:112
bool adapt()
Triggers the grid refinement process.
Definition: identitygrid.hh:405
bool mark(int refCount, const typename Traits::template Codim< 0 >::Entity &e)
Mark entity for refinement.
Definition: identitygrid.hh:384
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:1220
HostGrid * hostgrid_
The host grid which contains the actual grid hierarchy structure.
Definition: identitygrid.hh:514
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: identitygridentity.hh:33
Definition: identitygrid.hh:99
unsigned int ghostSize(int codim) const
Size of the ghost cell layer on the leaf level.
Definition: identitygrid.hh:424
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
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
HostGridType & getHostGrid() const
Returns the hostgrid this IdentityGrid lives in.
Definition: identitygrid.hh:491
const Traits::LeafIndexSet & leafIndexSet() const
Access to the LeafIndexSet.
Definition: identitygrid.hh:318
Definition: defaultgridview.hh:223
Traits::template Codim< codim >::LevelIterator lbegin(int level) const
Iterator to first entity of given codim on level.
Definition: identitygrid.hh:209
Include standard header files.
Definition: agrid.hh:59
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:437
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridentity.hh:24
IndexType size(GeometryType type) const
Return total number of entities of given geometry type in entity set .
Definition: indexidset.hh:232
Traits::template Codim< codim >::LevelIterator lend(int level) const
one past the end on this level
Definition: identitygrid.hh:216
The EntitySeed class provides the minimal information needed to restore an Entity using the grid...
Definition: identitygridentityseed.hh:21
Traits::template Codim< codim >::LeafIterator leafbegin() const
Iterator to first leaf entity of given codim.
Definition: identitygrid.hh:237
A set of traits classes to store static information about grid implementation.
const Traits::LevelIndexSet & levelIndexSet(int level) const
Access to the LevelIndexSets.
Definition: identitygrid.hh:307
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:178