Dune::ALU3dGrid< dim, dimworld, elType > Class Template Reference

#include <grid.hh>

Inheritance diagram for Dune::ALU3dGrid< dim, dimworld, elType >:

Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily > Dune::Grid< dim, dimworld, ct, GridFamily > List of all members.

Detailed Description

template<int dim, int dimworld, ALU3dGridElementType elType>
class Dune::ALU3dGrid< dim, dimworld, elType >

[ provides Dune::Grid ] 3D grid with support for hexahedrons and tetrahedrons. The ALU3dGrid implements the Dune GridInterface for 3d tetrahedral and hexahedral meshes. This grid can be locally adapted and used in parallel computations using dynamcic load balancing.

Note:
Adaptive parallel grid supporting dynamic load balancing, written mainly by Bernard Schupp. This grid supports hexahedrons and tetrahedrons.
(see ALUGrid homepage: http://www.mathematik.uni-freiburg.de/IAM/Research/alugrid/)

Two tools are available for partitioning :

Author:
Robert Kloefkorn


Public Types

typedef ALU3dGridFamily< dim,
dimworld, elType >::Traits 
Traits
 my Traits class
typedef ALU3dGridHierarchicIndexSet<
dim, dimworld, elType > 
HierarchicIndexSet
 Type of the hierarchic index set.
typedef GridFamily::LevelIndexSetImp LevelIndexSetImp
 Type of the level index set, needed by data handle.
typedef GridFamily::LeafIndexSetImp LeafIndexSetImp
 Type of the leaf index set, needed by data handle.
typedef SelectType< elType==tetra, ReferenceSimplex<
alu3d_ctype, dim >, ReferenceCube<
alu3d_ctype, dim > >::Type 
ReferenceElementType
 reference element type
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 ct ctype
 Define type used for coordinates in grid module.

Public Member Functions

 ~ALU3dGrid ()
 Desctructor.
std::string name () const
 for grid identification
int maxLevel () const
 Return maximum level defined in this grid. Levels are numbered maxLevel with 0 the coarsest level.
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 codim, PartitionIteratorType pitype>
Traits::template Codim< codim
>::template Partition< pitype
>::LeafIterator 
leafbegin () const
 General definiton for a leaf iterator.
template<int codim, PartitionIteratorType pitype>
Traits::template Codim< codim
>::template Partition< pitype
>::LeafIterator 
leafend () const
 General definition for an end iterator on leaf level.
template<int codim>
Traits::template Codim< codim
>::LeafIterator 
leafbegin () const
 General definiton for a leaf iterator.
template<int codim>
Traits::template Codim< codim
>::LeafIterator 
leafend () const
 General definition for an end iterator on leaf level.
int size (int level, int cd) 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 geometry type in this process
int global_size (int cd) const
 number of grid entities on all levels for given codim
const GlobalIdSetglobalIdSet () const
 get global id set of grid
const LocalIdSetlocalIdSet () const
 get global id set of grid
const Traits::LeafIndexSetleafIndexSet () const
 get leaf index set of the grid
const Traits::LevelIndexSetlevelIndexSet (int level) const
 get level index set of the grid
bool loadBalance ()
 Calculates load of each process and repartition the grid if neccessary. For parameters of the load balancing process see the README file of the ALUGrid package.
template<class DataHandle>
bool loadBalance (DataHandle &data)
 Calculates load of each process and repartition the grid if neccessary. For parameters of the load balancing process see the README file of the ALUGrid package.
int ghostSize (int level, int codim) const
 ghostSize is one for codim 0 and zero otherwise for this grid
int overlapSize (int level, int codim) const
 overlapSize is zero for this grid
int ghostSize (int codim) const
 ghostSize is one for codim 0 and zero otherwise for this grid
int overlapSize (int codim) const
 overlapSize is zero for this grid
template<class DataHandleImp, class DataTypeImp>
void communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir, int level) const
 Communicate information on distributed entities on a given level Template parameter is a model of Dune::CommDataHandleIF.
template<class DataHandleImp, class DataTypeImp>
void communicate (CommDataHandleIF< DataHandleImp, DataTypeImp > &data, InterfaceType iftype, CommunicationDirection dir) const
 Communicate information on distributed entities on the leaf grid. Template parameter is a model of Dune::CommDataHandleIF.
const CollectiveCommunicationType & comm () const
 return const reference to a collective communication object. The return type is a model of Dune::CollectiveCommunication.
bool preAdapt ()
 returns if a least one entity was marked for coarsening
void postAdapt ()
 clear all entity new markers
bool adapt ()
 Refine all positive marked leaf entities, coarsen all negative marked entities if possible.

Returns:
true if a least one entity was refined
The complete adaptation process works as follows:


template<class DofManagerType, class RestrictProlongOperatorType>
bool adapt (DofManagerType &dm, RestrictProlongOperatorType &rp, bool verbose=false)
 Refine all positive marked leaf entities, coarsen all negative marked entities if possible.

Returns:
true if a least one entity was refined
The complete adaptation process works as follows:


bool globalRefine (int refCount)
 uses the interface, mark on entity and refineLocal
template<GrapeIOFileFormatType ftype>
bool writeGrid (const std::string filename, alu3d_ctype time) const
 write Grid to file in specified FileFormatType
template<GrapeIOFileFormatType ftype>
bool readGrid (const std::string filename, alu3d_ctype &time)
 read Grid from file filename and store time of mesh in time
bool mark (int refCount, const typename Traits::template Codim< 0 >::EntityPointer &ep)
 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 getMark (const typename Traits::template Codim< 0 >::EntityPointer &) const
 returns adaptation mark for given entity

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

const std::vector< GeometryType > & geomTypes (int codim) const
 deliver all geometry types used in this grid
const ReferenceElementTypereferenceElement () const
 return reference to Dune reference element according to elType
template<class T>
bool mark (int refCount, T &e)
 Marks an entity to be refined/coarsened in a subsequent adapt.
template<class T>
int getMark (T &) const
 returns adaptation mark for given entity, i.e. here the default implementation returns 0.
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

Protected Types

enum  { MAXL = 64 }
 max number of levels More...
enum  { newElementsChunk_ = 128 }
 element chunk for refinement More...
enum  { refineEstimate_ = 8 }
 upper estimate on number of elements that could be created when a new element is created More...
typedef ALU3dGridFamily< dim,
dimworld, elType >::LocalIdSetImp 
LocalIdSetImp
 Type of the local id set.
typedef ALU3dGridFamily< dim,
dimworld, elType >::GlobalIdSetImp 
GlobalIdSetImp
 Type of the global id set.
typedef Traits::GlobalIdSet GlobalIdSet
 Type of the global id set.
typedef Traits::LocalIdSet LocalIdSet
 Type of the local id set.
typedef ALU3dGridLeafIterator<
0, All_Partition, MyType
LeafIteratorImp
 a standard leaf iterator

Protected Member Functions

 ALU3dGrid (const std::string macroTriangFilename, int myrank=-1)
 ALU3dGrid (const MyType &g)
 Copy constructor should not be used.
ALU3dGrid< dim, dimworld,
elType > & 
operator= (const MyType &g)
 assignment operator should not be used
void calcExtras ()
 reset size and global size, update Level- and LeafIndexSet, if they exist
void calcMaxLevel ()
 calculate maxlevel
void recalcGlobalSize ()
 make grid walkthrough and calc global size
void checkMacroGridFile (const std::string filename)
 check whether macro grid format is of our type
void checkMacroGrid ()
 check whether macro grid has the right element type
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, ALU3dGridElementType elType>
anonymous enum [protected]

max number of levels

Enumerator:
MAXL  maximal number of levels is 64

template<int dim, int dimworld, ALU3dGridElementType elType>
anonymous enum [protected]

element chunk for refinement

Enumerator:
newElementsChunk_  normal default number of new elements for new adapt method

template<int dim, int dimworld, ALU3dGridElementType elType>
anonymous enum [protected]

upper estimate on number of elements that could be created when a new element is created

Enumerator:
refineEstimate_  if one element is refined then it causes apporximately not more than this number of new elements

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, ALU3dGridElementType elType>
Dune::ALU3dGrid< dim, dimworld, elType >::ALU3dGrid ( const std::string  macroTriangFilename,
int  myrank = -1 
) [inline, protected]

Constructor which reads an ALU3dGrid Macro Triang file or given GridFile


Member Function Documentation

template<int dim, int dimworld, ALU3dGridElementType elType>
template<class DataHandle>
bool Dune::ALU3dGrid< dim, dimworld, elType >::loadBalance ( DataHandle &  data  )  [inline]

Calculates load of each process and repartition the grid if neccessary. For parameters of the load balancing process see the README file of the ALUGrid package.

Parameters:
data the data handler class that must implement three methods:
          // calls data inline on macro element. From there the data of
          // all children can be written to the message buffer. 
          // MessageBufferImp implements the MessageBufferIF interface. 
          template<class MessageBufferImp>
          void inlineData ( MessageBufferImp& buff, Dune::Entity<0> & e);
          
          // calls data xtract on macro element. From there the data of
          // all children can be restored from the message buffer. 
          // numChildren is the number of all children underneath the
          // macro element e. 
          // MessageBufferImp implements the MessageBufferIF interface. 
          template<class MessageBufferImp>
          void xtractData ( MessageBufferImp& buff, Dune::Entity<0> & e, size_t numChildren );

          // This method is called at the end of the load balancing process
          // before adaptation markers are removed. Here the user can apply
          // a data compression or other features. This method can be
          // empty if nothing should be done.
          void compress ();

Reimplemented from Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily >.

template<int dim, int dimworld, ALU3dGridElementType elType>
template<class DofManagerType, class RestrictProlongOperatorType>
bool Dune::ALU3dGrid< dim, dimworld, elType >::adapt ( DofManagerType &  dm,
RestrictProlongOperatorType &  rp,
bool  verbose = false 
) [inline]

Refine all positive marked leaf entities, coarsen all negative marked entities if possible.

Returns:
true if a least one entity was refined
The complete adaptation process works as follows:

Parameters:
dm DofManager for dune-fem package for using callback during adaptation
rp handler for restriction and prolongation operations which is a Model of the dune-fem RestrictProlongInterface class.

template<int dim, int dimworld, class ct, class GridFamily>
template<class T>
bool Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily >::mark ( int  refCount,
T &  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 from Dune::Grid< dim, dimworld, ct, GridFamily >.

template<int dim, int dimworld, class ct, class GridFamily>
template<class T>
int Dune::GridDefaultImplementation< dim, dimworld, ct, GridFamily >::getMark ( T &   )  const [inline, inherited]

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

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

Reimplemented from Dune::Grid< dim, dimworld, ct, GridFamily >.

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]

dummy communicate, doing nothing

Reimplemented from Dune::Grid< dim, dimworld, ct, GridFamily >.

Reimplemented in Dune::ALU3dGrid< 3, 3, Dune::hexa >, and Dune::ALU3dGrid< 3, 3, Dune::tetra >.

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]

dummy communicate, doing nothing

Reimplemented from Dune::Grid< dim, dimworld, ct, GridFamily >.

Reimplemented in Dune::ALU3dGrid< 3, 3, Dune::hexa >, and Dune::ALU3dGrid< 3, 3, Dune::tetra >.


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

Generated on 12 Dec 2007 with Doxygen (ver 1.5.1)