Dune Core Modules (2.4.2)

[ provides Dune::Grid ] More...

#include <dune/grid/sgrid.hh>

Public Types

enum  
 maximum number of levels allowed
 
typedef _ctype ctype
 define type used for coordinates in grid module
 
Exported constants
enum  
 A constant that exports the template parameter dim.
 
enum  
 A constant that exports the template parameter dimworld.
 
Exported types
typedef Partition< All_Partition >::LevelGridView LevelGridView
 View types for All_Partition.
 
typedef Partition< All_Partition >::LeafGridView LeafGridView
 
typedef GridFamily::Traits::LeafIntersection LeafIntersection
 A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimension 0 entities in the leaf view.
 
typedef GridFamily::Traits::LevelIntersection LevelIntersection
 A type that is a model of Dune::Intersection, an intersections of two codimension 1 of two codimension 0 entities in a level view.
 
typedef GridFamily::Traits::LeafIntersectionIterator LeafIntersectionIterator
 A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine, but not to modify, the intersections of codimension 1 of an leaf element (entity of codimension 0) with other leaf elements.
 
typedef GridFamily::Traits::LevelIntersectionIterator LevelIntersectionIterator
 A type that is a model of Dune::IntersectionIterator which is an iterator that allows to examine, but not to modify, the intersections of codimension 1 of an element (entity of codimension 0) with other elements on the same level.
 
typedef GridFamily::Traits::HierarchicIterator HierarchicIterator
 A type that is a model of Dune::HierarchicIterator A type of iterator that allows to examine, but not to modify, entities of codimension 0 that result from refinement of an entity of codimension 0.
 
typedef GridFamily::Traits::LevelIndexSet LevelIndexSet
 A type that is a model of Dune::IndexSet which provides a consecutive, but non persistent, numbering for entities on a grid level.
 
typedef GridFamily::Traits::LeafIndexSet LeafIndexSet
 A type that is a model of Dune::IndexSet which provides a consecutive, but non persistent, numbering for entities in the leaf grid.
 
typedef GridFamily::Traits::GlobalIdSet GlobalIdSet
 A type that is a model of Dune::IdSet which provides a unique and persistent numbering for all entities in the grid. The numbering is unique over all processes over which the grid is partitioned. The numbering is not necessarily consecutive.
 
typedef GridFamily::Traits::LocalIdSet LocalIdSet
 A type that is a model of Dune::IdSet which provides a unique and persistent numbering for all entities in the grid. The numbering is only unique in a single process and it is not necessarily consecutive.
 
typedef GridFamily::Traits::CollectiveCommunication CollectiveCommunication
 A type that is a model of Dune::CollectiveCommunication. It provides a portable way for collective communication on the set of processes used by the grid.
 

Public Member Functions

 SGrid (const int *const N_, const ctype *const H_)
 Make an SGrid from extend and number of cells per direction. More...
 
 SGrid (const int *const N_, const ctype *const L_, const ctype *const H_)
 Make an SGrid from position, extend and number of cells per direction. More...
 
 SGrid (FieldVector< int, dim > N_, FieldVector< ctype, dim > L_, FieldVector< ctype, dim > H_)
 Make an SGrid from position, extend and number of cells per direction. More...
 
 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
 
size_t numBoundarySegments () const
 returns the number of boundary segments within the macro grid
 
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< ctype, dimworld > & lowerLeft () const
 Get lower left corner.
 
FieldVector< ctype, dimworld > upperRight () const
 Get upper right corner.
 
bool adapt ()
 map adapt to global refine
 
Traits::template Codim< codim >::LevelIterator DUNE_DEPRECATED_MSG ("The method lbegin( level ) is superseded by levelGridView( level ).begin.") lbegin(int level) const
 Iterator to first entity of given codim on level for PartitionType All_Partition.
 
Traits::template Codim< codim >::LevelIterator DUNE_DEPRECATED_MSG ("The method lend( level ) is superseded by levelGridView( level ).end.") lend(int level) const
 one past the end on this level for PartitionType All_Partition
 
Traits::template Codim< codim >::template Partition< pitype >::LevelIterator DUNE_DEPRECATED_MSG ("The method lbegin( level ) is superseded by levelGridView( level ).begin.") lbegin(int level) const
 Iterator to first entity of given codim on level.
 
Traits::template Codim< codim >::template Partition< pitype >::LevelIterator DUNE_DEPRECATED_MSG ("The method lend( level ) is superseded by levelGridView( level ).end.") lend(int level) const
 one past the end on this level
 
