Dune Core Modules (2.9.0)

Dune::GridFactory< AlbertaGrid< dim, dimworld > > Class Template Referenceabstract

specialization of the generic GridFactory for AlbertaGrid More...

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

Public Types

typedef AlbertaGrid< dim, dimworldGrid
 type of grid this factory is for
 
typedef Grid::ctype ctype
 type of (scalar) coordinates
 
typedef FieldVector< ctype, dimensionworldWorldVector
 type of vector for world coordinates
 
typedef FieldMatrix< ctype, dimensionworld, dimensionworldWorldMatrix
 type of matrix from world coordinates to world coordinates
 

Public Member Functions

 GridFactory ()
 
virtual void insertVertex (const WorldVector &pos)
 insert a vertex into the macro grid More...
 
virtual void insertElement (const GeometryType &type, const std::vector< unsigned int > &vertices)
 insert an element into the macro grid More...
 
virtual void insertBoundary (int element, int face, int id)
 mark a face as boundary (and assign a boundary id) More...
 
virtual void insertBoundaryProjection (const GeometryType &type, const std::vector< unsigned int > &vertices, const DuneProjection *projection)
 insert a boundary projection into the macro grid More...
 
virtual void insertBoundaryProjection (const DuneProjection *projection)
 insert a global (boundary) projection into the macro grid More...
 
virtual void insertBoundarySegment (const std::vector< unsigned int > &vertices)
 insert a boundary segment into the macro grid More...
 
virtual void insertBoundarySegment (const std::vector< unsigned int > &vertices, const std::shared_ptr< BoundarySegment > &boundarySegment)
 insert a shaped boundary segment into the macro grid More...
 
void insertFaceTransformation (const WorldMatrix &matrix, const WorldVector &shift)
 add a face transformation (for periodic identification) More...
 
void markLongestEdge ()
 mark the longest edge as refinemet edge More...
 
std::unique_ptr< GridcreateGrid ()
 finalize grid creation and hand over the grid More...
 
bool write (const std::string &filename)
 write out the macro triangulation in native grid file format More...
 
