dune-foamgrid  2.7-git
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Dune::FoamGrid< dimgrid, dimworld, ct > Class Template Reference

An implementation of the Dune grid interface: a 1- or 2-dimensional simplicial grid in an n-dimensional world. More...

#include <dune/foamgrid/foamgrid.hh>

Inheritance diagram for Dune::FoamGrid< dimgrid, dimworld, ct >:
Inheritance graph

Public Types

typedef FoamGridFamily< dimgrid, dimworld, ct > GridFamily
 FoamGrid is only implemented for 1 and 2 dimension. More...
 
typedef FoamGridFamily< dimgrid, dimworld, ct >::Traits Traits
 Exports various types belonging to this grid class. More...
 
typedef ct ctype
 The type used to store coordinates. More...
 

Public Member Functions

 FoamGrid ()
 Constructor, constructs an empty grid. More...
 
 ~FoamGrid ()
 Destructor. More...
 
int maxLevel () const
 
template<int codim>
Traits::template Codim< codim >::LevelIterator lbegin (int level) const
 Iterator to first entity of given codim on level. More...
 
template<int codim>
Traits::template Codim< codim >::LevelIterator lend (int level) const
 one past the end on this level More...
 
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lbegin (int level) const
 Iterator to first entity of given codim on level. More...
 
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >::template Partition< PiType >::LevelIterator lend (int level) const
 one past the end on this level More...
 
template<int codim>
Traits::template Codim< codim >::LeafIterator leafbegin () const
 Iterator to first leaf entity of given codim. More...
 
template<int codim>
Traits::template Codim< codim >::LeafIterator leafend () const
 one past the end of the sequence of leaf entities More...
 
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafbegin () const
 Iterator to first leaf entity of given codim. More...
 
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >::template Partition< PiType >::LeafIterator leafend () const
 one past the end of the sequence of leaf entities More...
 
int size (int level, int codim) const
 Number of grid entities per level and codim. More...
 
int size (int codim) const
 number of leaf entities per codim in this process More...
 
int size (int level, GeometryType type) const
 number of entities per level, codim and geometry type in this process More...
 
int size (GeometryType type) const
 number of leaf entities per codim and geometry type in this process More...
 
size_t numBoundarySegments () const
 The number of boundary edges on the coarsest level. More...
 
const Traits::GlobalIdSet & globalIdSet () const
 Access to the GlobalIdSet. More...
 
const Traits::LocalIdSet & localIdSet () const
 Access to the LocalIdSet. More...
 
const Traits::LevelIndexSet & levelIndexSet (int level) const
 Access to the LevelIndexSets. More...
 
const Traits::LeafIndexSet & leafIndexSet () const
 Access to the LeafIndexSet. More...
 
Grid Refinement Methods
void globalRefine (int refCount=1)
 Refine the grid uniformly. More...
 
bool mark (int refCount, const typename Traits::template Codim< 0 >::Entity &e)
 Mark entity for refinement. More...
 
int getMark (const typename Traits::template Codim< 0 >::Entity &e) const
 Return refinement mark for entity. More...
 
bool preAdapt ()
 Book-keeping routine to be called before adaptation. More...
 
bool adapt ()
 Triggers the grid refinement process. More...
 
void postAdapt ()
 Clean up refinement markers. More...
 
void setPosition (const typename Traits::template Codim< dimgrid >::Entity &e, const FieldVector< ctype, dimworld > &pos)
 Sets a (leaf) vertex to a new position. More...
 
Grid Growth Methods
unsigned int insertVertex (const FieldVector< ctype, dimworld > &pos)
 Add new vertex to be added the grid. More...
 
unsigned int insertElement (const GeometryType &type, const std::vector< unsigned int > &vertices)
 Add a new element to be added to the grid. More...
 
unsigned int insertElement (const GeometryType &type, const std::vector< unsigned int > &vertices, const std::shared_ptr< VirtualFunction< FieldVector< ctype, dimgrid >, FieldVector< ctype, dimworld > > > &elementParametrization)
 Add a new element to be added to the grid. More...
 
