Dune Core Modules (2.4.1)

[ provides Dune::Grid ] More...

#include <dune/grid/alugrid/3d/grid.hh>

Public Types

typedef ALU3dGridHierarchicIndexSet< elType, Comm > 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 ReferenceElement< alu3d_ctype, dimension > ReferenceElementType
 reference element type
 
typedef Traits::DuneBoundaryProjectionType DuneBoundaryProjectionType
 boundary projection type
 
typedef Traits::DuneBoundaryProjectionVector DuneBoundaryProjectionVector
 boundary projection type
 
typedef ALU3DSPACE ProjectVertex ALUGridVertexProjectionType
 type of ALUGrid Vertex Projection Interface
 
typedef Traits::CollectiveCommunication CollectiveCommunication
 type of collective communication object
 
typedef Traits::GlobalIdSet GlobalIdSet
 Type of the global id set.
 
typedef Traits::LocalIdSet LocalIdSet
 Type of the local id set.
 
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 alu3d_ctype ctype
 Define type used for coordinates in grid module.
 

Public Member Functions

virtual ~ALU3dGrid ()
 Desctructor.
 
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
 
size_t numBoundarySegments () const
 number of boundary segments
 
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. More...
 
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. More...
 
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 CollectiveCommunicationcomm () const
 return const reference to a collective communication object. The return type is a model of Dune::CollectiveCommunication. More...
 
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. More...
 
template<class GridImp , class DataHandle >
bool adapt (AdaptDataHandleInterface< GridImp, DataHandle > &handle)
 Refine all positive marked leaf entities, coarsen all negative marked entities if possible. More...
 
void 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
 
bool writeGrid_Ascii (const std::string filename, alu3d_ctype time, bool scientific=false) const
 write leaf grid in macro grid format to ascii file
 
bool writeMacroGrid (const std::string path, const std::string filename) const
 write macro grid in ALUGrid macro format to path/filename.rank
 
template<GrapeIOFileFormatType ftype>
bool readGrid (const std::string filename, alu3d_ctype &time)
 read Grid from file filename and store time of mesh in time
 
void backup (std::ostream &) const
 backup to ostream
 
void restore (std::istream &)
 restore from istream
 
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...
 
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
 
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...
 
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 Public Member Functions

static std::string name ()
 for grid identification
 

Protected Types

enum  { MAXL = 32 }
 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 GridFamily::LocalIdSetImp LocalIdSetImp
 Type of the local id set.
 

Protected Member Functions

 ALU3dGrid (const std::string &macroTriangFilename, const MPICommunicatorType mpiComm, const DuneBoundaryProjectionType *bndPrj, const DuneBoundaryProjectionVector *bndVec, const ALUGridRefinementType refinementType) DUNE_DEPRECATED_MSG("ALUGrid is deprecated
 
 ALU3dGrid (const ThisType &)
 Copy constructor should not be used.
 
const ThisTypeoperator= (const ThisType &)
 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
 
const DuneBoundaryProjectionTypeboundaryProjection (const int segmentIndex) const
 return boudanry projection for given segment Id
 

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
 

Detailed Description

template<ALU3dGridElementType elType, class Comm>
class Dune::ALU3dGrid< elType, Comm >

[ 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 dynamic 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 :

For installation instructions see http://www.dune-project.org/external_libraries/install_alugrid.html .

Author
Robert Kloefkorn

Member Enumeration Documentation

◆ anonymous enum

template<ALU3dGridElementType elType, class Comm >
anonymous enum
protected

max number of levels

Enumerator
MAXL 

maximal number of levels is 32

◆ anonymous enum

template<ALU3dGridElementType elType, class Comm >
anonymous enum
protected

element chunk for refinement

Enumerator
newElementsChunk_ 

normal default number of new elements for new adapt method

◆ anonymous enum

template<ALU3dGridElementType elType, class Comm >
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

Constructor & Destructor Documentation

◆ ALU3dGrid()

template<ALU3dGridElementType elType, class Comm >
Dune::ALU3dGrid< elType, Comm >::ALU3dGrid ( const std::string &  macroTriangFilename,
const MPICommunicatorType  mpiComm,
const DuneBoundaryProjectionType bndPrj,
const DuneBoundaryProjectionVector bndVec,
const ALUGridRefinementType  refinementType 
)
inlineprotected

Member Function Documentation

◆ adapt() [1/2]

template<ALU3dGridElementType elType, class Comm >
bool Dune::ALU3dGrid< elType, Comm >::adapt ( )

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

\return true if a least one entity was refined

The complete adaptation process works as follows:

- mark entities with the mark() method
- call preAdapt()
- if preAdapt() returned true: possibly save current solution
- call adapt()
- if adapt() returned true: possibly interpolate the (saved) solution
- call postAdapt()

◆ adapt() [2/2]

template<ALU3dGridElementType elType, class Comm >
template<class GridImp , class DataHandle >
bool Dune::ALU3dGrid< elType, Comm >::adapt ( AdaptDataHandleInterface< GridImp, DataHandle > &  handle)
inline

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

\return true if a least one entity was refined

The complete adaptation process works as follows:

- mark entities with the mark() method
- call preAdapt()
- if preAdapt() returned true: possibly save current solution
- call adapt()
- if adapt() returned true: possibly interpolate the (saved) solution
- call postAdapt()
Parameters
handlehandler for restriction and prolongation operations which is a Model of the AdaptDataHandleInterface class.

◆ comm()

template<ALU3dGridElementType elType, class Comm >
const CollectiveCommunication & Dune::ALU3dGrid< elType, Comm >::comm ( ) const
inline

return const reference to a collective communication object. The return type is a model of Dune::CollectiveCommunication.

Referenced by Dune::ALU3dGrid< elType, Comm >::ALU3dGrid().

◆ communicate()

template<ALU3dGridElementType elType, class Comm >
template<class DataHandleImp , class DataTypeImp >
void Dune::ALU3dGrid< elType, Comm >::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.

Parameters
dataA data handle telling the method what data is communicated and how this should be done.
interfaceThe communication interface to use.
dirThe direction of the communication along the interface (forward or backward.
levelThe index of the grid level where the communication should happen.

◆ DUNE_DEPRECATED_MSG()

Dune::Grid< dim, dimworld, alu3d_ctype , ALU3dGridFamily< elType, Comm > >::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, alu3d_ctype , ALU3dGridFamily< elType, Comm > >::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]

template<ALU3dGridElementType elType, class Comm >
int Dune::ALU3dGrid< elType, Comm >::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 currently set for given Entity e

◆ loadBalance()

template<ALU3dGridElementType elType, class Comm >
template<class DataHandle >
bool Dune::ALU3dGrid< elType, Comm >::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
datathe 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 ();
Wrapper class for entities.
Definition: entity.hh:62

◆ mark() [1/3]

bool Dune::Grid< dim, dimworld, alu3d_ctype , ALU3dGridFamily< elType, Comm > >::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/3]

bool Dune::GridDefaultImplementation< dim, dimworld, alu3d_ctype , ALU3dGridFamily< elType, Comm > >::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_inline.hh:299
    Static tag representing a codimension.
    Definition: dimension.hh:22
    This template method will vanish due to the inheritance rules.

◆ mark() [3/3]

template<ALU3dGridElementType elType, class Comm >
bool Dune::ALU3dGrid< elType, Comm >::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 that should be marked
Returns
true if Entity was marked, false otherwise.

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