virtual void insertVertex (const FieldVector< ctype, dimworld > &pos)=0
 Insert a vertex into the coarse grid.
 
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 ([[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 Public Member Functions

static void destroyGrid (Grid *grid)
 destroy a grid previously obtain from this factory More...
 

Static Public Attributes

static const int dimension = Grid::dimension
 dimension of the grid
 
static const int dimensionworld = Grid::dimensionworld
 dimension of the world
 
static const bool supportsBoundaryIds = true
 are boundary ids supported by this factory?
 
static const bool supportPeriodicity = MacroData::supportPeriodicity
 is the factory able to create periodic meshes?
 

Static Protected Attributes

constexpr static int dimworld
 The grid world dimension.
 

Detailed Description

template<int dim, int dimworld>
class Dune::GridFactory< AlbertaGrid< dim, dimworld > >

specialization of the generic GridFactory for AlbertaGrid

The GridFactory for AlbertaGrid adds some extensions to the standard GridFactoryInterface. It provides the following additional features:

  • It allows to set boundary ids via insertBoundary. For ALBERTA 1.2, these boundary ids are ignored, though.
  • For ALBERTA 3.0 and above, you can add face transformation to identify faces. This allows the construction of periodic grids.
  • The grid can be written in ALBERTA's native format for macro triangulations via write (both ASCII and XDR format are supported).
  • On grid creation, a name can be assigned to the grid.
  • On grid creation, the grid can be reordered such that ALBERTA uses the longest edge as refinement edge during recursive bisection.

Constructor & Destructor Documentation

◆ GridFactory()

template<int dim, int dimworld>
Dune::GridFactory< AlbertaGrid< dim, dimworld > >::GridFactory ( )
inline

default constructor

Member Function Documentation

◆ comm()

Communication Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::comm ( ) const
inlineinherited

Return the Communication used by the grid factory.

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

◆ createGrid()

template<int dim, int dimworld>
std::unique_ptr<Grid> Dune::GridFactory< AlbertaGrid< dim, dimworld > >::createGrid ( )
inlinevirtual

finalize grid creation and hand over the grid

This version of createGrid is original to the AlbertaGrid grid factroy, allowing to specity a grid name.

Returns
a pointer to the newly created grid
Note
The caller takes responsibility of freeing the memory allocated for the grid.
ALBERTA's grid factory provides a static method for freeing the grid (destroyGrid).

Implements Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >.

References Dune::GridFactoryInterface< GridType >::dimension, and DUNE_THROW.

◆ destroyGrid()

template<int dim, int dimworld>
static void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::destroyGrid ( Grid grid)
inlinestatic

destroy a grid previously obtain from this factory

Parameters
[in]gridpointer to the grid to destroy

◆ insertBoundary()

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertBoundary ( int  element,
int  face,
int  id 
)
inlinevirtual

mark a face as boundary (and assign a boundary id)

Parameters
[in]elementindex of the element, the face belongs to
[in]facelocal number of the face within the element
[in]idboundary id to assign to the face
Note
ALBERTA supports only boundary id in the range 1,...,127.

References DUNE_THROW.

◆ insertBoundaryProjection() [1/2]

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertBoundaryProjection ( const DuneProjection projection)
inlinevirtual

insert a global (boundary) projection into the macro grid

Parameters
[in]projectionglobal (boundary) projection
Note
The grid takes control of the projection object.

References DUNE_THROW.

◆ insertBoundaryProjection() [2/2]

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertBoundaryProjection ( const GeometryType type,
const std::vector< unsigned int > &  vertices,
const DuneProjection projection 
)
inlinevirtual

insert a boundary projection into the macro grid

Parameters
[in]typegeometry type of boundary face
[in]verticesvertices of the boundary face
[in]projectionboundary projection
Note
The grid takes control of the projection object.

References Dune::GeometryType::dim(), Dune::GridFactoryInterface< GridType >::dimension, DUNE_THROW, and Dune::GeometryType::isSimplex().

◆ insertBoundarySegment() [1/3]

virtual void Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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

◆ insertBoundarySegment() [2/3]

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertBoundarySegment ( const std::vector< unsigned int > &  vertices)
inlinevirtual

insert a boundary segment into the macro grid

Only influences the ordering of the boundary segments

Parameters
[in]verticesvertex indices of boundary face

Implements Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >.

References Dune::GridFactoryInterface< GridType >::dimension, and Dune::GeometryTypes::simplex().

◆ insertBoundarySegment() [3/3]

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertBoundarySegment ( const std::vector< unsigned int > &  vertices,
const std::shared_ptr< BoundarySegment > &  boundarySegment 
)
inlinevirtual

insert a shaped boundary segment into the macro grid

Parameters
[in]verticesvertex indices of boundary face
[in]boundarySegmentgeometric realization of shaped boundary

References Dune::GridFactoryInterface< GridType >::dimension, DUNE_THROW, Dune::FloatCmp::gt(), and Dune::Geo::ReferenceElements< ctype_, dim >::simplex().

◆ insertElement() [1/3]

virtual DUNE_NO_DEPRECATED_BEGIN void Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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

◆ insertElement() [2/3]

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertElement ( const GeometryType type,
const std::vector< unsigned int > &  vertices 
)
inlinevirtual

insert an element into the macro grid

Parameters
[in]typeGeometryType of the new element
[in]verticesindices of the element vertices (in DUNE numbering)

Implements Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >.

References Dune::GeometryType::dim(), Dune::GridFactoryInterface< GridType >::dimension, DUNE_THROW, and Dune::GeometryType::isSimplex().

◆ insertElement() [3/3]

virtual DUNE_NO_DEPRECATED_END void Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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.

◆ insertFaceTransformation()

template<int dim, int dimworld>
void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertFaceTransformation ( const WorldMatrix matrix,
const WorldVector shift 
)
inline

add a face transformation (for periodic identification)

A face transformation is an affine mapping T from world coordinates to world coordinates. ALBERTA periodically identifies two faces f and g if T( f ) = g or T( g ) = f.

Parameters
[in]matrixmatrix describing the linear part of T
[in]shiftvector describing T( 0 )
Note
ALBERTA requires the matrix to be orthogonal.
ALBERTA automatically adds the inverse transformation.

◆ insertionIndex() [1/3]

virtual unsigned int Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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

◆ insertionIndex() [2/3]

virtual unsigned int Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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

◆ insertionIndex() [3/3]

virtual unsigned int Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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).

◆ insertVertex()

template<int dim, int dimworld>
virtual void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::insertVertex ( const WorldVector pos)
inlinevirtual

insert a vertex into the macro grid

Parameters
[in]posposition of the vertex (in world coordinates)

◆ markLongestEdge()

template<int dim, int dimworld>
void Dune::GridFactory< AlbertaGrid< dim, dimworld > >::markLongestEdge ( )
inline

mark the longest edge as refinemet edge

Marking the longest edge avoids cycles in the recursive bisection algorithm, if the longest edge of each element is unique. It also makes sure the angles degenerate least. It can, hoowever, produce more nonlocal refinements than necessary. Therefore this feature is disabled by default.

◆ wasInserted()

virtual bool Dune::GridFactoryInterface< AlbertaGrid< dim, dimworld > >::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

◆ write()

template<int dim, int dimworld>
bool Dune::GridFactory< AlbertaGrid< dim, dimworld > >::write ( const std::string &  filename)
inline

write out the macro triangulation in native grid file format

Parameters
[in]filenamename of the file to write to
Returns
true on success

References Dune::GridFactoryInterface< GridType >::dimension.


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 24, 22:30, 2024)