void removeElement (const typename Traits::template Codim< 0 >::Entity &e)
 Mark an element for removal from the grid. More...
 
bool preGrow ()
 Book-keeping routine to be called before growth. More...
 
bool grow ()
 Triggers the grid growth process. More...
 
void postGrow ()
 Clean up isNew markers. More...
 
unsigned int growthInsertionIndex (const typename Traits::template Codim< 0 >::Entity &e) const
 The index of insertion if the element was created in the current growth step. If this is the first element added to the growth queue by calling insertElement the index is 0 and so on. The index will be valid until postGrow is called. More...
 
unsigned int growthInsertionIndex (const typename Traits::template Codim< dimgrid >::Entity &e) const
 The index of insertion if the vertex was created in the current growth step. If this is the first vertex added to the growth queue by calling insertVertex the index is 0 and so on. The index will be valid until postGrow is called. More...
 

Static Public Member Functions

template<class EntitySeed >
static Traits::template Codim< EntitySeed::codimension >::Entity entity (const EntitySeed &seed)
 Create an Entity from an EntitySeed. More...
 

Methods for parallel computations

unsigned int overlapSize (int codim) const
 Size of the overlap on the leaf level. More...
 
unsigned int ghostSize (int codim) const
 Size of the ghost cell layer on the leaf level. More...
 
unsigned int overlapSize (int level, int codim) const
 Size of the overlap on a given level. More...
 
unsigned int ghostSize (int level, int codim) const
 Size of the ghost cell layer on a given level. More...
 
template<class DataHandle >
bool loadBalance (DataHandle &data)
 Distributes this grid over the available nodes in a distributed machine. More...
 
bool loadBalance ()
 
template<class T , template< class > class P, int codim>
void communicate (T &t, InterfaceType iftype, CommunicationDirection dir, int level) const
 The communication interface. More...
 
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 Traits::CollectiveCommunication & comm () const
 

Detailed Description

template<int dimgrid, int dimworld, class ct>
class Dune::FoamGrid< dimgrid, dimworld, ct >

An implementation of the Dune grid interface: a 1- or 2-dimensional simplicial grid in an n-dimensional world.

Template Parameters
dimgridDimension of the grid; must be either 1 or 2
dimworldDimension of the world space

Member Typedef Documentation

◆ ctype

template<int dimgrid, int dimworld, class ct >
typedef ct Dune::FoamGrid< dimgrid, dimworld, ct >::ctype

The type used to store coordinates.

◆ GridFamily

template<int dimgrid, int dimworld, class ct >
typedef FoamGridFamily<dimgrid, dimworld, ct> Dune::FoamGrid< dimgrid, dimworld, ct >::GridFamily

FoamGrid is only implemented for 1 and 2 dimension.

type of the used GridFamily for this grid

◆ Traits

template<int dimgrid, int dimworld, class ct >
typedef FoamGridFamily<dimgrid, dimworld, ct>::Traits Dune::FoamGrid< dimgrid, dimworld, ct >::Traits

Exports various types belonging to this grid class.

Constructor & Destructor Documentation

◆ FoamGrid()

template<int dimgrid, int dimworld, class ct >
Dune::FoamGrid< dimgrid, dimworld, ct >::FoamGrid ( )
inline

Constructor, constructs an empty grid.

◆ ~FoamGrid()

template<int dimgrid, int dimworld, class ct >
Dune::FoamGrid< dimgrid, dimworld, ct >::~FoamGrid ( )
inline

Destructor.

Member Function Documentation

◆ adapt()

template<int dimgrid, int dimworld, class ctype >
bool Dune::FoamGrid< dimgrid, dimworld, ctype >::adapt

Triggers the grid refinement process.

◆ comm()

template<int dimgrid, int dimworld, class ct >
const Traits::CollectiveCommunication& Dune::FoamGrid< dimgrid, dimworld, ct >::comm ( ) const
inline

dummy collective communication

◆ communicate() [1/3]

template<int dimgrid, int dimworld, class ct >
template<class DataHandle >
void Dune::FoamGrid< dimgrid, dimworld, ct >::communicate ( DataHandle &  data,
InterfaceType  iftype,
CommunicationDirection  dir 
) const
inline

