Dune::YaspGrid< dim, dimworld > Class Template Reference
[Grid Implementations]

#include <yaspgrid.hh>

Inheritance diagram for Dune::YaspGrid< dim, dimworld >:

Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily > Dune::MultiYGrid< d, ct > Dune::Grid< dim, dimworld, ct, GridFamily >

List of all members.


Detailed Description

template<int dim, int dimworld>
class Dune::YaspGrid< dim, dimworld >

[ 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 codim 0 and dim, with arbitrary overlap (including zero), periodic boundaries and fast implementation allowing on-the-fly computations.

History:
  • started on July 31, 2004 by PB based on abstractions developed in summer 2003

Public Types

enum  
 maximum number of levels allowed
typedef yaspgrid_ctype ctype
 define type used for coordinates in grid module
typedef YaspGridFamily< dim,
dimworld > 
GridFamily
 the GridFamily of this grid
typedef YaspGridFamily< dim,
dimworld >::Traits 
Traits
 the Traits
typedef MultiYGrid< dim, ctypeYMG
 shorthand for base class data types
typedef FieldVector< int, d > iTupel
 define types used for arguments
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
 YaspGrid (MPI_Comm comm, Dune::FieldVector< ctype, dim > L, Dune::FieldVector< int, dim > s, Dune::FieldVector< bool, dim > periodic, int overlap)
int maxLevel () const
void globalRefine (int refCount)
 refine the grid refCount times. What about overlap?
void refine (bool b)
 refine the grid refCount times. What about overlap?
bool adapt ()
 map adapt to global refine
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
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 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
< MPI_Comm > & 
comm () const
 return a collective communication object
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
template<class DataHandleImp, class DataTypeImp>
void communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
template<class DataHandleImp, class DataTypeImp>
void communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir) const
bool loadBalance ()
 default implementation of load balance does nothing and returns false
template<class DataHandle>
bool loadBalance (DataHandle &data)
 default implementation of load balance does nothing and returns false
const Torus< d > & torus () const
 return reference to torus
int maxlevel () const
 return the maximum level index (number of levels is maxlevel()+1)
bool periodic (int i) const
 return true if grid is periodic in given direction
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
YGridLevelIterator rbegin () const
 return iterator pointing to the finest level
YGridLevelIterator rend () const
 return iterator pointing to one before the coarsest level
void print (std::ostream &s) const
 print function for multigrids
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

template<class InterfaceType>
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

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.

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

template<int dim, int dimworld>
Dune::YaspGrid< dim, dimworld >::YaspGrid ( MPI_Comm  comm,
Dune::FieldVector< ctype, dim >  L,
Dune::FieldVector< int, dim >  s,
Dune::FieldVector< bool, dim >  periodic,
int  overlap 
) [inline]

Constructor for a YaspGrid, they are all forwarded to the base class

Parameters:
comm MPI communicator where this mesh is distributed to
L extension of the domain
s number of cells on coarse mesh in each direction
periodic tells if direction is periodic or not
size of overlap on coarsest grid (same in all directions)


Member Function Documentation

template<int dim, int dimworld>
int Dune::YaspGrid< 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 >.

Referenced by ALUGridSpace::GatherScatterLoadBalance< GridType, DataCollectorType, IndexOperatorType >::inlineData().

template<int dim, int dimworld>
template<class DataHandleImp, class DataType>
void Dune::YaspGrid< dim, dimworld >::communicate ( CommDataHandleIF< DataHandleImp, DataType > &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const [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 predefined interface types, throws error if it is not implemented
level,: communicate 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".

The new communication interface

communicate objects for all codims on a given level

template<int dim, int dimworld>
template<class DataHandleImp, class DataType>
void Dune::YaspGrid< dim, dimworld >::communicate ( CommDataHandleIF< DataHandleImp, DataType > &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
) const [inline]

The new communication interface

communicate objects for all codims on the leaf grid

template<int dim, int dimworld>
template<class DataHandle, int codim>
void Dune::YaspGrid< dim, dimworld >::communicateCodim ( DataHandle &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const [inline]

The new communication interface

communicate objects for one codim

template<int dim, int dimworld, class ct, class GridFamily>
bool Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily >::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
               bool mark( int refCount,
                          typename Traits::template Codim<0>::EntityPointer & e ).
    
    This template method will vanish due to the inheritance rules.

Reimplemented in Dune::ALU2dGrid< dim, dimworld >, Dune::ALU3dGrid< dim, dimworld, elType >, Dune::UGGrid< dim >, Dune::ALU2dGrid< 2, 2 >, Dune::ALU3dGrid< 3, 3, Dune::hexa >, and Dune::ALU3dGrid< 3, 3, Dune::tetra >.

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

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

Reimplemented in Dune::AlbertaGrid< dim, dimworld >, Dune::ALU2dGrid< dim, dimworld >, Dune::ALU3dGrid< dim, dimworld, elType >, Dune::UGGrid< dim >, Dune::ALU2dGrid< 2, 2 >, Dune::ALU3dGrid< 3, 3, Dune::hexa >, and Dune::ALU3dGrid< 3, 3, Dune::tetra >.

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

template<int dim, int dimworld, class ct, class GridFamily>
template<class DataHandleImp, class DataTypeImp>
void Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily >::communicate ( CommDataHandleIF< DataHandleImp, DataTypeImp > &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const [inline, inherited]

template<int dim, int dimworld, class ct, class GridFamily>
template<class DataHandleImp, class DataTypeImp>
void Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily >::communicate ( CommDataHandleIF< DataHandleImp, DataTypeImp > &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
) const [inline, inherited]


The documentation for this class was generated from the following file:

Generated on 6 Nov 2008 with Doxygen (ver 1.5.6) [logfile].