Traits::template Codim< codim >::LeafIterator DUNE_DEPRECATED_MSG ("The method leafbegin() is superseded by leafGridView().begin.") leafbegin() const
 Iterator to first entity of given codim on leaf grid for PartitionType All_Partition.
 
Traits::template Codim< codim >::LeafIterator DUNE_DEPRECATED_MSG ("The method leafend() is superseded by leafGridView().end.") leafend() const
 one past the end on the leaf grid for PartitionType All_Partition
 
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator DUNE_DEPRECATED_MSG ("The method leafbegin() is superseded by leafGridView().begin.") leafbegin() const
 Iterator to first entity of given codim on leaf grid.
 
Traits::template Codim< codim >::template Partition< pitype >::LeafIterator DUNE_DEPRECATED_MSG ("The method leafend() is superseded by leafGridView().end.") leafend() const
 one past the end on the leaf level grid
 
Traits::template Partition< pitype >::LevelGridView levelGridView (int level) const
 View for a grid level.
 
Traits::template Partition< All_Partition >::LevelGridView levelGridView (int level) const
 View for a grid level for All_Partition.
 
Traits::template Partition< pitype >::LeafGridView leafGridView () const
 View for the leaf grid.
 
Traits::template Partition< All_Partition >::LeafGridView leafGridView () const
 View for the leaf grid for All_Partition.
 
bool mark (int refCount, const typename Traits ::template Codim< 0 >::Entity &e)
 Marks an entity to be refined/coarsened in a subsequent adapt. More...
 
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. More...
 
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
 
Iterators
Codim< cd >::template Partition< pitype >::LevelIterator DUNE_DEPRECATED_MSG ("The method lbegin( level ) is superseded by levelGridView( level ).begin and will be removed after Dune 2.4.") lbegin(int level) const
 Iterator to first entity of given codim on level.
 
Codim< cd >::template Partition< pitype >::LevelIterator DUNE_DEPRECATED_MSG ("The method lend( level ) is superseded by levelGridView( level ).end and will be removed after Dune 2.4.") lend(int level) const
 one past the end on this level
 
Codim< cd >::template Partition< pitype >::LeafIterator DUNE_DEPRECATED_MSG ("The method leafbegin() is superseded by leafGridView().begin and will be removed after Dune 2.4.") leafbegin() const
 Iterator to first entity of given codim on leaf grid.
 
Codim< cd >::template Partition< pitype >::LeafIterator DUNE_DEPRECATED_MSG ("The method leafend() is superseded by leafGridView().end and will be removed after Dune 2.4.") leafend() const
 one past the end on the leaf level grid
 
Parallel data distribution and communication
 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.") typename Codim< EntitySeed
 obtain EntityPointer from EntitySeed. More...
 
const GridImp & asImp () const
 Barton-Nackman trick.
 
Adaptivity and grid refinement
bool mark (int refCount, const typename Codim< 0 >::Entity &e)
 Marks an entity to be refined/coarsened in a subsequent adapt. More...
 
int getMark (const typename Codim< 0 >::Entity &e) const
 returns adaptation mark for given entity More...
 

Static Protected Member Functions

static std::conditional< std::is_reference< InterfaceType >::value, typenamestd::add_lvalue_reference< typenameReturnImplementationType< typenamestd::remove_reference< InterfaceType >::type >::ImplementationType >::type, typenamestd::remove_const< typenameReturnImplementationType< typenamestd::remove_reference< InterfaceType >::type >::ImplementationType >::type >::type getRealImplementation (InterfaceType &&i)
 return real implementation of interface class
 

dummy parallel functions

