Provide a generic factory class for unstructured grids.
More...
#include <dune/grid/common/gridfactory.hh>
|
using | Communication = Dune::Communication< typename MPIHelper::MPICommunicator > |
|
|
| GridFactoryInterface () |
| Default constructor. More...
|
|
virtual | ~GridFactoryInterface () |
| virtual destructor More...
|
|
virtual void | insertVertex (const FieldVector< ctype, dimworld > &pos)=0 |
| Insert a vertex into the coarse grid. More...
|
|
virtual void | insertElement (const GeometryType &type, const std::vector< unsigned int > &vertices)=0 |
| Insert an element into the coarse grid. More...
|
|
virtual DUNE_NO_DEPRECATED_BEGIN void | insertElement (const GeometryType &type, const std::vector< unsigned int > &vertices, const std::shared_ptr< VirtualFunction< FieldVector< ctype, dimension >, FieldVector< ctype, dimworld > > > &elementParametrization) |
| Insert a parametrized element into the coarse grid. More...
|
|
virtual DUNE_NO_DEPRECATED_END void | insertElement (const GeometryType &type, const std::vector< unsigned int > &vertices, std::function< FieldVector< ctype, dimworld >(FieldVector< ctype, dimension >)> elementParametrization) |
| Insert a parametrized element into the coarse grid. More...
|
|
virtual void | insertBoundarySegment (const std::vector< unsigned int > &vertices)=0 |
| insert a boundary segment More...
|
|
virtual void | insertBoundarySegment (const std::vector< unsigned int > &vertices, const std::shared_ptr< BoundarySegment< dimension, dimworld > > &boundarySegment) |
| insert an arbitrarily shaped boundary segment More...
|
|
virtual std::unique_ptr< GridType > | createGrid ()=0 |
| Finalize grid creation and hand over the grid. More...
|
|
virtual unsigned int | insertionIndex (const typename Codim< 0 >::Entity &entity) const |
| obtain an element's insertion index More...
|
|
virtual unsigned int | insertionIndex (const typename Codim< dimension >::Entity &entity) const |
| obtain a vertex' insertion index More...
|
|
virtual unsigned int | insertionIndex (const typename GridType::LeafIntersection &intersection) const |
| obtain a boundary's insertion index More...
|
|
virtual bool | wasInserted (const typename GridType::LeafIntersection &intersection) const |
| determine whether an intersection was inserted More...
|
|
Communication | comm () const |
| Return the Communication used by the grid factory. More...
|
|
|
typedef GridType::ctype | ctype |
| Type used by the grid for coordinates. More...
|
|
|
static const int | dimension = GridType::dimension |
| dimension of the grid More...
|
|
static constexpr int | dimworld = GridType::dimensionworld |
| The grid world dimension. More...
|
|
template<class GridType>
class Dune::GridFactoryInterface< GridType >
Provide a generic factory class for unstructured grids.
This base class declares the interface.
Example use: create a grid consisting of a cube triangulated into 6 tetrahedra:
Left: cube with vertex numbers. Middle: cube triangulated into six tetrahedra. Right: exploded version of the middle figure, with number for the tetrahedra.
std::shared_ptr<Grid> gridp(factory.
createGrid());
@ tetrahedron
Definition: common.hh:138
virtual void insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices)
Insert an element into the coarse grid.
Definition: common/gridfactory.hh:346
virtual void insertVertex(const FieldVector< ctype, dimworld > &pos)
Insert a vertex into the coarse grid.
Definition: common/gridfactory.hh:335
virtual std::unique_ptr< GridType > createGrid()
Finalize grid creation and hand over the grid.
Definition: common/gridfactory.hh:372
Make sure that the inserted elements are not inverted, since not all grids support that. For instance, in the following code snippet the elements 1, 3 and 5 are inverted while elements 0, 2 and 4 are not.
◆ Communication
template<class GridType >
◆ ctype
template<class GridType >
Type used by the grid for coordinates.
◆ GridFactoryInterface()
template<class GridType >
◆ ~GridFactoryInterface()
template<class GridType >
◆ comm()
template<class GridType >
Return the Communication used by the grid factory.
Defaults to the Communication induced by the process-local communicator.
◆ createGrid()
template<class GridType >
◆ insertBoundarySegment() [1/2]
template<class GridType >
◆ insertBoundarySegment() [2/2]
template<class GridType >
◆ insertElement() [1/3]
template<class GridType >
virtual void Dune::GridFactoryInterface< GridType >::insertElement |
( |
const GeometryType & |
type, |
|
|
const std::vector< unsigned int > & |
vertices |
|
) |
| |
|
pure virtual |
◆ insertElement() [2/3]
template<class GridType >
virtual DUNE_NO_DEPRECATED_BEGIN void Dune::GridFactoryInterface< GridType >::insertElement |
( |
const GeometryType & |
type, |
|
|
const std::vector< unsigned int > & |
vertices, |
|
|
const std::shared_ptr< VirtualFunction< FieldVector< ctype, dimension >, FieldVector< ctype, dimworld > > > & |
elementParametrization |
|
) |
| |
|
inlinevirtual |
Insert a parametrized element into the coarse grid.
- Parameters
-
type | The GeometryType of the new element |
vertices | The vertices of the new element, using the DUNE numbering |
elementParametrization | A function prescribing the shape of this element |
Make sure the inserted element is not inverted (this holds even for simplices). There are grids that can't handle inverted elements.
- Deprecated:
- [After Dune 2.7] VirtualFunction is deprecated, use the overload taking a std::function instead
◆ insertElement() [3/3]
template<class GridType >
virtual DUNE_NO_DEPRECATED_END void Dune::GridFactoryInterface< GridType >::insertElement |
( |
const GeometryType & |
type, |
|
|
const std::vector< unsigned int > & |
vertices, |
|
|
std::function< FieldVector< ctype, dimworld >(FieldVector< ctype, dimension >)> |
elementParametrization |
|
) |
| |
|
inlinevirtual |
Insert a parametrized element into the coarse grid.
- Parameters
-
type | The GeometryType of the new element |
vertices | The vertices of the new element, using the DUNE numbering |
elementParametrization | A function prescribing the shape of this element |
Make sure the inserted element is not inverted (this holds even for simplices). There are grids that can't handle inverted elements.
◆ insertionIndex() [1/3]
template<class GridType >
obtain an element's insertion index
Data can be associated to the created macro grid using the insertion index of each entity that has been inserted during the grid creation process.
Between grid construction (createGrid) and the first grid modification, this method allows to obtain this insertion index from the grid factory. This way, data can be stored using the index maps provided by the grid.
- Parameters
-
[in] | entity | entity whose insertion index is requested |
- Returns
- insertion index of the entity
Reimplemented in Dune::GridFactory< AlbertaGrid< dim, dimworld > >, and Dune::GridFactory< UGGrid< dimworld > >.
◆ insertionIndex() [2/3]
template<class GridType >
obtain a vertex' insertion index
Data can be associated to the created macro grid using the insertion index of each entity that has been inserted during the grid creation process.
Between grid construction (createGrid) and the first grid modification, this method allows to obtain this insertion index from the grid factory. This way, data can be stored using the index maps provided by the grid.
- Parameters
-
[in] | entity | entity whose insertion index is requested |
- Returns
- insertion index of the entity
Reimplemented in Dune::GridFactory< AlbertaGrid< dim, dimworld > >, and Dune::GridFactory< UGGrid< dimworld > >.
◆ insertionIndex() [3/3]
template<class GridType >
virtual unsigned int Dune::GridFactoryInterface< GridType >::insertionIndex |
( |
const typename GridType::LeafIntersection & |
intersection | ) |
const |
|
inlinevirtual |
obtain a boundary's insertion index
Data can be associated to the created macro grid using the insertion index of each entity that has been inserted during the grid creation process.
Between grid construction (createGrid) and the first grid modification, this method allows to obtain this insertion index from the grid factory. This way, data can be stored using the index maps provided by the grid.
- Parameters
-
[in] | intersection | intersection whose insertion index is requested |
- Returns
- insertion index of the intersection
- Note
- The insertion index can only be obtained for boundary intersections that were actually inserted (see also wasInserted).
◆ insertVertex()
template<class GridType >
◆ wasInserted()
template<class GridType >
virtual bool Dune::GridFactoryInterface< GridType >::wasInserted |
( |
const typename GridType::LeafIntersection & |
intersection | ) |
const |
|
inlinevirtual |
determine whether an intersection was inserted
This method allows checking whether an intersection was actually inserted into the grid factory.
- Note
- Not all boundary segments need to be inserted into the grid factory.
-
This method returns false for all interior intersections
- Parameters
-
[in] | intersection | intersection in question |
- Returns
- true, if the intersection was inserted
◆ dimension
template<class GridType >
◆ dimworld
template<class GridType >
The grid world dimension.
The documentation for this class was generated from the following file: