Dune Core Modules (2.11.0)

Dune::GridFactoryBase< dimgrid, dimworld, ct > Class Template Referenceabstract

Specialization of the generic GridFactory for FoamGrid<dimgrid, dimworld> More...

#include <dune/foamgrid/foamgrid/foamgridfactory.hh>

Public Member Functions

 GridFactoryBase ()
 Default constructor.
 
 GridFactoryBase (FoamGrid< dimgrid, dimworld, ctype > *grid)
 Constructor for a given grid object. More...
 
 ~GridFactoryBase () override
 Destructor.
 
void insertVertex (const FieldVector< ctype, dimworld > &pos) override
 Insert a vertex into the coarse grid.
 
unsigned int insertionIndex (const typename FoamGrid< dimgrid, dimworld, ctype >::Traits::template Codim< 0 >::Entity &entity) const override
 Obtain an element's insertion index.
 
unsigned int insertionIndex (const typename FoamGrid< dimgrid, dimworld, ctype >::Traits::template Codim< dimgrid >::Entity &vertex) const override
 Obtain a vertex' insertion index.
 
unsigned int insertionIndex (const typename FoamGrid< dimgrid, dimworld, ctype >::LeafIntersection &intersection) const override
 Obtain a boundary's insertion index.
 
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 void insertElement (const GeometryType &, const std::vector< unsigned int > &, std::function< FieldVector< ctype, dimworld >(FieldVector< ctype, dimension >)>)
 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< FoamGrid< dimgrid, dimworld, ct > > 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...
 

Protected Attributes

std::vector< FoamGridEntityImp< 0, dimgrid, dimworld, ctype > * > vertexArray_
 Array containing all vertices.
 
unsigned int boundarySegmentCounter_ = 0
 Counter that creates the boundary segment indices.
 

Static Protected Attributes

static const int dimension
 dimension of the grid
 
static constexpr int dimworld
 The grid world dimension.
 

Detailed Description

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

Specialization of the generic GridFactory for FoamGrid<dimgrid, dimworld>

Constructor & Destructor Documentation

◆ GridFactoryBase()

template<int dimgrid, int dimworld, class ct >
Dune::GridFactoryBase< dimgrid, dimworld, ct >::GridFactoryBase ( FoamGrid< dimgrid, dimworld, ctype > *  grid)
inline

Constructor for a given grid object.

If you already have your grid object constructed you can hand it over using this constructor.

If you construct your factory class using this constructor the pointer handed over to you by the method createGrid() is the one you supplied here.

Member Function Documentation

◆ comm()

Communication Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::comm ( ) const
inlineinherited

Return the Communication used by the grid factory.

Defaults to the Communication induced by the process-local communicator.

◆ createGrid()

virtual std::unique_ptr< FoamGrid< dimgrid, dimworld, ct > > Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::createGrid ( )
pure virtualinherited

Finalize grid creation and hand over the grid.

The receiver takes responsibility of the memory allocated for the grid

Implemented in Dune::GridFactory< FoamGrid< 1, dimworld, ct > >, and Dune::GridFactory< FoamGrid< 2, dimworld, ct > >.

◆ insertBoundarySegment() [1/2]

virtual void Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::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::GridFactory< FoamGrid< 1, dimworld, ct > >, and Dune::GridFactory< FoamGrid< 2, dimworld, ct > >.

◆ insertBoundarySegment() [2/2]

virtual void Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::insertBoundarySegment ( const std::vector< unsigned int > &  vertices,
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

◆ insertElement() [1/2]

virtual void Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::insertElement ( const GeometryType ,
const std::vector< unsigned int > &  ,
std::function< FieldVector< ctype, dimworld >(FieldVector< ctype, dimension >)>   
)
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.

◆ insertElement() [2/2]

virtual void Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::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< FoamGrid< 1, dimworld, ct > >, and Dune::GridFactory< FoamGrid< 2, dimworld, ct > >.

◆ insertionIndex() [1/3]

virtual unsigned int Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::insertionIndex ( 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

◆ insertionIndex() [2/3]

virtual unsigned int Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::insertionIndex ( 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

◆ insertionIndex() [3/3]

virtual unsigned int Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::insertionIndex ( 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).

◆ wasInserted()

virtual bool Dune::GridFactoryInterface< FoamGrid< dimgrid, dimworld, ct > >::wasInserted ( 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

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Feb 14, 23:39, 2026)