Dune Core Modules (unstable)

Dune::YaspGrid< dim, Coordinates > Class Template Reference

[ provides Dune::Grid ] More...

#include <dune/grid/yaspgrid.hh>

Public Types

typedef Coordinates::ctype ctype
 Type used for coordinates.
 
typedef ReservedVector< YGridLevel, 32 >::const_iterator YGridLevelIterator
 Iterator over the grid levels.
 
typedef YaspGridFamily< dim, Coordinates > GridFamily
 the GridFamily of this grid
 
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...
 
Exported types
typedef GridFamily::Traits::LeafGridView LeafGridView
 type of view for leaf grid
 
typedef GridFamily::Traits::LevelGridView LevelGridView
 type of view for level grid
 
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

const Torus< CollectiveCommunicationType, dim > & torus () const
 return reference to torus
 
int globalSize (int i) const
 return number of cells on finest level in given direction on all processors
 
iTupel globalSize () const
 return number of cells on finest level on all processors
 
int levelSize (int l, int i) const
 return size of the grid (in cells) on level l in direction i
 
iTupel levelSize (int l) const
 return size vector of the grid (in cells) on level l
 
bool isPeriodic (int i) const
 return whether the grid is periodic in direction i
 
YGridLevelIterator begin () const
 return iterator pointing to coarsest level
 
YGridLevelIterator begin (int i) const
 return iterator pointing to given level
 
YGridLevelIterator end () const
 return iterator pointing to one past the finest level
 
 YaspGrid (const Coordinates &coordinates, std::bitset< dim > periodic=std::bitset< dim >(0ULL), int overlap=1, CollectiveCommunicationType comm=CollectiveCommunicationType(), const YLoadBalance< dim > *lb=defaultLoadbalancer())
 
 YaspGrid (Dune::FieldVector< ctype, dim > L, std::array< int, dim > s, std::bitset< dim > periodic=std::bitset< dim >(0ULL), int overlap=1, CollectiveCommunicationType comm=CollectiveCommunicationType(), const YLoadBalance< dim > *lb=defaultLoadbalancer())
 
 YaspGrid (Dune::FieldVector< ctype, dim > lowerleft, Dune::FieldVector< ctype, dim > upperright, std::array< int, dim > s, std::bitset< dim > periodic=std::bitset< dim >(0ULL), int overlap=1, CollectiveCommunicationType comm=CollectiveCommunicationType(), const YLoadBalance< dim > *lb=defaultLoadbalancer())
 
 YaspGrid (std::array< std::vector< ctype >, dim > coords, std::bitset< dim > periodic=std::bitset< dim >(0ULL), int overlap=1, CollectiveCommunicationType comm=CollectiveCommunicationType(), const YLoadBalance< dim > *lb=defaultLoadbalancer())
 Standard constructor for a tensorproduct YaspGrid. More...
 
int maxLevel () const
 
void globalRefine (int refCount)
 refine the grid refCount times.
 
void refineOptions (bool keepPhysicalOverlap)
 set options for refinement More...
 
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 More...
 
bool adapt ()
 map adapt to global refine
 
bool preAdapt ()
 returns true, if the grid will be coarsened
 
void postAdapt ()
 clean up some markers
 
template<int cd, PartitionIteratorType pitype>
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lbegin (int level) const
 one past the end on this level
 
template<int cd, PartitionIteratorType pitype>
Traits::template Codim< cd >::template Partition< pitype >::LevelIterator lend (int level) const
 Iterator to one past the last entity of given codim on level for partition type.
 
template<int cd>
Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator lbegin (int level) const
 version without second template parameter for convenience
 
template<int cd>
Traits::template Codim< cd >::template Partition< All_Partition >::LevelIterator lend (int level) const
 version without second template parameter for convenience
 
template<int cd, PartitionIteratorType pitype>
Traits::template Codim< cd >::template Partition< pitype >::LeafIterator leafbegin () const
 return LeafIterator which points to the first entity in maxLevel
 
template<int cd, PartitionIteratorType pitype>
Traits::template Codim< cd >::template Partition< pitype >::LeafIterator leafend () const
 return LeafIterator which points behind the last entity in maxLevel
 
template<int cd>
Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator leafbegin () const
 return LeafIterator which points to the first entity in maxLevel
 
template<int cd>
Traits::template Codim< cd >::template Partition< All_Partition >::LeafIterator leafend () const
 return LeafIterator which points behind the last entity in maxLevel
 
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
 
int size (int level, int codim) const
 number of entities per level and codim in this process
 
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 geometry type in this process
 
size_t numBoundarySegments () const
 returns the number of boundary segments within the macro grid
 
const Dune::FieldVector< ctype, dim > & domainSize () const
 returns the size of the physical domain
 
template<class DataHandleImp , class DataType >
void communicate (CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
 
template<class DataHandleImp , class DataType >
void communicate (CommDataHandleIF< DataHandleImp, DataType > &data, InterfaceType iftype, CommunicationDirection dir) const
 
template<class DataHandle , int codim>
void communicateCodim (DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
 
const CollectiveCommunicationTypecomm () const
 return a collective communication object
 
Traits::LevelGridView levelGridView (int level) const
 View for a grid level for All_Partition.
 
Traits::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...
 
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
 
template<class EntitySeed >
Codim< EntitySeed ::codimension >::Entity entity (const EntitySeed &seed) const
 obtain Entity from EntitySeed.
 
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...
 

Protected Member Functions

void makelevel (const Coordinates &coords, std::bitset< dim > periodic, iTupel o_interior, int overlap)
 Make a new YGridLevel structure. More...
 
void intersections (const YGridComponent< Coordinates > &sendgrid, const YGridComponent< Coordinates > &recvgrid, std::deque< Intersection > &sendlist, std::deque< Intersection > &recvlist)
 Construct list of intersections with neighboring processors. More...
 
GridImp & asImp ()
 Barton-Nackman trick.
 
const GridImp & asImp () const
 Barton-Nackman trick.
 

Detailed Description

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
class Dune::YaspGrid< dim, Coordinates >

[ provides Dune::Grid ]

Provides a distributed structured cube mesh.

YaspGrid stands for yet another structured parallel grid. It implements the dune grid interface for structured grids with arbitrary overlap (including zero), periodic boundaries, and a fast implementation allowing on-the-fly computations.

YaspGrid supports three coordinate modes: EquidistantCoordinates, EquidistantOffsetCoordinates, and Dune::TensorProductCoordinates.

Template Parameters
dimThe dimension of the grid and its surrounding world
CoordinatesThe coordinate mode of the grid.
Examples
recipe-integration.cc, and recipe-iterate-over-grid.cc.

Member Enumeration Documentation

◆ anonymous enum

template<int dim, int dimworld, class ct, class GridFamily>
anonymous enum
inherited

A constant that exports the template parameter dim.

Enumerator
dimension 

The dimension of the grid.

◆ anonymous enum

template<int dim, int dimworld, class ct, class GridFamily>
anonymous enum
inherited

A constant that exports the template parameter dimworld.

Enumerator
dimensionworld 

The dimension of the world the grid lives in.

Constructor & Destructor Documentation

◆ YaspGrid() [1/4]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
Dune::YaspGrid< dim, Coordinates >::YaspGrid ( const Coordinates &  coordinates,
std::bitset< dim >  periodic = std::bitset<dim>(0ULL),
int  overlap = 1,
CollectiveCommunicationType  comm = CollectiveCommunicationType(),
const YLoadBalance< dim > *  lb = defaultLoadbalancer() 
)
inline

Standard constructor for a YaspGrid with a given Coordinates object

Parameters
coordinatesObject that stores or computes the vertex coordinates
periodictells if direction is periodic or not
overlapsize of overlap on coarsest grid (same in all directions)
commthe collective communication object for this grid. An MPI communicator can be given here.
lbpointer to an overloaded YLoadBalance instance

◆ YaspGrid() [2/4]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
Dune::YaspGrid< dim, Coordinates >::YaspGrid ( Dune::FieldVector< ctype, dim >  L,
std::array< int, dim >  s,
std::bitset< dim >  periodic = std::bitset<dim>(0ULL),
int  overlap = 1,
CollectiveCommunicationType  comm = CollectiveCommunicationType(),
const YLoadBalance< dim > *  lb = defaultLoadbalancer() 
)
inline

Standard constructor for an equidistant YaspGrid

Parameters
Lextension of the domain
snumber of cells on coarse mesh in each direction
periodictells if direction is periodic or not
overlapsize of overlap on coarsest grid (same in all directions)
commthe collective communication object for this grid. An MPI communicator can be given here.
lbpointer to an overloaded YLoadBalance instance

◆ YaspGrid() [3/4]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
Dune::YaspGrid< dim, Coordinates >::YaspGrid ( Dune::FieldVector< ctype, dim >  lowerleft,
Dune::FieldVector< ctype, dim >  upperright,
std::array< int, dim >  s,
std::bitset< dim >  periodic = std::bitset<dim>(0ULL),
int  overlap = 1,
CollectiveCommunicationType  comm = CollectiveCommunicationType(),
const YLoadBalance< dim > *  lb = defaultLoadbalancer() 
)
inline

Constructor for an equidistant YaspGrid with non-trivial origin

Parameters
lowerleftLower left corner of the domain
upperrightUpper right corner of the domain
snumber of cells on coarse mesh in each direction
periodictells if direction is periodic or not
overlapsize of overlap on coarsest grid (same in all directions)
commthe collective communication object for this grid. An MPI communicator can be given here.
lbpointer to an overloaded YLoadBalance instance

◆ YaspGrid() [4/4]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
Dune::YaspGrid< dim, Coordinates >::YaspGrid ( std::array< std::vector< ctype >, dim >  coords,
std::bitset< dim >  periodic = std::bitset<dim>(0ULL),
int  overlap = 1,
CollectiveCommunicationType  comm = CollectiveCommunicationType(),
const YLoadBalance< dim > *  lb = defaultLoadbalancer() 
)
inline

Standard constructor for a tensorproduct YaspGrid.

Parameters
coordscoordinate vectors to be used for coarse grid
periodictells if direction is periodic or not
overlapsize of overlap on coarsest grid (same in all directions)
commthe collective communication object for this grid. An MPI communicator can be given here.
lbpointer to an overloaded YLoadBalance instance

Member Function Documentation

◆ communicate() [1/2]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
template<class DataHandleImp , class DataType >
void Dune::YaspGrid< dim, Coordinates >::communicate ( CommDataHandleIF< DataHandleImp, DataType > &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const
inline

The new communication interface

communicate objects for all codims on a given level

◆ communicate() [2/2]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
template<class DataHandleImp , class DataType >
void Dune::YaspGrid< dim, Coordinates >::communicate ( CommDataHandleIF< DataHandleImp, DataType > &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
) const
inline

The new communication interface

communicate objects for all codims on the leaf grid

◆ communicateCodim()

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
template<class DataHandle , int codim>
void Dune::YaspGrid< dim, Coordinates >::communicateCodim ( DataHandle &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const
inline

The new communication interface

communicate objects for one codim

◆ getMark() [1/2]

template<int dim, int dimworld, class ct, class GridFamily>
int Dune::Grid< dim, dimworld, ct, GridFamily >::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

References Dune::Grid< dim, dimworld, ct, GridFamily >::asImp().

◆ getMark() [2/2]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
int Dune::YaspGrid< dim, Coordinates >::getMark ( const typename Traits::template Codim< 0 >::Entity e) const
inline

returns adaptation mark for given entity

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

◆ intersections()

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
void Dune::YaspGrid< dim, Coordinates >::intersections ( const YGridComponent< Coordinates > &  sendgrid,
const YGridComponent< Coordinates > &  recvgrid,
std::deque< Intersection > &  sendlist,
std::deque< Intersection > &  recvlist 
)
inlineprotected

Construct list of intersections with neighboring processors.

Parameters
recvgridthe grid stored in this processor
sendgridthe subgrid to be sent to neighboring processors
sendlistthe deque to fill with send intersections
recvlistthe deque to fill with recv intersections
Returns
two lists: Intersections to be sent and Intersections to be received

Referenced by Dune::YaspGrid< dim, CoordCont >::makelevel().

◆ makelevel()

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
void Dune::YaspGrid< dim, Coordinates >::makelevel ( const Coordinates &  coords,
std::bitset< dim >  periodic,
iTupel  o_interior,
int  overlap 
)
inlineprotected

Make a new YGridLevel structure.

Parameters
coordsthe coordinate container
periodicindicate periodicity for each direction
o_interiororigin of interior (non-overlapping) cell decomposition
overlapto be used on this grid level

Referenced by Dune::YaspGrid< dim, CoordCont >::globalRefine(), and Dune::YaspGrid< dim, CoordCont >::YaspGrid().

◆ mark() [1/3]

template<int dim, int dimworld, class ct, class GridFamily>
bool Dune::Grid< dim, dimworld, ct, GridFamily >::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.

References Dune::Grid< dim, dimworld, ct, GridFamily >::asImp().

◆ mark() [2/3]

bool Dune::GridDefaultImplementation< dim, dimworld, Coordinates::ctype , YaspGridFamily< dim, Coordinates > >::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 ).
    This template method will vanish due to the inheritance rules.

◆ mark() [3/3]

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
bool Dune::YaspGrid< dim, Coordinates >::mark ( int  refCount,
const typename Traits::template Codim< 0 >::Entity e 
)
inline

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
  • On yaspgrid marking one element will mark all other elements of the level as well
  • If refCount is lower than refCount of a previous mark-call, nothing is changed

◆ maxLevel()

◆ refineOptions()

template<int dim, class Coordinates = EquidistantCoordinates<double, dim>>
void Dune::YaspGrid< dim, Coordinates >::refineOptions ( bool  keepPhysicalOverlap)
inline

set options for refinement

Parameters
keepPhysicalOverlap[true] keep the physical size of the overlap, [false] keep the number of cells in the overlap. Default is [true].

Referenced by Dune::BackupRestoreFacility< Dune::YaspGrid< dim, Coordinates > >::restore().


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  generated with Hugo v0.55.6 (Oct 19, 22:28, 2020)