KASKADE 7 development version
Modules | Namespaces | Classes | Functions
Grid input

Grid creation or input. More...

Modules

 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

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). More...
 
template<class Grid , class Type >
std::unique_ptr< Grid > Kaskade::createGrid (std::vector< Type > const &cubes)
 Extract simplicial grid from list of cubes. More...
 
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. More...
 
template<class Grid >
std::unique_ptr< Grid > Kaskade::createUnitSquare (double dh=1., bool symmetric=true)
 Creates a unit square, filled regularly. More...
 
template<class Grid >
std::unique_ptr< Grid > Kaskade::createUnitCube (double dh=1., bool symmetric=true)
 Creates a unit cube. More...
 
template<class Grid , class Scalar >
std::unique_ptr< Grid > Kaskade::createRectangle (Dune::FieldVector< Scalar, 2 > const &x0, Dune::FieldVector< Scalar, 2 > const &dx, Scalar dh, bool symmetric=true)
 Fill rectangle with squares. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<class Grid >
std::unique_ptr< Grid > Kaskade::createUshape (double l, double d, double eps)
 Creates an U-shaped domain. More...
 

Detailed Description

Grid creation or input.

Function Documentation

◆ createCuboid()

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 Parameters
Gridtype of grid to create
Scalar
dimspatial dimension (usually 2 or 3)
EdgeLengtheither a scalar or a Dune::FieldVector type
Parameters
x0left, lower, front corner of the cuboid
dxdesired side lengths of the hexahedron to fill
dhside length(s) of hexahedra that are used to fill the cuboid
symmetrictrue: 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 414 of file gridGeneration.hh.

◆ createCylinder() [1/2]

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.

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.

Parameters
radiusthe cylinder's radius \( r \)
heightthe cylinder's height \( H \)
layersthe number of anti-prsimatic disks making up the grid
circumEdgesthe number of edges (or vertices) around the circumference
deformationa 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 705 of file gridGeneration.hh.

◆ createCylinder() [2/2]

template<class Grid >
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.

Parameters
radiusthe cylinder's radius \( r \)
heightthe cylinder's height \( H \)
layersthe number of anti-prsimatic disks making up the grid
circumEdgesthe number of edges (or vertices) around the circumference
Cellquality (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 683 of file gridGeneration.hh.

◆ createGrid()

template<class Grid , class Type >
std::unique_ptr< Grid > Kaskade::createGrid ( std::vector< Type > const &  cubes)

Extract simplicial grid from list of cubes.

From a given list of (conforming) cubes or rectangles, this creates a simplicial grid.

Template Parameters
Gridthe type of grid to create
Type

Usage:

grid = createGrid<Grid>(GridGeneration_Detail::fillCuboid(x0,dx,dh,true));

Definition at line 371 of file gridGeneration.hh.

◆ createLShape()

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.

Parameters
x0left, lower, front corner of the L-shaped domain
dxlength of horizontal line
dylength of vertical line
thickness
dhside length of cubes that are used to fill the cuboid
symmetrictrue: each cube provides a symmetric tetrahedal decomposition

Definition at line 477 of file gridGeneration.hh.

◆ createPentagon()

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.

Parameters
radiusof the circumcircle of the pentagon
Template Parameters
Gridthe type of grid to create

Definition at line 775 of file gridGeneration.hh.

◆ createRectangle()

template<class Grid , class Scalar >
std::unique_ptr< Grid > Kaskade::createRectangle ( Dune::FieldVector< Scalar, 2 > const &  x0,
Dune::FieldVector< Scalar, 2 > const &  dx,
Scalar  dh,
bool  symmetric = true 
)

Fill rectangle with squares.

Parameters
x0left, lower, front corner of the cuboid
dxside lengths
dhside length of cubes that are used to fill the cuboid
symmetrictrue: each cube provides a symmetric tetrahedal decomposition

Definition at line 460 of file gridGeneration.hh.

◆ createTShape()

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.

Parameters
x0center on lower boundary of the T-shaped domain
dxlength of horizontal line
dylength of vertical line
thickness
dhside length of cubes that are used to fill the cuboid
symmetrictrue: each cube provides a symmetric tetrahedal decomposition

Definition at line 496 of file gridGeneration.hh.

◆ createTwoLayerCuboid() [1/2]

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 
)

Definition at line 515 of file gridGeneration.hh.

◆ createTwoLayerCuboid() [2/2]

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 
)

Definition at line 505 of file gridGeneration.hh.

◆ createUnitCube()

template<class Grid >
std::unique_ptr< Grid > Kaskade::createUnitCube ( double  dh = 1.,
bool  symmetric = true 
)

Creates a unit cube.

Parameters
dhdesired side length of the subcubes.

Definition at line 443 of file gridGeneration.hh.

◆ createUnitSquare()

template<class Grid >
std::unique_ptr< Grid > Kaskade::createUnitSquare ( double  dh = 1.,
bool  symmetric = true 
)

Creates a unit square, filled regularly.

Parameters
dhside length of the subsquares.
symmetricif true, each subsquare is filled symmetrically with four triangles

Definition at line 431 of file gridGeneration.hh.

◆ createUshape()

template<class Grid >
std::unique_ptr< Grid > Kaskade::createUshape ( double  l,
double  d,
double  eps 
)

Creates an U-shaped domain.

=======================|

=======================|

Template Parameters
Gridthe type of grid to create
Parameters
lside length
dthickness of gemetry
epsslit width of geometry

Definition at line 830 of file gridGeneration.hh.

◆ readPolyData()

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

Parameters
namethe base name of the files (without the .node/.ele extension).
boundaryMarkera 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.

Warning
: triangle assigns the "boundary marker" 0 to interior edges in the *.edge file. These are ignored when reading the boundary information. Thus, don't ever use boundary marker 0 for any boundaries!

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.