Dune Core Modules (2.9.0)

Dune::GridFactory< GridType > Class Template Referenceabstract

Provide a generic factory class for unstructured grids. More...

#include <dune/grid/common/gridfactory.hh>

Public Member Functions

 GridFactory ()
 Default constructor.
 
virtual void insertVertex ([[maybe_unused]] const FieldVector< ctype, dimworld > &pos)
 Insert a vertex into the coarse grid.
 
virtual void insertElement ([[maybe_unused]] const GeometryType &type, [[maybe_unused]] const std::vector< unsigned int > &vertices)
 Insert an element into the coarse grid. More...
 
virtual void insertBoundarySegment ([[maybe_unused]] const std::vector< unsigned int > &vertices)
 insert a boundary segment More...
 
virtual std::unique_ptr< GridType > createGrid ()
 Finalize grid creation and hand over the grid. More...
 
virtual void insertBoundarySegment (const std::vector< unsigned int > &vertices)=0
 insert a boundary segment More...
 
virtual void insertBoundarySegment ([[maybe_unused]] const std::vector< unsigned int > &vertices,[[maybe_unused]] const std::shared_ptr< BoundarySegment< dimension, dimworld > > &boundarySegment)
 insert an arbitrarily shaped boundary segment More...
 
virtual void insertVertex (const FieldVector< ctype, dimworld > &pos)=0
 Insert a vertex into the coarse grid.
 
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 ([[maybe_unused]] const GeometryType &type, [[maybe_unused]] const std::vector< unsigned int > &vertices, [[maybe_unused]] 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 ([[maybe_unused]] const std::vector< unsigned int > &vertices, [[maybe_unused]] const std::shared_ptr< BoundarySegment< dimension, dimworld > > &boundarySegment)
 insert an arbitrarily shaped boundary segment More...
 
virtual unsigned int insertionIndex ([[maybe_unused]] const typename Codim< 0 >::Entity &entity) const
 obtain an element's insertion index More...
 
virtual unsigned int insertionIndex ([[maybe_unused]] const typename Codim< dimension >::Entity &entity) const
 obtain a vertex' insertion index More...
 
virtual unsigned int insertionIndex ([[maybe_unused]] const typename GridType::LeafIntersection &intersection) const
 obtain a boundary's insertion index More...
 
virtual bool wasInserted ([[maybe_unused]] 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...
 

Static Protected Attributes

static const int dimension = GridType::dimension
 dimension of the grid
 

Detailed Description

template<class GridType>
class Dune::GridFactory< GridType >

Provide a generic factory class for unstructured grids.

This is the unspecialized class, which does nothing. All work is done in the specializations for the different grid types.

See GridFactoryInterface for an example how to use this class.

Member Function Documentation

◆ comm()

template<class GridType >
Communication Dune::GridFactoryInterface< GridType >::comm ( ) const
inlineinherited

◆ createGrid()

template<class GridType >
virtual std::unique_ptr<GridType> Dune::GridFactory< GridType >::createGrid ( )
inlinevirtual

◆ insertBoundarySegment() [1/5]

template<class GridType >
virtual void Dune::GridFactory< GridType >::insertBoundarySegment ( [[maybe_unused] ] const std::vector< unsigned int > &  vertices)
inlinevirtual

insert a boundary segment

This method inserts a boundary segment into the coarse grid. Using this method has two advantages over not using it:

  • The boundary segment gets an insertion index.
  • The grid factory can verify that this is actually a boundary segment
Note
You are not forced to insert all boundary segments. The grid factory will find the remaining boundary segments itself.
Parameters
[in]verticesthe indices of the vertices of the segment

References DUNE_THROW.

◆ insertBoundarySegment() [2/5]

template<class GridType >
virtual void Dune::GridFactoryInterface< GridType >::insertBoundarySegment ( [[maybe_unused] ] const std::vector< unsigned int > &  vertices,
[[maybe_unused] ] const std::shared_ptr< BoundarySegment< dimension, dimworld > > &  boundarySegment 
)
inlinevirtualinherited

insert an arbitrarily shaped boundary segment

This method inserts a boundary segment into the coarse grid.

Parameters
[in]verticesthe indices of the vertices of the segment
[in]boundarySegmentuser defined implementation of the boundary segment's geometry

References DUNE_THROW.

◆ insertBoundarySegment() [3/5]

template<class GridType >
virtual void Dune::GridFactoryInterface< GridType >::insertBoundarySegment
inline

insert an arbitrarily shaped boundary segment

This method inserts a boundary segment into the coarse grid.

Parameters
[in]verticesthe indices of the vertices of the segment
[in]boundarySegmentuser defined implementation of the boundary segment's geometry

◆ insertBoundarySegment() [4/5]

template<class GridType >
virtual void Dune::GridFactoryInterface< GridType >::insertBoundarySegment ( const std::vector< unsigned int > &  vertices)
pure virtualinherited

insert a boundary segment

This method inserts a boundary segment into the coarse grid. Using this method has two advantages over not using it:

  • The boundary segment gets an insertion index.
  • The grid factory can verify that this is actually a boundary segment
Note
You are not forced to insert all boundary segments. The grid factory will find the remaining boundary segments itself.
Parameters
[in]verticesthe indices of the vertices of the segment

Implemented in Dune::ALU3dGridFactory< ALUGrid >, Dune::ALU3dGridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > >, Dune::GridFactory< UGGrid< dimworld > >, and Dune::GridFactory< AlbertaGrid< dim, dimworld > >.

◆ insertBoundarySegment() [5/5]

template<class GridType >
virtual void Dune::GridFactoryInterface< GridType >::insertBoundarySegment

insert a boundary segment

This method inserts a boundary segment into the coarse grid. Using this method has two advantages over not using it:

  • The boundary segment gets an insertion index.
  • The grid factory can verify that this is actually a boundary segment
Note
You are not forced to insert all boundary segments. The grid factory will find the remaining boundary segments itself.
Parameters
[in]verticesthe indices of the vertices of the segment

◆ insertElement() [1/4]

template<class GridType >
virtual void Dune::GridFactory< GridType >::insertElement ( [[maybe_unused] ] const GeometryType type,
[[maybe_unused] ] const std::vector< unsigned int > &  vertices 
)
inlinevirtual

Insert an element into the coarse grid.

Parameters
typeThe GeometryType of the new element
verticesThe vertices of the new element, using the DUNE numbering

Make sure the inserted element is not inverted (this holds even for simplices). There are grids that can't handle inverted tets.

References DUNE_THROW.

Referenced by Dune::StructuredGridFactory< GridType >::createCubeGrid(), Dune::StructuredGridFactory< GridType >::createSimplexGrid(), and Dune::StarCDReader< GridType >::read().

◆ insertElement() [2/4]

template<class GridType >
virtual DUNE_NO_DEPRECATED_BEGIN void Dune::GridFactoryInterface< GridType >::insertElement ( [[maybe_unused] ] const GeometryType type,
[[maybe_unused] ] const std::vector< unsigned int > &  vertices,
[[maybe_unused] ] const std::shared_ptr< VirtualFunction< FieldVector< ctype, dimension >, FieldVector< ctype, dimworld > > > &  elementParametrization 
)
inlinevirtualinherited

Insert a parametrized element into the coarse 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

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

References DUNE_THROW.

◆ insertElement() [3/4]

template<class GridType >
virtual void Dune::GridFactoryInterface< GridType >::insertElement ( const GeometryType type,
const std::vector< unsigned int > &  vertices 
)
pure virtualinherited

Insert an element into the coarse grid.

Parameters
typeThe GeometryType of the new element
verticesThe vertices of the new element, using the DUNE numbering

Make sure the inserted element is not inverted (this holds even for simplices). There are grids that can't handle inverted elements.

Implemented in Dune::GridFactory< UGGrid< dimworld > >, Dune::GridFactory< AlbertaGrid< dim, dimworld > >, Dune::ALU3dGridFactory< ALUGrid >, and Dune::ALU3dGridFactory< ALUGrid< dim, dimw, eltype, refinementtype, Comm > >.

Referenced by Dune::GridFactoryInterface< GridType >::insertElement().

◆ insertElement() [4/4]

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 
)
inlinevirtualinherited

Insert a parametrized element into the coarse 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

Make sure the inserted element is not inverted (this holds even for simplices). There are grids that can't handle inverted elements.

References DUNE_NO_DEPRECATED_BEGIN, DUNE_NO_DEPRECATED_END, and Dune::GridFactoryInterface< GridType >::insertElement().

◆ insertionIndex() [1/3]

template<class GridType >
virtual unsigned int Dune::GridFactoryInterface< GridType >::insertionIndex ( [[maybe_unused] ] const typename Codim< 0 >::Entity entity) const
inlinevirtualinherited

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]entityentity whose insertion index is requested
Returns
insertion index of the entity

References DUNE_THROW.

Referenced by Dune::GridFactory< UGGrid< dimworld > >::wasInserted().

◆ insertionIndex() [2/3]

template<class GridType >
virtual unsigned int Dune::GridFactoryInterface< GridType >::insertionIndex ( [[maybe_unused] ] const typename Codim< dimension >::Entity entity) const
inlinevirtualinherited

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]entityentity whose insertion index is requested
Returns
insertion index of the entity

References DUNE_THROW.

◆ insertionIndex() [3/3]

template<class GridType >
virtual unsigned int Dune::GridFactoryInterface< GridType >::insertionIndex ( [[maybe_unused] ] const typename GridType::LeafIntersection &  intersection) const
inlinevirtualinherited

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]intersectionintersection 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).

References DUNE_THROW.

◆ wasInserted()

template<class GridType >
virtual bool Dune::GridFactoryInterface< GridType >::wasInserted ( [[maybe_unused] ] const typename GridType::LeafIntersection &  intersection) const
inlinevirtualinherited

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]intersectionintersection in question
Returns
true, if the intersection was inserted

References DUNE_THROW.


The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 17, 22:29, 2024)