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.
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 1, 3, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 5, 1, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 4, 5, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 6, 4, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 2, 6, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 3, 2, 7});
std::shared_ptr<Grid> gridp(factory.
createGrid());
Provide a generic factory class for unstructured grids.
Definition common/gridfactory.hh:275
virtual void insertElement(const GeometryType &type, const std::vector< unsigned int > &vertices)
Insert an element into the coarse grid.
Definition common/gridfactory.hh:307
virtual void insertVertex(const FieldVector< ctype, dimworld > &pos)
Insert a vertex into the coarse grid.
Definition common/gridfactory.hh:296
virtual std::unique_ptr< GridType > createGrid()
Finalize grid creation and hand over the grid.
Definition common/gridfactory.hh:333
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.
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 1, 3, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 1, 5, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 4, 5, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 4, 6, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 2, 6, 7});
factory.
insertElement(Dune::GeometryTypes::tetrahedron, {0, 2, 3, 7});
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 > >.
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 > >.
template<
class GridType >
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).