5#ifndef DUNE_GRID_COMMON_GRID_HH
6#define DUNE_GRID_COMMON_GRID_HH
17#include <dune/common/fvector.hh>
18#include <dune/common/typetraits.hh>
19#include <dune/common/typeutilities.hh>
22#include <dune/geometry/type.hh>
35#include <dune/common/bartonnackmanifcheck.hh>
338 template<
int mydim,
int cdim,
class Gr
idImp,
template<
int,
int,
class>
class GeometryImp>
class Geometry;
343 template<
int codim,
int dim,
class Gr
idImp,
template<
int,
int,
class>
class EntityImp>
class Entity;
344 template<
int codim,
class Gr
id,
class IteratorImp >
class EntityIterator;
345 template<
class Gr
idImp,
class EntitySeedImp>
class EntitySeed;
346 template<
class Gr
idImp,
class IntersectionImp >
class Intersection;
347 template<
class Gr
idImp,
class IntersectionIteratorImp,
class IntersectionImp >
class IntersectionIterator;
348 template<
class Gr
idImp,
class IndexSetImp,
class IndexTypeImp =
unsigned int,
class TypesImp = std::vector< GeometryType > >
class IndexSet;
349 template<
class Gr
idImp,
class IdSetImp,
class IdTypeImp>
class IdSet;
374 template<
int dim,
int dimworld,
class ct,
class Gr
idFamily>
376 typedef typename GridFamily::Traits::Grid GridImp;
425 template <PartitionIteratorType pitype>
548 return asImp().maxLevel();
552 int size (
int level,
int codim)
const
554 CHECK_INTERFACE_IMPLEMENTATION(
asImp().
size(level,codim));
555 return asImp().size(level,codim);
561 CHECK_INTERFACE_IMPLEMENTATION(
asImp().
size(codim));
562 return asImp().size(codim);
568 CHECK_INTERFACE_IMPLEMENTATION(
asImp().
size(level,type));
569 return asImp().size(level,type);
575 CHECK_INTERFACE_IMPLEMENTATION(
asImp().
size(type));
576 return asImp().size(type);
588 return asImp().numBoundarySegments();
600 return asImp().levelGridView(level);
606 return asImp().leafGridView();
622 return asImp().globalIdSet();
629 return asImp().localIdSet();
636 return asImp().levelIndexSet(level);
643 return asImp().leafIndexSet();
674 return asImp().mark(refCount,e);
685 return asImp().getMark(e);
696 return asImp().preAdapt();
715 return asImp().adapt();
724 return asImp().postAdapt();
738 CHECK_INTERFACE_IMPLEMENTATION(
asImp().
comm());
739 return asImp().comm();
749 return asImp().loadBalance();
759 template<
class DataHandle>
763 return asImp().loadBalance(data);
767 template <
class EntitySeed >
768 typename Codim< EntitySeed :: codimension > :: Entity
772 return asImp().entity( seed );
776 GridImp&
asImp () {
return static_cast<GridImp &
> (*this);}
778 const GridImp&
asImp ()
const {
return static_cast<const GridImp &
>(*this);}
781#undef CHECK_INTERFACE_IMPLEMENTATION
782#undef CHECK_AND_CALL_INTERFACE_IMPLEMENTATION
800 template<
int dim,
int dimworld,
class ct,
class Gr
idFamily>
817 template<
int dim,
int dimworld,
class ct,
class Gr
idFamily>
863 typedef typename GridFamily::Traits::Grid GridImp;
871 typedef typename GridFamily::Traits
Traits;
876 typedef typename Traits::LevelGridView View;
877 typedef typename View::GridViewImp ViewImp;
878 return View(ViewImp(
asImp(),level));
884 typedef typename Traits::LeafGridView View;
885 typedef typename View::GridViewImp ViewImp;
886 return View(ViewImp(
asImp()));
954 template<
class DataHandle>
961 using Grid< dim, dimworld, ct, GridFamily >
::asImp;
977 template <
int dim,
int dimw,
class GridImp,
978 template<
int,
int,
class>
class GeometryImp,
979 template<
int,
int,
class>
class EntityImp,
980 template<
int,PartitionIteratorType,
class>
class LevelIteratorImp,
981 template<
class>
class LeafIntersectionImp,
982 template<
class>
class LevelIntersectionImp,
983 template<
class>
class LeafIntersectionIteratorImp,
984 template<
class>
class LevelIntersectionIteratorImp,
985 template<
class>
class HierarchicIteratorImp,
986 template<
int,PartitionIteratorType,
class>
class LeafIteratorImp,
987 class LevelIndexSetImp,
class LeafIndexSetImp,
988 class GlobalIdSetImp,
class GIDType,
class LocalIdSetImp,
class LIDType,
class CCType,
989 template<
class>
class LevelGridViewTraits,
990 template<
class>
class LeafGridViewTraits,
991 template<
int,
class>
class EntitySeedImp,
992 template<
int,
int,
class>
class LocalGeometryImp = GeometryImp
1037 template <PartitionIteratorType pitype>
1053 friend class Dune::Entity<cd, dim, const GridImp, EntityImp>;
1074 [[deprecated(
"Use Communication instead!")]]
1079 namespace Capabilities
1083 template<
int dim,
int dimworld,
typename ct,
class Gr
idFamily ,
int codim >
1090 template<
int dim,
int dimworld,
typename ct,
class Gr
idFamily ,
int cdim >
1105 template <
class InterfaceType>
Provides base classes for index and id sets.
Describes the parallel communication interface class for MessageBuffers and DataHandles.
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
Grid< dim, dimworld, ct, GridFamily >::LeafGridView leafGridView(const Grid< dim, dimworld, ct, GridFamily > &grid)
leaf grid view for the given grid
Definition: common/grid.hh:819
Grid< dim, dimworld, ct, GridFamily >::LevelGridView levelGridView(const Grid< dim, dimworld, ct, GridFamily > &grid, int level)
level grid view for the given grid and level.
Definition: common/grid.hh:802
Include standard header files.
Definition: agrid.hh:60
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: common/intersection.hh:164
Definition: geometryreference.hh:139
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
Wrapper class for entities.
Definition: common/entity.hh:66
interface class for an iterator over grid entities
Definition: entityiterator.hh:32
Store a reference to an entity with a minimal memory footprint.
Definition: common/entityseed.hh:26
Definition: common/grid.hh:862
bool adapt()
Refine all positive marked leaf entities coarsen all negative marked entities if possible.
Definition: common/grid.hh:939
bool mark(int refCount, const typename Traits ::template Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: common/grid.hh:915
void postAdapt()
clean up some markers
Definition: common/grid.hh:945
int getMark(const typename Traits::template Codim< 0 >::Entity &e) const
returns adaptation mark for given entity, i.e. here the default implementation returns 0.
Definition: common/grid.hh:927
bool preAdapt()
returns true, if at least one entity is marked for adaption
Definition: common/grid.hh:942
bool loadBalance(DataHandle &data)
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:955
Traits::LeafGridView leafGridView() const
View for the leaf grid for All_Partition.
Definition: common/grid.hh:882
bool loadBalance()
default implementation of load balance does nothing and returns false
Definition: common/grid.hh:948
Traits::LevelGridView levelGridView(int level) const
View for a grid level for All_Partition.
Definition: common/grid.hh:874
GridFamily::Traits Traits
The traits of this class.
Definition: common/grid.hh:871
Wrapper class for geometries.
Definition: common/geometry.hh:71
Definition: common/grid.hh:339
Mesh entities of codimension 0 ("elements") allow to visit all intersections with "neighboring" eleme...
Definition: common/intersectioniterator.hh:83
Index Set Interface base class.
Definition: indexidset.hh:78
Id Set Interface.
Definition: indexidset.hh:452
Grid abstract base class.
Definition: common/grid.hh:375
const LevelIndexSet & levelIndexSet(int level) const
return const reference to the grids level index set for level level
Definition: common/grid.hh:633
static constexpr int dimension
The dimension of the grid.
Definition: common/grid.hh:387
int size(int level, GeometryType type) const
Return number of entities per level and geometry type in this process.
Definition: common/grid.hh:566
GridFamily::Traits::LocalIdSet LocalIdSet
A type that is a model of Dune::IdSet which provides a unique and persistent numbering for all entiti...
Definition: common/grid.hh:509
GridFamily::Traits::LeafIntersectionIterator LeafIntersectionIterator
A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine,...
Definition: common/grid.hh:468
int size(int level, int codim) const
Return number of grid entities of a given codim on a given level in this process.
Definition: common/grid.hh:552
bool preAdapt()
To be called after entities have been marked and before adapt() is called.
Definition: common/grid.hh:694
GridFamily::Traits::LevelIndexSet LevelIndexSet
A type that is a model of Dune::IndexSet which provides a consecutive, but non persistent,...
Definition: common/grid.hh:488
GridImp & asImp()
Barton-Nackman trick.
Definition: common/grid.hh:776
GridFamily::Traits::HierarchicIterator HierarchicIterator
A type that is a model of Dune::HierarchicIterator A type of iterator that allows to examine,...
Definition: common/grid.hh:482
GridFamily::Traits::LevelGridView LevelGridView
type of view for level grid
Definition: common/grid.hh:402
GridFamily::Traits::LeafIntersection LeafIntersection
A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimensio...
Definition: common/grid.hh:456
GridFamily::Traits::LevelIntersectionIterator LevelIntersectionIterator
A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine,...
Definition: common/grid.hh:475
LeafGridView leafGridView() const
View for the leaf grid for All_Partition.
Definition: common/grid.hh:604
GridFamily::Traits::GlobalIdSet GlobalIdSet
A type that is a model of Dune::IdSet which provides a unique and persistent numbering for all entiti...
Definition: common/grid.hh:502
const GridImp & asImp() const
Barton-Nackman trick.
Definition: common/grid.hh:778
static constexpr int dimensionworld
The dimension of the world the grid lives in.
Definition: common/grid.hh:390
void postAdapt()
To be called after grid has been adapted and information left over by the adaptation has been process...
Definition: common/grid.hh:722
bool mark(int refCount, const typename Codim< 0 >::Entity &e)
Marks an entity to be refined/coarsened in a subsequent adapt.
Definition: common/grid.hh:672
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
Codim< EntitySeed::codimension >::Entity entity(const EntitySeed &seed) const
obtain Entity from EntitySeed.
Definition: common/grid.hh:769
GridFamily::Traits::LeafIndexSet LeafIndexSet
A type that is a model of Dune::IndexSet which provides a consecutive, but non persistent,...
Definition: common/grid.hh:494
int maxLevel() const
Return maximum level defined in this grid. Levels are numbered 0 ... maxLevel with 0 the coarsest lev...
Definition: common/grid.hh:545
typename T::CollectiveCommunication DeprecatedCollectiveCommunication_t
Definition: common/grid.hh:515
size_t numBoundarySegments() const
returns the number of boundary segments within the macro grid
Definition: common/grid.hh:585
const GlobalIdSet & globalIdSet() const
return const reference to the grids global id set
Definition: common/grid.hh:619
int getMark(const typename Codim< 0 >::Entity &e) const
returns adaptation mark for given entity
Definition: common/grid.hh:683
GridFamily::Traits::LevelIntersection LevelIntersection
A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimensio...
Definition: common/grid.hh:461
Communication CollectiveCommunication
Definition: common/grid.hh:529
const LeafIndexSet & leafIndexSet() const
return const reference to the grids leaf index set
Definition: common/grid.hh:640
const LocalIdSet & localIdSet() const
return const reference to the grids local id set
Definition: common/grid.hh:626
LevelGridView levelGridView(int level) const
View for a grid level for All_Partition.
Definition: common/grid.hh:598
bool loadBalance(DataHandle &data)
Re-balances the load each process has to handle for a parallel grid and moves the data.
Definition: common/grid.hh:760
GridFamily::Traits::LeafGridView LeafGridView
type of view for leaf grid
Definition: common/grid.hh:400
bool loadBalance()
Re-balances the load each process has to handle for a parallel grid,.
Definition: common/grid.hh:746
bool adapt()
Refine all positive marked leaf entities, coarsen all negative marked entities if possible.
Definition: common/grid.hh:713
typename T::Communication Communication_t
Definition: common/grid.hh:513
int size(int codim) const
Return number of leaf entities of a given codim in this process.
Definition: common/grid.hh:559
ct ctype
Define type used for coordinates in grid module.
Definition: common/grid.hh:532
void globalRefine(int refCount)
Refine the grid refCount times using the default refinement rule.
Definition: common/grid.hh:659
const Communication & comm() const
return const reference to a communication object. The return type is a model of Dune::Communication.
Definition: common/grid.hh:736
int size(GeometryType type) const
Return number of leaf entities per geometry type in this process.
Definition: common/grid.hh:573
A Traits struct that collects all associated types of one implementation.
Definition: common/grid.hh:411
GridFamily::Traits::template Codim< cd >::Entity Entity
A type that is a model of a Dune::Entity<cd,dim,...>.
Definition: common/grid.hh:419
GridFamily::Traits::template Codim< cd >::LocalGeometry LocalGeometry
A type that is a model of Dune::Geometry<dim-cd,dim>.
Definition: common/grid.hh:416
GridFamily::Traits::template Codim< cd >::LevelIterator LevelIterator
A type that is a model of Dune::LevelIterator with partition type All_Partition.
Definition: common/grid.hh:446
GridFamily::Traits::template Codim< cd >::Geometry Geometry
A type that is a model of Dune::Geometry<dim-cd,dimworld>.
Definition: common/grid.hh:413
GridFamily::Traits::template Codim< cd >::EntitySeed EntitySeed
A type that is a model (not yet) of Dune::EntitySeed<cd,dim,...>.
Definition: common/grid.hh:422
GridFamily::Traits::template Codim< cd >::LeafIterator LeafIterator
A type that is a model of Dune::LeafIterator with partition type All_Partition.
Definition: common/grid.hh:450
A struct collecting all types depending on the partition iterator type.
Definition: common/grid.hh:427
GridFamily::Traits::template Codim< cd >::template Partition< pitype >::LevelIterator LevelIterator
A type that is a model of Dune::LevelIterator<cd,pitype,...> which is s type of iterator that may be ...
Definition: common/grid.hh:434
GridFamily::Traits::template Codim< cd >::template Partition< pitype >::LeafIterator LeafIterator
A type that is a model of Dune::LeafIterator<cd,pitype,...> which is a type of iterator that may be u...
Definition: common/grid.hh:441
A traits struct that collects all associated types of one grid model.
Definition: common/grid.hh:995
CCType Communication
The type of the communication.
Definition: common/grid.hh:1071
Dune::IntersectionIterator< const GridImp, LeafIntersectionIteratorImp< const GridImp >, LeafIntersectionImp< const GridImp > > LeafIntersectionIterator
The type of the intersection iterator at the leafs of the grid.
Definition: common/grid.hh:1004
IdSet< const GridImp, LocalIdSetImp, LIDType > LocalIdSet
The type of the local id set.
Definition: common/grid.hh:1068
Dune::GridView< LeafGridViewTraits< const GridImp > > LeafGridView
type of view for leaf grid
Definition: common/grid.hh:1057
IdSet< const GridImp, GlobalIdSetImp, GIDType > GlobalIdSet
The type of the global id set.
Definition: common/grid.hh:1066
Dune::EntityIterator< 0, const GridImp, HierarchicIteratorImp< const GridImp > > HierarchicIterator
The type of the hierarchic iterator.
Definition: common/grid.hh:1009
IndexSet< const GridImp, LeafIndexSetImp > LeafIndexSet
The type of the leaf index set.
Definition: common/grid.hh:1064
Communication CollectiveCommunication
Definition: common/grid.hh:1075
Dune::Intersection< const GridImp, LeafIntersectionImp< const GridImp > > LeafIntersection
The type of the intersection at the leafs of the grid.
Definition: common/grid.hh:1000
IndexSet< const GridImp, LevelIndexSetImp > LevelIndexSet
The type of the level index set.
Definition: common/grid.hh:1062
Dune::GridView< LevelGridViewTraits< const GridImp > > LevelGridView
type of view for level grid
Definition: common/grid.hh:1059
Dune::IntersectionIterator< const GridImp, LevelIntersectionIteratorImp< const GridImp >, LevelIntersectionImp< const GridImp > > LevelIntersectionIterator
The type of the intersection iterator at the levels of the grid.
Definition: common/grid.hh:1006
Dune::Intersection< const GridImp, LevelIntersectionImp< const GridImp > > LevelIntersection
The type of the intersection at the levels of the grid.
Definition: common/grid.hh:1002
GridImp Grid
The type that implements the grid.
Definition: common/grid.hh:997
Traits associated with a specific codim.
Definition: common/grid.hh:1017
Partition< All_Partition >::LevelIterator LevelIterator
The type of the entity pointer for entities of this codim.
Definition: common/grid.hh:1050
Dune::EntitySeed< const GridImp, EntitySeedImp< cd, const GridImp > > EntitySeed
The type of the entity seed of this codim.
Definition: common/grid.hh:1031
LocalGeometryImp< dim-cd, dim, const GridImp > LocalGeometryImpl
Definition: common/grid.hh:1020
GeometryImp< dim-cd, dimw, const GridImp > GeometryImpl
Definition: common/grid.hh:1019
Dune::Geometry< dim-cd, dim, const GridImp, LocalGeometryImp > LocalGeometry
The type of the local geometry associated with the entity.
Definition: common/grid.hh:1025
Dune::Geometry< dim-cd, dimw, const GridImp, GeometryImp > Geometry
IMPORTANT: Codim<codim>::Geometry == Geometry<dim-codim,dimw>
Definition: common/grid.hh:1023
Dune::Entity< cd, dim, const GridImp, EntityImp > Entity
The type of the entity.
Definition: common/grid.hh:1028
Partition< All_Partition >::LeafIterator LeafIterator
The type of the iterator over all leaf entities of this codim.
Definition: common/grid.hh:1047
Traits associated with a specific grid partition type.
Definition: common/grid.hh:1039
Dune::EntityIterator< cd, const GridImp, LevelIteratorImp< cd, pitype, const GridImp > > LevelIterator
The type of the iterator over the level entities of this codim on this partition.
Definition: common/grid.hh:1041
Dune::EntityIterator< cd, const GridImp, LeafIteratorImp< cd, pitype, const GridImp > > LeafIterator
The type of the iterator over the leaf entities of this codim on this partition.
Definition: common/grid.hh:1043
GridDefaultImplementation< dim, dimworld, ct, GridFamily > GridType
Definition: common/grid.hh:1093
GridType::Traits::Grid GridImp
Definition: common/grid.hh:1094
Definition: common/grid.hh:1107
InterfaceType::Implementation ImplementationType
Definition: common/grid.hh:1108
MakeableInterfaceObject(const ImplementationType &realImp)
create interface object by calling the contructor of the base class
Definition: common/grid.hh:1110
Grid view abstract base class.
Definition: common/gridview.hh:66
A set of traits classes to store static information about grid implementation.
Interface class EntitySeed.