template<class DataHandle >
void communicate (DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
 
template<class DataHandle >
void communicate (DataHandle &data, InterfaceType iftype, CommunicationDirection dir) const
 
const CollectiveCommunication< SGrid > & comm () const
 
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
 

Detailed Description

template<int dim, int dimworld, typename _ctype = sgrid_ctype>
class Dune::SGrid< dim, dimworld, _ctype >

[ 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.

 The following class diagram shows how the classes are related with
 each other:

 \image html sgridclasses.png "Class diagram for classes in the grid interface"
 \image latex sgridclasses.eps "Class diagram for classes in the grid interface" width=\textwidth

 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.

Constructor & Destructor Documentation

◆ SGrid() [1/3]

template<int dim, int dimworld, typename _ctype = sgrid_ctype>
Dune::SGrid< dim, dimworld, _ctype >::SGrid ( const int *const  N_,
const ctype *const  H_ 
)

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

Note: The origin of the cube is always at (0,0,...,0), only the extend is given.

◆ SGrid() [2/3]

template<int dim, int dimworld, typename _ctype = sgrid_ctype>
Dune::SGrid< dim, dimworld, _ctype >::SGrid ( const int *const  N_,
const ctype *const  L_,
const ctype *const  H_ 
)

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

◆ SGrid() [3/3]

template<int dim, int dimworld, typename _ctype = sgrid_ctype>
Dune::SGrid< dim, dimworld, _ctype >::SGrid ( FieldVector< int, dim >  N_,
FieldVector< ctype, dim >  L_,
FieldVector< ctype, dim >  H_ 
)

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

Note: This constructor uses FieldVectors instead of built-in arrays. This is compatible with the YaspGrid class.

Member Function Documentation

◆ communicate() [1/3]

void Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::communicate ( CommDataHandleIF< DataHandleImp, DataTypeImp > &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
) const
inlineinherited

dummy communicate, doing nothing

◆ communicate() [2/3]

void Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::communicate ( CommDataHandleIF< DataHandleImp, DataTypeImp > &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const
inlineinherited

dummy communicate, doing nothing

◆ communicate() [3/3]

template<int dim, int dimworld, typename _ctype = sgrid_ctype>
template<class T , template< class > class P, int codim>
void Dune::SGrid< dim, dimworld, _ctype >::communicate ( T &  t,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
)
inline

The communication interface

Template Parameters
Tarray class holding data associated with the entities
Ptype used to gather/scatter data in and out of the message buffer
codimcommunicate entites of given codim
Parameters
tarray holding data associated with the entities
iftypeone of the predefined interface types, throws error if it is not implemented
dirchoose beetween forward and backward communication
levelcommunicate for entities on the given level

Implements a generic communication function sending an object of type P for each entity in the intersection of two processors. P has two methods gather and scatter that implement the protocol. Therefore P is called the "protocol class".

◆ DUNE_DEPRECATED_MSG()

Dune::Grid< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::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."  )
inlineinherited

obtain EntityPointer from EntitySeed.

Deprecated:
This method is deprecated and will be removed after the release of dune-grid 2.4. Please use entity() instead, which will directly return an Entity object that you can then store for later use. The EntityPointer concept in general is deprecated and will not be available after dune-grid 2.4 has been released.

obtain Entity from EntitySeed.

◆ getMark() [1/2]

int Dune::Grid< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::getMark ( const typename Codim< 0 >::Entity &  e) const
inlineinherited

returns adaptation mark for given entity

Parameters
[in]eEntity for which adaptation mark should be determined
Returns
int adaptation mark currently set for given Entity e

◆ getMark() [2/2]

int Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::getMark ( const typename Traits::template Codim< 0 >::Entity &  e) const
inlineinherited

returns adaptation mark for given entity, i.e. here the default implementation returns 0.

Parameters
[in]eEntity for which adaptation mark should be determined
Returns
int adaptation mark, here the default value 0 is returned

◆ mark() [1/2]

bool Dune::Grid< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::mark ( int  refCount,
const typename Codim< 0 >::Entity &  e 
)
inlineinherited

Marks an entity to be refined/coarsened in a subsequent adapt.

Parameters
[in]refCountNumber of subdivisions that should be applied. Negative value means coarsening.
[in]eEntity that should be marked
Returns
true if Entity was marked, false otherwise.

◆ mark() [2/2]

bool Dune::GridDefaultImplementation< dim, dimworld, sgrid_ctype , SGridFamily< dim, dimworld, sgrid_ctype > >::mark ( int  refCount,
const typename Traits ::template Codim< 0 >::Entity &  e 
)
inlineinherited

Marks an entity to be refined/coarsened in a subsequent adapt.

Parameters
[in]refCountNumber of subdivisions that should be applied. Negative value means coarsening.
[in]eEntity 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
    bool mark( int refCount,
    typename Traits::template Codim<0>::Entity & e ).
    bool mark(int refCount, const typename Traits ::template Codim< 0 >::Entity &e)
    Marks an entity to be refined/coarsened in a subsequent adapt.
    Definition: grid.hh:1163
    Static tag representing a codimension.
    Definition: dimension.hh:22
    This template method will vanish due to the inheritance rules.

◆ maxLevel()

template<int dim, int dimworld, typename _ctype = sgrid_ctype>
int Dune::SGrid< dim, dimworld, _ctype >::maxLevel ( ) const

Return maximum level defined in this grid. Levels are numbered 0 ... maxLevel with 0 the coarsest level.

Referenced by Dune::SGrid< dim, dimworld, _ctype >::size().


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 20, 23:31, 2024)