Dune::UGGrid< dim > Class Template Reference
[Grid Implementations]

#include <uggrid.hh>

Inheritance diagram for Dune::UGGrid< dim >:

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

List of all members.


Detailed Description

template<int dim>
class Dune::UGGrid< dim >

[ provides Dune::Grid ]

Provides the meshes of the finite element toolbox UG. (http://sit.iwr.uni-heidelberg.de/~ug).

This is the implementation of the grid interface using the UG grid management system. UG provides conforming grids in two and three space dimensions. The grids can be mixed, i.e. 2d grids can contain triangles and quadrilaterals and 3d grids can contain tetrahedra and hexahedra and also pyramids and prisms. The grid refinement rules are very flexible. Local adaptive red/green refinement is the default, but a special method in the UGGrid class allows you to directly access a number of anisotropic refinements rules. Last but not least, the UG grid manager is completely parallelized, and you can use boundaries parametrized by either analytical expressions or high-resolution piecewise linear surfaces. To use this module you need the UG library. See the DUNE installation notes on how to obtain and install it.

In your Dune application, you can now instantiate objects of the type UGGrid<2> or UGGrid<3>. You can have more than one, if you choose. It is even possible to have 2d and 3d grids at the same time, even though the original UG system never intended to support this!

See the documentation for the factory class GridFactory<UGGrid<dimworld> > to learn how to create UGGrid objects.

Please send any questions, suggestions, or bug reports to sander@math.fu-berlin.de

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

Public Types

enum  RefinementType { LOCAL, COPY }
 The different forms of grid refinement that UG supports. More...
enum  ClosureType { GREEN, NONE }
 Decide whether to add a green closure to locally refined grid sections or not. More...
typedef UGGridFamily< dim, dim > GridFamily
 type of the used GridFamily for this grid
typedef UGGridFamily< dim, dim >
::Traits 
Traits
 The traits of this class.
typedef UG::DOUBLE ctype
 The type used to store coordinates.
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 Partition
< All_Partition >
::LevelGridView 
LevelGridView
 View types for All_Partition.
typedef Partition
< All_Partition >
::LeafGridView 
LeafGridView

Public Member Functions

 UGGrid (unsigned int heapSize=500)
 Constructor with control over UG's memory requirements.
 ~UGGrid ()
 Destructor.
int maxLevel () const
template<int codim>
Traits::template Codim< codim >
::LevelIterator 
lbegin (int level) const
 Iterator to first entity of given codim on level.
template<int codim>
Traits::template Codim< codim >
::LevelIterator 
lend (int level) const
 one past the end on this level
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.
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >
::template Partition< PiType >
::LevelIterator 
lend (int level) const
 one past the end on this level
template<int codim>
Traits::template Codim< codim >
::LeafIterator 
leafbegin () const
 Iterator to first leaf entity of given codim.
template<int codim>
Traits::template Codim< codim >
::LeafIterator 
leafend () const
 one past the end of the sequence of leaf entities
template<int codim, PartitionIteratorType PiType>
Traits::template Codim< codim >
::template Partition< PiType >
::LeafIterator 
leafbegin () const
 Iterator to first leaf entity of given codim.
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
int size (int level, int codim) 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
const Traits::GlobalIdSetglobalIdSet () const
 Access to the GlobalIdSet.
const Traits::LocalIdSetlocalIdSet () const
 Access to the LocalIdSet.
const Traits::LevelIndexSetlevelIndexSet (int level) const
 Access to the LevelIndexSets.
const Traits::LeafIndexSetleafIndexSet () const
 Access to the LeafIndexSet.
std::string name () const
 return name of the grid
unsigned int overlapSize (int codim) const
 Size of the overlap on the leaf level.
unsigned int ghostSize (int codim) const
 Size of the ghost cell layer on the leaf level.
unsigned int overlapSize (int level, int codim) const
 Size of the overlap on a given level.
unsigned int ghostSize (int level, int codim) const
 Size of the ghost cell layer on a given level.
bool loadBalance ()
 Default load balancing.
template<class DataHandle>
bool loadBalance (DataHandle &data)
 Re-balances the load each process has to handle for a parallel grid, the DataHandle data works like the data handle for the communicate methods. If grid has changed , true is returned.
bool loadBalance (int strategy, int minlevel, int depth, int maxlevel, int minelement)
 Distributes this grid over the available nodes in a distributed machine.
template<class DataHandle>
void communicate (DataHandle &data, InterfaceType iftype, CommunicationDirection dir, int level) const
 The communication interface for all codims on a given level.
template<class DataHandle>
void communicate (DataHandle &dataHandle, InterfaceType iftype, CommunicationDirection dir) const
 The communication interface for all codims on the leaf level.
const CollectiveCommunication
< UGGrid > & 
comm () const
void getChildrenOfSubface (typename Traits::template Codim< 0 >::EntityPointer &e, int elementSide, int maxl, std::vector< typename Traits::template Codim< 0 >::EntityPointer > &childElements, std::vector< unsigned char > &childElementSides) const
 Rudimentary substitute for a hierarchic iterator on faces.
void setRefinementType (RefinementType type)
 Sets the type of grid refinement.
void setClosureType (ClosureType type)
 Sets the type of grid refinement closure.
void collapse ()
 Collapses the grid hierarchy into a single grid level.
void setPosition (typename Traits::template Codim< dim >::EntityPointer &e, const FieldVector< double, dim > &pos)
 Sets a vertex to a new position.
FieldVector< ctype, dim > getBoundaryPosition (const typename Traits::LevelIntersectionIterator &iIt, const FieldVector< ctype, dim-1 > &localPos) const
 For a point on the grid boundary return its position on the domain boundary.
void globalRefine (int n)
 Does uniform refinement.
template<PartitionIteratorType pitype>
Traits::template Partition
< pitype >::LevelGridView 
levelView (int level) const
 View for a grid level.
Traits::template Partition
< All_Partition >
::LevelGridView 
levelView (int level) const
 View for a grid level for All_Partition.
template<PartitionIteratorType pitype>
Traits::template Partition
< pitype >::LeafGridView 
leafView () const
 View for the leaf grid.
Traits::template Partition
< All_Partition >
::LeafGridView 
leafView () const
 View for the leaf grid for All_Partition.
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
Grid Refinement Methods


bool mark (int refCount, const typename Traits::template Codim< 0 >::EntityPointer &e)
 Mark element for refinement.
bool mark (int refCount, const typename Traits::template Codim< 0 >::Entity &e)
 Mark element for refinement.
bool mark (const typename Traits::template Codim< 0 >::EntityPointer &e, typename UG_NS< dim >::RefinementRule rule, int side=0)
 Mark method accepting a UG refinement rule.
bool mark (const typename Traits::template Codim< 0 >::Entity &e, typename UG_NS< dim >::RefinementRule rule, int side=0)
 Mark method accepting a UG refinement rule.
int getMark (const typename Traits::template Codim< 0 >::EntityPointer &e) const
 Query whether element is marked for refinement.
int getMark (const typename Traits::template Codim< 0 >::Entity &e) const
 Query whether element is marked for refinement.
bool preAdapt ()
 returns true, if some elements might be coarsend during grid adaption, here always returns true
bool adapt ()
 Triggers the grid refinement process.
void postAdapt ()
 Clean up refinement markers.
Coarse Grid Creation Methods


void createBegin ()
 Start the coarse grid creation process.
void createEnd ()
 End the coarse grid creation process.
void createLGMGrid (const std::string &name)
 When UGGrid has been configured to use the LGM domain manager, this routine sets up a grid from an LGM and an NG file.
void insertBoundarySegment (const std::vector< unsigned int > vertices, const BoundarySegment< dim > *boundarySegment)
 Method to insert an arbitrarily shaped boundary segment into a coarse grid.
void insertVertex (const FieldVector< double, dim > &pos)
 Insert a vertex into the coarse grid.
void insertElement (GeometryType type, const std::vector< unsigned int > &vertices)
 Insert an element into the coarse grid.
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. (deprecated).
bool mark (int refCount, const typename Codim< 0 >::Entity &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 (deprecated)
int getMark (const typename Codim< 0 >::Entity &e) const
 returns adaptation mark for given entity

Protected Member Functions

GridImp & asImp ()
 Barton-Nackman trick.
const GridImp & asImp () const
 Barton-Nackman trick.

Static Protected Member Functions

template<class InterfaceType>
static
ReturnImplementationType
< InterfaceType >
::ImplementationType & 
getRealImplementation (InterfaceType &i)
 return real implementation of interface class


Member Typedef Documentation

template<int dim>
typedef UGGridFamily<dim,dim>::Traits Dune::UGGrid< dim >::Traits

The traits of this class.

Presents the typedefs as described in GridTraits.

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


Member Enumeration Documentation

template<int dim>
enum Dune::UGGrid::RefinementType

The different forms of grid refinement that UG supports.

Enumerator:
LOCAL  New level consists only of the refined elements and the closure.
COPY  New level consists of the refined elements and the unrefined ones, too.

template<int dim>
enum Dune::UGGrid::ClosureType

Decide whether to add a green closure to locally refined grid sections or not.

Enumerator:
GREEN  Standard red/green refinement.
NONE  No closure, results in nonconforming meshes.

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>
Dune::UGGrid< dim >::UGGrid ( unsigned int  heapSize = 500  ) 

Constructor with control over UG's memory requirements.

Parameters:
heapSize The size of UG's internal memory in megabytes for this grid.


Member Function Documentation

template<int dim>
int Dune::UGGrid< dim >::maxLevel (  )  const

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 Dune::UGGrid< dimworld >::levelIndexSet().

template<int dim>
bool Dune::UGGrid< dim >::mark ( int  refCount,
const typename Traits::template Codim< 0 >::EntityPointer e 
)

Mark element for refinement.

Parameters:
refCount 
  • 1: mark for red refinement
  • -1: mark for coarsening
  • 0: delete a possible refinement mark
e Element to be marked
Returns:
  • true, if element was marked
  • false, if nothing changed
Deprecated:

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

template<int dim>
bool Dune::UGGrid< dim >::mark ( int  refCount,
const typename Traits::template Codim< 0 >::Entity e 
)

Mark element for refinement.

Parameters:
refCount 
  • 1: mark for red refinement
  • -1: mark for coarsening
  • 0: delete a possible refinement mark
e Element to be marked
Returns:
  • true, if element was marked
  • false, if nothing changed

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

template<int dim>
bool Dune::UGGrid< dim >::mark ( const typename Traits::template Codim< 0 >::EntityPointer e,
typename UG_NS< dim >::RefinementRule  rule,
int  side = 0 
)

Mark method accepting a UG refinement rule.

Parameters:
e Pointer to the element to be marked for refinement
rule One of the UG refinement rules
side If rule==UGD2::BLUE (one quadrilateral is split into two rectangles) you can choose the orientation of the cut by setting side==0 or side==1
Deprecated:

template<int dim>
bool Dune::UGGrid< dim >::mark ( const typename Traits::template Codim< 0 >::Entity e,
typename UG_NS< dim >::RefinementRule  rule,
int  side = 0 
)

Mark method accepting a UG refinement rule.

Parameters:
e Pointer to the element to be marked for refinement
rule One of the UG refinement rules
side If rule==UGD2::BLUE (one quadrilateral is split into two rectangles) you can choose the orientation of the cut by setting side==0 or side==1

template<int dim>
int Dune::UGGrid< dim >::getMark ( const typename Traits::template Codim< 0 >::EntityPointer e  )  const

Query whether element is marked for refinement.

Deprecated:

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

template<int dim>
bool Dune::UGGrid< dim >::loadBalance (  )  [inline]

Default load balancing.

Bug:
The return value is always 'true'
Returns:
true if the grid has changed

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

Referenced by Dune::UGGrid< dimworld >::loadBalance().

template<int dim>
template<class DataHandle>
bool Dune::UGGrid< dim >::loadBalance ( DataHandle &  data  )  [inline]

Re-balances the load each process has to handle for a parallel grid, the DataHandle data works like the data handle for the communicate methods. If grid has changed , true is returned.

Bug:
Not implemented yet!

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

template<int dim>
bool Dune::UGGrid< dim >::loadBalance ( int  strategy,
int  minlevel,
int  depth,
int  maxlevel,
int  minelement 
)

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

If you want the UG default for the parameters pick

  • strategy = 0
  • minlevel = 1
  • depth = 2
  • maxlevel = 32
  • minelement = 1

Bug:
The return value is always 'true'
Parameters:
minlevel The coarsest grid level that gets distributed
maxlevel does currently get ignored

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

The communication interface for all codims on a given level.

Parameters:
T array class holding data associated with the entities
DataHandle type used to gather/scatter data in and out of the message buffer
iftype one of the predifined 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".

template<int dim>
template<class DataHandle>
void Dune::UGGrid< dim >::communicate ( DataHandle &  dataHandle,
InterfaceType  iftype,
CommunicationDirection  dir 
) const [inline]

The communication interface for all codims on the leaf level.

Parameters:
T array class holding data associated with the entities
DataHandle type used to gather/scatter data in and out of the message buffer
iftype one of the predifined interface types, throws error if it is not implemented
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".

template<int dim>
const CollectiveCommunication<UGGrid>& Dune::UGGrid< dim >::comm (  )  const [inline]

dummy collective communication

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

template<int dim>
void Dune::UGGrid< dim >::createBegin (  ) 

Start the coarse grid creation process.

Todo:
This method should delete the grid!
Deprecated:

template<int dim>
void Dune::UGGrid< dim >::createEnd (  ) 

End the coarse grid creation process.

Deprecated:

template<int dim>
void Dune::UGGrid< dim >::insertBoundarySegment ( const std::vector< unsigned int >  vertices,
const BoundarySegment< dim > *  boundarySegment 
)

Method to insert an arbitrarily shaped boundary segment into a coarse grid.

Parameters:
vertices The indices of the vertices of the segment
boundarySegment Class implementing the geometry of the boundary segment. The grid object takes control of this object and deallocates it when destructing itself.
Deprecated:

template<int dim>
void Dune::UGGrid< dim >::insertVertex ( const FieldVector< double, dim > &  pos  ) 

Insert a vertex into the coarse grid.

Deprecated:

template<int dim>
void Dune::UGGrid< dim >::insertElement ( GeometryType  type,
const std::vector< unsigned int > &  vertices 
)

Insert an element into the coarse grid.

Parameters:
type The GeometryType of the new element
vertices The vertices of the new element, using the DUNE numbering
Deprecated:

template<int dim>
void Dune::UGGrid< dim >::getChildrenOfSubface ( typename Traits::template Codim< 0 >::EntityPointer e,
int  elementSide,
int  maxl,
std::vector< typename Traits::template Codim< 0 >::EntityPointer > &  childElements,
std::vector< unsigned char > &  childElementSides 
) const

Rudimentary substitute for a hierarchic iterator on faces.

Parameters:
e,elementSide Grid face specified by an element and one of its sides
maxl The finest level that should be traversed by the iterator
children For each subface: element index, elementSide, and level

template<int dim>
void Dune::UGGrid< dim >::setPosition ( typename Traits::template Codim< dim >::EntityPointer e,
const FieldVector< double, dim > &  pos 
)

Sets a vertex to a new position.

Changing a vertex' position changes its position on all grid levels!

template<int dim>
void Dune::UGGrid< dim >::globalRefine ( int  n  ) 

Does uniform refinement.

Parameters:
n Number of uniform refinement steps

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

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. (deprecated).

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.
Deprecated:

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 
) [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 Entity that should be marked
Returns:
true if Entity was marked, false otherwise.

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 (deprecated)

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

template<int dim, int dimworld, class ct, class GridFamily>
int Dune::Grid< dim, dimworld, ct, GridFamily >::getMark ( const typename Codim< 0 >::Entity e  )  const [inline, inherited]

returns adaptation mark for given entity

Parameters:
[in] e Entity for which adaptation mark should be determined
Returns:
int adaptation mark currently set for given Entity 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]

dummy communicate, doing nothing

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 
) const [inline, inherited]

dummy communicate, doing nothing

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


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

Generated on Thu Apr 2 10:40:48 2009 for dune-grid by  doxygen 1.5.6