◆ communicate() [2/3]

template<int dimgrid, int dimworld, class ct >
template<class DataHandle >
void Dune::FoamGrid< dimgrid, dimworld, ct >::communicate ( DataHandle &  data,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const
inline

The new communication interface communicate objects for all codims on a given level

◆ communicate() [3/3]

template<int dimgrid, int dimworld, class ct >
template<class T , template< class > class P, int codim>
void Dune::FoamGrid< dimgrid, dimworld, ct >::communicate ( T &  t,
InterfaceType  iftype,
CommunicationDirection  dir,
int  level 
) const
inline

The communication interface.

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
ifone of the predifined interface types, throws error if it is not implemented
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".

◆ entity()

template<int dimgrid, int dimworld, class ct >
template<class EntitySeed >
static Traits::template Codim<EntitySeed::codimension>::Entity Dune::FoamGrid< dimgrid, dimworld, ct >::entity ( const EntitySeed &  seed)
inlinestatic

Create an Entity from an EntitySeed.

◆ getMark()

template<int dimgrid, int dimworld, class ct >
int Dune::FoamGrid< dimgrid, dimworld, ct >::getMark ( const typename Traits::template Codim< 0 >::Entity &  e) const
inline

Return refinement mark for entity.

Returns
refinement mark (1,0,-1)

◆ ghostSize() [1/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::ghostSize ( int  codim) const
inline

Size of the ghost cell layer on the leaf level.

◆ ghostSize() [2/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::ghostSize ( int  level,
int  codim 
) const
inline

Size of the ghost cell layer on a given level.

◆ globalIdSet()

template<int dimgrid, int dimworld, class ct >
const Traits::GlobalIdSet& Dune::FoamGrid< dimgrid, dimworld, ct >::globalIdSet ( ) const
inline

Access to the GlobalIdSet.

◆ globalRefine()

template<int dimgrid, int dimworld, class ctype >
void Dune::FoamGrid< dimgrid, dimworld, ctype >::globalRefine ( int  refCount = 1)

Refine the grid uniformly.

Parameters
refCountNumber of times the grid is to be refined uniformly

◆ grow()

template<int dimgrid, int dimworld, class ctype >
bool Dune::FoamGrid< dimgrid, dimworld, ctype >::grow

Triggers the grid growth process.

◆ growthInsertionIndex() [1/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::growthInsertionIndex ( const typename Traits::template Codim< 0 >::Entity &  e) const
inline

The index of insertion if the element was created in the current growth step. If this is the first element added to the growth queue by calling insertElement the index is 0 and so on. The index will be valid until postGrow is called.

Note
This is useful to attach user data to a created element. The data might only known at element creation time. As the final element index and id are not known yet when the element is added to the insertion queue, this index can be used to attach user data that can (after calling postGrow) be attached to the real element index/id.

◆ growthInsertionIndex() [2/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::growthInsertionIndex ( const typename Traits::template Codim< dimgrid >::Entity &  e) const
inline

The index of insertion if the vertex was created in the current growth step. If this is the first vertex added to the growth queue by calling insertVertex the index is 0 and so on. The index will be valid until postGrow is called.

Note
This is useful to attach user data to a created vertex. The data might only known at vertex creation time. As the final vertex index and id are not known yet when the vertex is added to the insertion queue, this index can be used to attach user data that can (after calling postGrow) be attached to the real vertex index/id.

◆ insertElement() [1/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::insertElement ( const GeometryType &  type,
const std::vector< unsigned int > &  vertices 
)
inline

Add a new element to be added to the grid.

Parameters
typeThe GeometryType of the new element
verticesThe vertices of the new element, using the DUNE numbering
Returns
The growthInsertionIndex that can be used to attach user data to this element. It is valid between until calling postGrow.

◆ insertElement() [2/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::insertElement ( const GeometryType &  type,
const std::vector< unsigned int > &  vertices,
const std::shared_ptr< VirtualFunction< FieldVector< ctype, dimgrid >, FieldVector< ctype, dimworld > > > &  elementParametrization 
)
inline

Add a new element to be added to the grid.

Parameters
typeThe GeometryType of the new element
verticesThe vertices of the new element, using the DUNE numbering
elementParametrizationA function prescribing the shape of this element
Returns
The growthInsertionIndex that can be used to attach user data to this element. It is valid between until calling postGrow.

◆ insertVertex()

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::insertVertex ( const FieldVector< ctype, dimworld > &  pos)
inline

Add new vertex to be added the grid.

Parameters
posThe position vector of the vertex
Returns
The index of the newly inserted vertex (to be able to insert elements with it)

◆ lbegin() [1/2]

template<int dimgrid, int dimworld, class ct >
template<int codim>
Traits::template Codim<codim>::LevelIterator Dune::FoamGrid< dimgrid, dimworld, ct >::lbegin ( int  level) const
inline

Iterator to first entity of given codim on level.

◆ lbegin() [2/2]

template<int dimgrid, int dimworld, class ct >
template<int codim, PartitionIteratorType PiType>
Traits::template Codim<codim>::template Partition<PiType>::LevelIterator Dune::FoamGrid< dimgrid, dimworld, ct >::lbegin ( int  level) const
inline

Iterator to first entity of given codim on level.

◆ leafbegin() [1/2]

template<int dimgrid, int dimworld, class ct >
template<int codim>
Traits::template Codim<codim>::LeafIterator Dune::FoamGrid< dimgrid, dimworld, ct >::leafbegin ( ) const
inline

Iterator to first leaf entity of given codim.

◆ leafbegin() [2/2]

template<int dimgrid, int dimworld, class ct >
template<int codim, PartitionIteratorType PiType>
Traits::template Codim<codim>::template Partition<PiType>::LeafIterator Dune::FoamGrid< dimgrid, dimworld, ct >::leafbegin ( ) const
inline

Iterator to first leaf entity of given codim.

◆ leafend() [1/2]

template<int dimgrid, int dimworld, class ct >
template<int codim>
Traits::template Codim<codim>::LeafIterator Dune::FoamGrid< dimgrid, dimworld, ct >::leafend ( ) const
inline

one past the end of the sequence of leaf entities

◆ leafend() [2/2]

template<int dimgrid, int dimworld, class ct >
template<int codim, PartitionIteratorType PiType>
Traits::template Codim<codim>::template Partition<PiType>::LeafIterator Dune::FoamGrid< dimgrid, dimworld, ct >::leafend ( ) const
inline

one past the end of the sequence of leaf entities

◆ leafIndexSet()

template<int dimgrid, int dimworld, class ct >
const Traits::LeafIndexSet& Dune::FoamGrid< dimgrid, dimworld, ct >::leafIndexSet ( ) const
inline

Access to the LeafIndexSet.

◆ lend() [1/2]

template<int dimgrid, int dimworld, class ct >
template<int codim>
Traits::template Codim<codim>::LevelIterator Dune::FoamGrid< dimgrid, dimworld, ct >::lend ( int  level) const
inline

one past the end on this level

◆ lend() [2/2]

template<int dimgrid, int dimworld, class ct >
template<int codim, PartitionIteratorType PiType>
Traits::template Codim<codim>::template Partition<PiType>::LevelIterator Dune::FoamGrid< dimgrid, dimworld, ct >::lend ( int  level) const
inline

one past the end on this level

◆ levelIndexSet()

template<int dimgrid, int dimworld, class ct >
const Traits::LevelIndexSet& Dune::FoamGrid< dimgrid, dimworld, ct >::levelIndexSet ( int  level) const
inline

Access to the LevelIndexSets.

◆ loadBalance() [1/2]

template<int dimgrid, int dimworld, class ct >
bool Dune::FoamGrid< dimgrid, dimworld, ct >::loadBalance ( )
inline

◆ loadBalance() [2/2]

template<int dimgrid, int dimworld, class ct >
template<class DataHandle >
bool Dune::FoamGrid< dimgrid, dimworld, ct >::loadBalance ( DataHandle &  data)
inline

Distributes this grid over the available nodes in a distributed machine.

◆ localIdSet()

template<int dimgrid, int dimworld, class ct >
const Traits::LocalIdSet& Dune::FoamGrid< dimgrid, dimworld, ct >::localIdSet ( ) const
inline

Access to the LocalIdSet.

◆ mark()

template<int dimgrid, int dimworld, class ct >
bool Dune::FoamGrid< dimgrid, dimworld, ct >::mark ( int  refCount,
const typename Traits::template Codim< 0 >::Entity &  e 
)
inline

Mark entity for refinement.

This only works for entities of codim 0. The parameter is currently ignored

Returns
  • true, if marking was successful
  • false, if marking was not possible
Todo:
Why do I need those const_casts here?

◆ maxLevel()

template<int dimgrid, int dimworld, class ct >
int Dune::FoamGrid< dimgrid, dimworld, ct >::maxLevel ( ) const
inline

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

◆ numBoundarySegments()

template<int dimgrid, int dimworld, class ct >
size_t Dune::FoamGrid< dimgrid, dimworld, ct >::numBoundarySegments ( ) const
inline

The number of boundary edges on the coarsest level.

◆ overlapSize() [1/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::overlapSize ( int  codim) const
inline

Size of the overlap on the leaf level.

◆ overlapSize() [2/2]

template<int dimgrid, int dimworld, class ct >
unsigned int Dune::FoamGrid< dimgrid, dimworld, ct >::overlapSize ( int  level,
int  codim 
) const
inline

Size of the overlap on a given level.

◆ postAdapt()

template<int dimgrid, int dimworld, class ctype >
void Dune::FoamGrid< dimgrid, dimworld, ctype >::postAdapt

Clean up refinement markers.

◆ postGrow()

template<int dimgrid, int dimworld, class ctype >
void Dune::FoamGrid< dimgrid, dimworld, ctype >::postGrow

Clean up isNew markers.

◆ preAdapt()

template<int dimgrid, int dimworld, class ctype >
bool Dune::FoamGrid< dimgrid, dimworld, ctype >::preAdapt

Book-keeping routine to be called before adaptation.

◆ preGrow()

template<int dimgrid, int dimworld, class ctype >
bool Dune::FoamGrid< dimgrid, dimworld, ctype >::preGrow

Book-keeping routine to be called before growth.

◆ removeElement()

template<int dimgrid, int dimworld, class ct >
void Dune::FoamGrid< dimgrid, dimworld, ct >::removeElement ( const typename Traits::template Codim< 0 >::Entity &  e)
inline

Mark an element for removal from the grid.

Parameters
eThe codim 0 entity to be removed from the grid

◆ setPosition()

template<int dimgrid, int dimworld, class ctype >
void Dune::FoamGrid< dimgrid, dimworld, ctype >::setPosition ( const typename Traits::template Codim< dimgrid >::Entity &  e,
const FieldVector< ctype, dimworld > &  pos 
)

Sets a (leaf) vertex to a new position.

Parameters
eThe codim dimgrid entity (vertex) to be moved. Note: The vertex must be a leaf vertex. The implementation stores copies of vertices for each level they exist on. Changing a vertex' position changes its position on all coarser grid levels, too! We could not think of an application for moving non-leaf vertices, write us if you need that feature.
posThe new global position of the vertex

◆ size() [1/4]

template<int dimgrid, int dimworld, class ct >
int Dune::FoamGrid< dimgrid, dimworld, ct >::size ( GeometryType  type) const
inline

number of leaf entities per codim and geometry type in this process

◆ size() [2/4]

template<int dimgrid, int dimworld, class ct >
int Dune::FoamGrid< dimgrid, dimworld, ct >::size ( int  codim) const
inline

number of leaf entities per codim in this process

◆ size() [3/4]

template<int dimgrid, int dimworld, class ct >
int Dune::FoamGrid< dimgrid, dimworld, ct >::size ( int  level,
GeometryType  type 
) const
inline

number of entities per level, codim and geometry type in this process

◆ size() [4/4]

template<int dimgrid, int dimworld, class ct >
int Dune::FoamGrid< dimgrid, dimworld, ct >::size ( int  level,
int  codim 
) const
inline

Number of grid entities per level and codim.


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