Dune::SGrid< dim, dimworld > Class Template Reference
[Grid Implementations]
#include <sgrid.hh>
Inheritance diagram for Dune::SGrid< dim, dimworld >:

Detailed Description
template<int dim, int dimworld>
class Dune::SGrid< dim, dimworld >
[ provides Dune::Grid ] A structured mesh in d dimensions consisting of "cubes" (pilot implementation of the Dune grid interface, for debugging only).
This module describes the pilot implementation of the Dune grid interface. It implements the grid interface for simple structured meshes.
- Warning:
- SGrid is slow. It is intended for debugging only.

Class diagram for classes in the grid interface
Short description of the classes:
- SGeometry is a class template providing the geometric part of a grid entity, i.e. a general polyhedron with a mapping from a reference polyhedron to the actual polyhedron.
- SLevelIterator is a class template which allows to iterate over all grid entities of a given codimension and level.
- SEntity is a class template realizing the grid entities. Grid entities are the constituents of a grid. Grid entities of codimension 0 and codimension dim are defines through specialization. Entities can be used as template parameters to generic algorithms. Each entity must therefore provide the nested classes Geometry, LevelIterator, HierarchicIterator and IntersectionIterator. Geometry and LevelIterator are derived from the classes SELement and SLevelIterator. Note that entities of codimension 0 and dim have an extended interface.
- SEntity::IntersectionIterator provides access to all entities of codimension 0 sharing an object of codimension 1 with the given entity of codimension 0. This interface covers nonmatching grids.
- SEntity::HierarchicIterator provides access to the sons of an entity of codimension 0.
- SGrid is conceptualized as a container of grid entities of various codimensions. Since grids are used as template parameters to generic algorithms they must include the nested classes LevelIterator and Entity which are derived from SLevelIterator and SEntity.
A Grid is a container of grid entities. Given a dimension dim these entities have a codimension codim with 0 <= codim <= dim.
The Grid is assumed to be hierachically refined and nested. It enables iteration over entities of a given level and codimension.
All information is provided to allocate degrees of freedom in appropriate vector data structures.
- Note:
- When SGrid is instantiated with dimworld strictly greater than dim, the result is a dim-dimensional structured grid which is embedded in the first dim components of dimworld-dimensional Euclidean space.
Public Types | |
enum | |
maximum number of levels allowed | |
typedef SGridFamily< dim, dimworld >::Traits | Traits |
the traits of this class | |
typedef sgrid_ctype | ctype |
define type used for coordinates in grid module | |
Exported constants | |
enum | { dimension = dim } |
A constant that exports the template parameter dim. More... | |
enum | { dimensionworld = dimworld } |
A constant that exports the template parameter dimworld. More... | |
Public Member Functions | |
std::string | name () const |
return the name of this grid | |
SGrid (const int *N_, const sgrid_ctype *H_) | |
Make an SGrid from extend and number of cells per direction. | |
SGrid (const int *N_, const sgrid_ctype *L_, const sgrid_ctype *H_) | |
Make an SGrid from position, extend and number of cells per direction. | |
SGrid (FieldVector< int, dim > N_, FieldVector< sgrid_ctype, dim > L_, FieldVector< sgrid_ctype, dim > H_) | |
Make an SGrid from position, extend and number of cells per direction. | |
SGrid () | |
empty constructor making grid of unit square discretized with one cell | |
~SGrid () | |
SGrid destructor. | |
int | maxLevel () const |
template<int cd, PartitionIteratorType pitype> | |
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator | lbegin (int level) const |
Iterator to first entity of given codim on level. | |
template<int cd, PartitionIteratorType pitype> | |
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator | lend (int level) const |
one past the end on this level | |
template<int cd> | |
Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator | lbegin (int level) const |
Iterator to first entity of given codim on level. | |
template<int cd> | |
Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator | lend (int level) const |
one past the end on this level | |
template<int cd, PartitionIteratorType pitype> | |
Traits::template Codim< cd >::template Partition< pitype >::LeafIterator | leafbegin () const |
return LeafIterator which points to the first entity | |
template<int cd, PartitionIteratorType pitype> | |
Traits::template Codim< cd >::template Partition< pitype >::LeafIterator | leafend () const |
one past the end on the leaf level | |
template<int cd> | |
Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator | leafbegin () const |
return LeafIterator which points to the first entity | |
template<int cd> | |
Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator | leafend () const |
return LeafIterator which points behind the last entity | |
template<class T, template< class > class P, int codim> | |
void | communicate (T &t, InterfaceType iftype, CommunicationDirection dir, int level) |
int | size (int level, int codim) const |
number of grid entities per level and codim | |
int | size (int codim) const |
number of leaf entities per codim in this process | |
int | size (int level, GeometryType type) const |
number of entities per level and geometry type in this process | |
int | size (GeometryType type) const |
number of leaf entities per codim and geometry type in this process | |
int | global_size (int codim) const |
number of grid entities of all level for given codim | |
int | overlapSize (int level, int codim) |
return size (= distance in graph) of overlap region | |
int | ghostSize (int level, int codim) |
return size (= distance in graph) of ghost region | |
void | globalRefine (int refCount) |
Refine mesh globally by one refCount levels. | |
const array< int, dim > & | dims (int level) const |
Get number of elements in each coordinate direction. | |
const FieldVector< sgrid_ctype, dimworld > & | lowerLeft () const |
Get lower left corner. | |
FieldVector< sgrid_ctype, dimworld > | upperRight () const |
Get upper right corner. | |
bool | adapt () |
map adapt to global refine | |
FieldVector< sgrid_ctype, dimworld > | pos (int level, array< int, dim > &z) const |
map expanded coordinates to position | |
int | calc_codim (int level, const array< int, dim > &z) const |
compute codim from coordinate | |
int | n (int level, const array< int, dim > &z) const |
compute number from expanded coordinate | |
array< int, dim > | z (int level, int i, int codim) const |
compute coordinates from number and codimension | |
array< int, dim > | compress (int level, const array< int, dim > &z) const |
compress from expanded coordinates to grid for a single partition number | |
array< int, dim > | expand (int level, const array< int, dim > &r, int b) const |
expand with respect to partition number | |
int | partition (int level, const array< int, dim > &z) const |
bool | exists (int level, const array< int, dim > &zred) const |
given reduced coordinates of an element, determine if element is in the grid | |
const Traits::GlobalIdSet & | globalIdSet () const |
return const reference to the grids global id set | |
const Traits::LocalIdSet & | localIdSet () const |
return const reference to the grids local id set | |
const Traits::LevelIndexSet & | levelIndexSet (int level) const |
return const reference to the grids level index set for level level | |
const Traits::LeafIndexSet & | leafIndexSet () const |
return const reference to the grids leaf index set | |
const CollectiveCommunication< SGrid > & | comm () const |
return const reference to a collective communication object. The return type is a model of Dune::CollectiveCommunication. | |
int | overlapSize (int level, int codim) const |
return size (= distance in graph) of overlap region | |
int | overlapSize (int codim) const |
return size (= distance in graph) of overlap region | |
int | ghostSize (int level, int codim) const |
return size (= distance in graph) of ghost region | |
int | ghostSize (int codim) const |
return size (= distance in graph) of ghost region | |
bool | mark (int refCount, const typename Traits::template Codim< 0 >::EntityPointer &e) |
Marks an entity to be refined/coarsened in a subsequent adapt. | |
int | getMark (const typename Traits::template Codim< 0 >::EntityPointer &) const |
returns adaptation mark for given entity, i.e. here the default implementation returns 0. | |
bool | preAdapt () |
returns true, if at least one entity is marked for adaption | |
void | postAdapt () |
clean up some markers | |
void | communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const |
void | communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir) const |
bool | loadBalance () |
default implementation of load balance does nothing and returns false | |
bool | loadBalance (DataHandle &data) |
default implementation of load balance does nothing and returns false | |
Adaptivity and grid refinement | |
bool | mark (int refCount, const typename Codim< 0 >::EntityPointer &e) |
Marks an entity to be refined/coarsened in a subsequent adapt. | |
int | getMark (const typename Codim< 0 >::EntityPointer &e) const |
returns adaptation mark for given entity pointer | |
Protected Member Functions | |
ReturnImplementationType< InterfaceType >::ImplementationType & | getRealImplementation (InterfaceType &i) const |
return real implementation of interface class | |
GridImp & | asImp () |
Barton-Nackman trick. | |
const GridImp & | asImp () const |
Barton-Nackman trick. |
Member Enumeration Documentation
anonymous enum [inherited] |
anonymous enum [inherited] |
Constructor & Destructor Documentation
Dune::SGrid< dim, dimworld >::SGrid | ( | const int * | N_, | |
const sgrid_ctype * | H_ | |||
) | [inline] |
Make an SGrid from extend and number of cells per direction.
- Parameters:
-
[in] N_ number of cells in each direction on coarsest level [in] H_ extend of the unit cube in each dimension
Dune::SGrid< dim, dimworld >::SGrid | ( | const int * | N_, | |
const sgrid_ctype * | L_, | |||
const sgrid_ctype * | H_ | |||
) | [inline] |
Make an SGrid from position, extend and number of cells per direction.
- Parameters:
-
[in] N_ number of cells in each direction on coarsest level [in] L_ position of origin of the cube [in] H_ position of the upper right corner of the cube
Dune::SGrid< dim, dimworld >::SGrid | ( | FieldVector< int, dim > | N_, | |
FieldVector< sgrid_ctype, dim > | L_, | |||
FieldVector< sgrid_ctype, dim > | H_ | |||
) | [inline] |
Make an SGrid from position, extend and number of cells per direction.
- Parameters:
-
[in] N_ number of cells in each direction on coarsest level [in] L_ position of origin of the cube [in] H_ position of the upper right corner of the cube
Member Function Documentation
int Dune::SGrid< dim, dimworld >::maxLevel | ( | ) | const [inline] |
Return maximum level defined in this grid. Levels are numbered 0 ... maxLevel with 0 the coarsest level.
Reimplemented from Dune::Grid< dim, dimworld, ct, GridFamily >.
void Dune::SGrid< dim, dimworld >::communicate | ( | T & | t, | |
InterfaceType | iftype, | |||
CommunicationDirection | dir, | |||
int | level | |||
) | [inline] |
The communication interface
- Parameters:
-
T,: array class holding data associated with the entities P,: type used to gather/scatter data in and out of the message buffer codim,: communicate entites of given codim if,: one of the predifined interface types, throws error if it is not implemented level,: communicate for entities on the given level
int Dune::SGrid< dim, dimworld >::partition | ( | int | level, | |
const array< int, dim > & | z | |||
) | const [inline] |
There are possibilities of having even/odd coordinates. The binary representation is called partition number.
bool Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld > >::mark | ( | int | refCount, | |
const typename Traits::template Codim< 0 >::EntityPointer & | e | |||
) | [inline, inherited] |
Marks an entity to be refined/coarsened in a subsequent adapt.
- Parameters:
-
[in] refCount Number of subdivisions that should be applied. Negative value means coarsening. [in] e EntityPointer to Entity that should be refined
- Returns:
- true if Entity was marked, false otherwise.
- Note:
- default implementation is: return false; for grids with no adaptation.
- for the grid programmer: this method is implemented as a template method, because the Entity type is not defined when the class is instantiated You won't need this trick in the implementation. In your implementation you should use it as This template method will vanish due to the inheritance rules.
bool mark( int refCount, typename Traits::template Codim<0>::EntityPointer & e ).
bool Dune::Grid< dim, dimworld, ct, GridFamily >::mark | ( | int | refCount, | |
const typename Codim< 0 >::EntityPointer & | e | |||
) | [inline, inherited] |
Marks an entity to be refined/coarsened in a subsequent adapt.
- Parameters:
-
[in] refCount Number of subdivisions that should be applied. Negative value means coarsening. [in] e EntityPointer to Entity that should be refined
- Returns:
- true if Entity was marked, false otherwise.
int Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld > >::getMark | ( | const typename Traits::template Codim< 0 >::EntityPointer & | ) | const [inline, inherited] |
returns adaptation mark for given entity, i.e. here the default implementation returns 0.
- Parameters:
-
[in] e EntityPointer for which adaptation mark should be determined
- Returns:
- int adaptation mark, here the default value 0 is returned
int Dune::Grid< dim, dimworld, ct, GridFamily >::getMark | ( | const typename Codim< 0 >::EntityPointer & | e | ) | const [inline, inherited] |
returns adaptation mark for given entity pointer
- Parameters:
-
[in] e EntityPointer for which adaptation mark should be determined
- Returns:
- int adaptation mark currently set for given EntityPointer e
void Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld > >::communicate | ( | CommDataHandleIF< DataHandleImp, DataTypeImp > & | data, | |
InterfaceType | iftype, | |||
CommunicationDirection | dir, | |||
int | level | |||
) | const [inline, inherited] |
dummy communicate, doing nothing
Reimplemented from Dune::Grid< dim, dimworld, ct, GridFamily >.
void Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld > >::communicate | ( | CommDataHandleIF< DataHandleImp, DataTypeImp > & | data, | |
InterfaceType | iftype, | |||
CommunicationDirection | dir | |||
) | const [inline, inherited] |
dummy communicate, doing nothing
Reimplemented from Dune::Grid< dim, dimworld, ct, GridFamily >.
The documentation for this class was generated from the following files:
- sgrid.hh
- sgrid.cc