![]() |
KASKADE 7 development version
|
Grid creation or input. More...
Topics | |
| Platonian solids | |
Namespaces | |
| namespace | Kaskade::AmiraMeshReader |
| Reader for Amira meshes. | |
Classes | |
| class | Kaskade::AnsysMeshReader |
| Reader for Ansys *.inp grid files. More... | |
| class | Kaskade::VTKReader |
| A class to create a grid and load coefficients from a VTK file. More... | |
Functions | |
| template<class Grid, class GridView> | |
| std::unique_ptr< Grid > | Kaskade::extrude (GridView const &gridView, double h) |
| Extrude a (d-1)-dimensional simplicial surface grid to a d-dimensional simplicial grid. | |
| std::unique_ptr< Dune::UGGrid< 2 > > | readPolyData (std::string const &name, std::vector< int > *boundaryMarker=nullptr) |
| Construct an unstructured UG grid from .node and .ele files (Triangle output). | |
| template<class Grid, class Type, class Deformation = IdentityDeformation> | |
| std::unique_ptr< Grid > | Kaskade::createGrid (std::vector< Type > const &cubes, Deformation phi=Deformation()) |
| Extract simplicial grid from list of cubes. | |
| template<class Grid, class Scalar, int dim, class EdgeLength> | |
| std::unique_ptr< Grid > | Kaskade::createCuboid (Dune::FieldVector< Scalar, dim > const &x0, Dune::FieldVector< Scalar, dim > const &dx, EdgeLength const &dh, bool symmetric=true) |
| Creates a uniform simplicial grid on a rectangular or cuboid domain. | |
| template<class Grid> | |
| std::unique_ptr< Grid > | Kaskade::createUnitSquare (double dh=1., bool symmetric=true) |
| Creates a unit square, filled regularly. | |
| template<class Grid> | |
| std::unique_ptr< Grid > | Kaskade::createUnitCube (double dh=1., bool symmetric=true) |
| Creates a unit cube. | |
| template<class Grid, class Scalar, class Dh, class Deformation = IdentityDeformation> | |
| std::unique_ptr< Grid > | Kaskade::createRectangle (Dune::FieldVector< Scalar, 2 > const &x0, Dune::FieldVector< Scalar, 2 > const &dx, Dh dh, bool symmetric=true, Deformation phi=Deformation()) |
| Cartesian structured triangulation of a rectangular domain. | |
| template<class Grid, class Scalar, int dim> | |
| std::unique_ptr< Grid > | Kaskade::createLShape (Dune::FieldVector< Scalar, dim > const &x0, Scalar dx, Scalar dy, Dune::FieldVector< Scalar, dim > const &thickness, Scalar dh, bool symmetric=true) |
| Fill L-shaped domain with cubes. | |
| template<class Grid, class Scalar, int dim> | |
| std::unique_ptr< Grid > | Kaskade::createTShape (Dune::FieldVector< Scalar, dim > const &x0, Scalar dx, Scalar dy, Dune::FieldVector< Scalar, dim > const &thickness, Scalar dh, bool symmetric=true) |
| Fill L-shaped domain with cubes. | |
| template<class Grid, class Scalar, int dim> | |
| std::unique_ptr< Grid > | Kaskade::createTwoLayerCuboid (Dune::FieldVector< Scalar, dim > const &x0, Dune::FieldVector< Scalar, dim > const &dx1, Dune::FieldVector< Scalar, dim > const &dx2, Dune::FieldVector< Scalar, dim > const &dh1, Scalar dh2, bool symmetric=true) |
| template<class Grid, class Scalar, int dim> | |
| std::unique_ptr< Grid > | Kaskade::createTwoLayerCuboid (Dune::FieldVector< Scalar, dim > const &x0, Dune::FieldVector< Scalar, dim > const &dx1, Dune::FieldVector< Scalar, dim > const &dx2, Dune::FieldVector< Scalar, dim > const &dh1, Dune::FieldVector< Scalar, dim > const &dh2, bool symmetric=true) |
| template<class Grid> | |
| std::unique_ptr< Grid > | Kaskade::createCylinder (double radius, double height, int layers, int circumEdges=6) |
| Creates a cylinder. | |
| template<class Grid, class Deformation> | |
| std::unique_ptr< Grid > | Kaskade::createCylinder (double radius, double height, int layers, int circumEdges, Deformation const &deformation) |
| Creates a deformed cylinder. | |
| template<class Grid> | |
| std::unique_ptr< Grid > | Kaskade::createPentagon (double radius=1) |
| Creates an regular pentagon consisting of five triangles, centered at the origin and with radius r. | |
| template<class Grid> | |
| std::unique_ptr< Grid > | Kaskade::createUshape (double l, double d, double eps) |
| Creates a U-shaped domain in \( \R^2 \). | |
| template<class GridView, class ... GridViews> | |
| auto | Kaskade::unionGrid (GridView const &gv, GridViews const &...gvs) |
| Creates a union grid from multiple given simplicial grid views. | |
Grid creation or input.
| std::unique_ptr< Grid > Kaskade::createCuboid | ( | Dune::FieldVector< Scalar, dim > const & | x0, |
| Dune::FieldVector< Scalar, dim > const & | dx, | ||
| EdgeLength const & | dh, | ||
| bool | symmetric = true ) |
Creates a uniform simplicial grid on a rectangular or cuboid domain.
| Grid | type of grid to create |
| Scalar | real number type (usually double) |
| dim | spatial dimension (usually 2 or 3) |
| EdgeLength | either a scalar or a Dune::FieldVector<*,dim> type |
| x0 | left, lower, front corner of the cuboid |
| dx | desired side lengths of the hexahedron to fill |
| dh | side length(s) of hexahedra that are used to fill the cuboid |
| symmetric | true: each cube provides a symmetric tetrahedal decomposition |
If the edge length dh is a scalar, exact cubes are created. If it is a vector (of size dim), hexahedra with the given edge length are created.
Note that the desired size dx of the domain to be filled is just an indication - the resulting grid will approximately have this size. In contrast, the hexahedra used for filling the domain will always have the shape given by dh.
Definition at line 460 of file gridGeneration.hh.
Referenced by createCoverGrid(), createUnitCube(), and createUnitSquare().
| std::unique_ptr< Grid > Kaskade::createCylinder | ( | double | radius, |
| double | height, | ||
| int | layers, | ||
| int | circumEdges, | ||
| Deformation const & | deformation ) |
Creates a deformed cylinder.
This creates a grid for the cyclinder domain \( \{ (x,y,z) \mid x^2 + y^2 \le r, 0\le z \le H \} \), and deforms it as specified. The grid consists of a series of prisms along the cylinder's axis.
| radius | the cylinder's radius \( r \) |
| height | the cylinder's height \( H \) |
| layers | the number of anti-prsimatic disks making up the grid |
| circumEdges | the number of edges (or vertices) around the circumference |
| deformation | a callable object Dune::FieldVector<double,3> deformation(Dune::FieldVector<double,3>) |
Cell quality (in terms of aspect ratio) depends on the parameter values (and the deformation, of course). Reasonable cell quality is achieved for values approximately satisfying radius*layers = height and circumEdges = 6.
Definition at line 769 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createCylinder | ( | double | radius, |
| double | height, | ||
| int | layers, | ||
| int | circumEdges = 6 ) |
Creates a cylinder.
This creates a grid for the cyclinder domain \( \{ (x,y,z) \mid x^2 + y^2 \le r, 0\le z \le H \} \), i.e. the cylinder's axis is the z-axis. The grid consists of a series of prisms along the cylinder's axis.
| radius | the cylinder's radius \( r \) |
| height | the cylinder's height \( H \) |
| layers | the number of anti-prsimatic disks making up the grid |
| circumEdges | the number of edges (or vertices) around the circumference |
| Cell | quality (in terms of aspect ratio) depends on the parameter values. Reasonable cell quality is achieved for values approximately satisfying radius*layers = height and circumEdges = 6. |
Definition at line 747 of file gridGeneration.hh.
Referenced by createCylinder().
| std::unique_ptr< Grid > Kaskade::createGrid | ( | std::vector< Type > const & | cubes, |
| Deformation | phi = Deformation() ) |
Extract simplicial grid from list of cubes.
From a given list of (conforming) cubes or rectangles, this creates a simplicial grid. Optionally, the grid vertices can be warped by an invertible deformation of the space, such that piecewise planar meshes of curved domains can be created.
| Grid | the type of grid to create |
| Type | type of provided cuboids (cubes in 3D or rectangles in 2D) |
| Deformation | a callable type mapping Dune::FieldVector to Dune::FieldVector |
| cubes | a sequence of cuboids making up the cartesian grid structure |
| phi | an invertible mapping from the grid domain to \( \R^d \) |
Usage:
Definition at line 414 of file gridGeneration.hh.
Referenced by createCuboid(), createLShape(), createRectangle(), createTShape(), createTwoLayerCuboid(), and createTwoLayerCuboid().
| std::unique_ptr< Grid > Kaskade::createLShape | ( | Dune::FieldVector< Scalar, dim > const & | x0, |
| Scalar | dx, | ||
| Scalar | dy, | ||
| Dune::FieldVector< Scalar, dim > const & | thickness, | ||
| Scalar | dh, | ||
| bool | symmetric = true ) |
Fill L-shaped domain with cubes.
| x0 | left, lower, front corner of the L-shaped domain |
| dx | length of horizontal line |
| dy | length of vertical line |
| thickness | |
| dh | side length of cubes that are used to fill the cuboid |
| symmetric | true: each cube provides a symmetric tetrahedal decomposition |
Definition at line 535 of file gridGeneration.hh.
Creates an regular pentagon consisting of five triangles, centered at the origin and with radius r.
| radius | of the circumcircle of the pentagon |
| Grid | the type of grid to create |
Definition at line 839 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createRectangle | ( | Dune::FieldVector< Scalar, 2 > const & | x0, |
| Dune::FieldVector< Scalar, 2 > const & | dx, | ||
| Dh | dh, | ||
| bool | symmetric = true, | ||
| Deformation | phi = Deformation() ) |
Cartesian structured triangulation of a rectangular domain.
| Dh | either a scalar or a Dune::FieldVector<Scalar,2> |
| Deformation | a callable type mapping Dune::FieldVector to Dune::FieldVector |
| x0 | left, lower, front corner of the rectangle |
| dx | side lengths |
| dh | side length of squares that are used to fill the rectangle |
| symmetric | true: each square provides a symmetric triangular decomposition |
Definition at line 511 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createTShape | ( | Dune::FieldVector< Scalar, dim > const & | x0, |
| Scalar | dx, | ||
| Scalar | dy, | ||
| Dune::FieldVector< Scalar, dim > const & | thickness, | ||
| Scalar | dh, | ||
| bool | symmetric = true ) |
Fill L-shaped domain with cubes.
| x0 | center on lower boundary of the T-shaped domain |
| dx | length of horizontal line |
| dy | length of vertical line |
| thickness | |
| dh | side length of cubes that are used to fill the cuboid |
| symmetric | true: each cube provides a symmetric tetrahedal decomposition |
Definition at line 554 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createTwoLayerCuboid | ( | Dune::FieldVector< Scalar, dim > const & | x0, |
| Dune::FieldVector< Scalar, dim > const & | dx1, | ||
| Dune::FieldVector< Scalar, dim > const & | dx2, | ||
| Dune::FieldVector< Scalar, dim > const & | dh1, | ||
| Dune::FieldVector< Scalar, dim > const & | dh2, | ||
| bool | symmetric = true ) |
Definition at line 577 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createTwoLayerCuboid | ( | Dune::FieldVector< Scalar, dim > const & | x0, |
| Dune::FieldVector< Scalar, dim > const & | dx1, | ||
| Dune::FieldVector< Scalar, dim > const & | dx2, | ||
| Dune::FieldVector< Scalar, dim > const & | dh1, | ||
| Scalar | dh2, | ||
| bool | symmetric = true ) |
Definition at line 566 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createUnitCube | ( | double | dh = 1., |
| bool | symmetric = true ) |
Creates a unit cube.
| dh | desired side length of the subcubes. |
Definition at line 491 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createUnitSquare | ( | double | dh = 1., |
| bool | symmetric = true ) |
Creates a unit square, filled regularly.
| dh | side length of the subsquares. |
| symmetric | if true, each subsquare is filled symmetrically with four triangles |
Definition at line 479 of file gridGeneration.hh.
| std::unique_ptr< Grid > Kaskade::createUshape | ( | double | l, |
| double | d, | ||
| double | eps ) |
Creates a U-shaped domain in \( \R^2 \).
xxxxx
x
xxxxx
| Grid | the type of grid to create |
| l | side length (horizontal extent, length of the legs of the U, \( l > d\)) |
| d | thickness of gemetry (vertical width of a single leg, \( d > 0 \)) |
| eps | slit width of geometry (distance between legs, \( \epsilon > 0 \)) |
Definition at line 892 of file gridGeneration.hh.
Extrude a (d-1)-dimensional simplicial surface grid to a d-dimensional simplicial grid.
Given a simplicial grid of a (d-1)-dimensional manifold embedded in d-dimensional space (a surface mesh in 3D for d=3, a curve in 2D for d=2), this creates a d-dimensional simplicial grid that is a conforming prismatisation of the surface: a layer of prescribed thickness \( h \) around the surface, meshed with simplices.
The input grid is interpreted as the mid-surface of the extruded layer. The layer extends symmetrically by \( h/2 \) to both sides of the input surface. Consequently the absolute orientation of the input surface is irrelevant (reversing all normals yields the same grid) and there is no notion of an "outside" that would have to be determined. Only the relative orientation of neighbouring cells has to be consistent, which is achieved by a breadth-first propagation over the cell adjacency (see io/extrusion.hpp).
In every input node a normal direction is defined as the normalised average of the unit normals of the incident cells, and the layer vertices are placed along these directions. The number of sub-layers is chosen from the mean cell diameter \( s \) as \( n = \max(1, \mathrm{round}(h/s)) \), so that the sub-prisms are approximately isotropic; this assumes a roughly uniform local mesh size. For \( h \ll s \) one obtains flat simplices (usually intended), for \( h \sim s \) well-shaped ones.
Each sub-prism is decomposed into simplices. In 3D a triangular prism is split into three tetrahedra; the decomposition is selected by a purely local rule on the diagonals of the rectangular side faces which is provably conforming (shared faces get the same diagonal), see io/extrusion.hpp for the details and the proof.
| Grid | the type of grid to create, with Grid::dimension == Grid::dimensionworld == GridView::dimensionworld (e.g. Dune::UGGrid<3> for a surface mesh in 3D) |
| GridView | a leaf grid view of the input surface grid with GridView::dimension == GridView::dimensionworld - 1; only simplex cells are supported |
| gridView | the leaf grid view of the input surface grid |
| h | the thickness of the layer ( \( h \neq 0 \)); the layer spans \( [-h/2, +h/2] \) around the input surface |
| GridException | if the input contains non-simplex cells, if the node normals cannot be oriented consistently (non-orientable surface or a ~180 degree fold), or if the extrusion would produce inverted/self-intersecting cells (e.g. h too large for a strongly curved surface) |
Example:
A complete tutorial example is provided in tutorial/extrusion, demonstrating both a 2D curve-to-strip and a 3D surface-to-shell extrusion with VTK output and volume verification.
| std::unique_ptr< Dune::UGGrid< 2 > > readPolyData | ( | std::string const & | name, |
| std::vector< int > * | boundaryMarker = nullptr ) |
Construct an unstructured UG grid from .node and .ele files (Triangle output).
| name | the base name of the files (without the .node/.ele extension). |
| boundaryMarker | a pointer to a vector of boundary markers. If not the nullpointer, the given vector is resized to the number of boundary segments (which is the number of boundary edges), and the corresponding markers are stored. These are stored in arbitrary order. |
If the reading of boundary markers is requested, i.e. boundaryMarker != nullptr, a ".edge" file must exist. This can be generated by triangle using the -e option.
Dune boundary intersections have a method boundarySegmentIndex() returning the index of the coarse grid boundary segment on which the intersection resides. Use this index to look up the marker in the boundaryMarker array.
| auto Kaskade::unionGrid | ( | GridView const & | gv, |
| GridViews const &... | gvs ) |
Creates a union grid from multiple given simplicial grid views.
| GridView | a Dune::GridView type for the first given grid view |
| GridViews | a template parameter pack of more Dune::GridView types |
All the grid views need to contain only simplicial cells, have the same dimension, and a compatible coordinate scalar type ctype.
| gv | the first grid view |
| gv | a parameter pack of more grid views |
The vertices and cells are just concatenated, shifting the vertex indices of later grid views by the total number of vertices in previous grid views.
Definition at line 1012 of file gridGeneration.hh.