KASKADE 7 development version
Namespaces | Functions
Kaskade::AmiraMeshReader Namespace Reference

Reader for Amira meshes. More...

Namespaces

namespace  ImplementationDetails
 

Functions

template<class Grid , class Scalar , class ScalarEd = Scalar>
std::unique_ptr< Grid > readGrid (std::string const &gridfile, int initialGridSize=0, std::vector< int > *boundaryIds=nullptr, std::vector< Dune::FieldVector< ScalarEd, Grid::dimension > > *edgeDisplacement=nullptr, double scale=1.0)
 function reading an Amira mesh file in ASCII format. More...
 
template<class Grid , class Scalar , class ScalarEd = Scalar, class Deformation >
std::unique_ptr< Grid > readGrid (std::string const &gridfile, Deformation const &deformation, int initialGridSize=0, std::vector< int > *boundaryIds=nullptr, std::vector< Dune::FieldVector< ScalarEd, Grid::dimension > > *edgeDisplacement=nullptr, double scale=1.0)
 function reading an Amira mesh file in ASCII format. More...
 
template<class Grid , class Scalar , class ScalarEd = Scalar>
std::unique_ptr< Grid > mergeGrids (std::string const &gridfile1, std::string const &gridfile2, int initialGridSize=0, std::vector< int > *boundaryIds=nullptr, double scale1=1.0, double scale2=1.0)
 function joining two Amira mesh files in ASCII format into one grid. More...
 
template<class DataType , class FunctionSpaceElement >
void readData (std::string const &datafile, std::string const &dataname, std::string const &componentname, FunctionSpaceElement &data, bool verbose=false)
 function reading additional data from an Amira mesh file in ASCII format. More...
 
template<class Scalar , int numberOfComponents>
void readData (std::string const &datafile, std::string const &dataname, std::string const &componentname, std::vector< Dune::FieldVector< Scalar, numberOfComponents > > &data)
 function reading additional data for each vertex from an Amira mesh file in ASCII format. More...
 
template<class VarSetDesc >
void readDeformationIntoVariableSetRepresentation (std::string const &gridfile, std::string const &datafile, typename VarSetDesc::VariableSet &data)
 function reading return a FE-function describing the deformation. More...
 
template<class FunctionSpaceElement , class FileScalar = float>
void readDeformation (std::string const &gridfile, std::string const &datafile, FunctionSpaceElement &data)
 function reading return a fe-function describing the deformation. More...
 
template<class GridView , class FunctionSpaceElement , class FileScalar = float>
void readDeformation2 (GridView const &gridView, std::string const &datafile, FunctionSpaceElement &data)
 
template<class Grid >
void boundaryConditionsToScalarField (std::string const &gridfile, std::string const &savefilename=std::string("boundaryConditions"), int initialGridSize=0)
 Read boundary indices and save as scalar field in .vtu-file. More...
 

Detailed Description

Reader for Amira meshes.

Note that the Amira mesh file must be in ASCII format. (I think this is not true, can also read binary Amira mesh, but only Big Endian.) Currently UG and ALUSimplex grids are supported.

Function Documentation

◆ boundaryConditionsToScalarField()

template<class Grid >
void Kaskade::AmiraMeshReader::boundaryConditionsToScalarField ( std::string const &  gridfile,
std::string const &  savefilename = std::string("boundaryConditions"),
int  initialGridSize = 0 
)

Read boundary indices and save as scalar field in .vtu-file.

Parameters
gridfilename of the Amira mesh file
savefilenamename of the output file (optional), default: "boundaryConditions.vtu"
initialGridSizeinitial grid size in mb(only for UGGrid)

Definition at line 936 of file amirameshreader.hh.

◆ mergeGrids()

template<class Grid , class Scalar , class ScalarEd = Scalar>
std::unique_ptr< Grid > Kaskade::AmiraMeshReader::mergeGrids ( std::string const &  gridfile1,
std::string const &  gridfile2,
int  initialGridSize = 0,
std::vector< int > *  boundaryIds = nullptr,
double  scale1 = 1.0,
double  scale2 = 1.0 
)

function joining two Amira mesh files in ASCII format into one grid.

This function reads vertices, tetrahedra and, if defined, boundary triangles of each of two Amira mesh files. After renumbering the two are joined into one grid.

Template Parameters
Gridthe type of grid to be constructed
Scalarscalar type of the vertex coordinates, i.e. how it is specified in the amira file, it is important to choose it correctly
Parameters
gridfile1the name of the first Amira mesh file
gridfile2the name of the second Amira mesh file
initialGridSizeoptional parameter for reserving memory for the grid
boundaryIdsif ids (e.g. membership to patches) for boundary segments are specified in the grid file, and this pointer is not null, then on return the pointed to vector will contain for each boundary segment (by its index, see Dune::Intersection) the corresponding id
edgeDisplacementif edges (by node indices) and their positions (of midpoints) are specified in the grid file and this pointer is not null, then on return the pointed to vector will contain for each edge (by its global index in the returned grid) the corresponding displacement
scalea factor with which the geometry is scaled. Use this to convert the geometry to standard SI units if it is given in the grid file in a different scale (e.g., millimeter). This is overwritten if the grid file contains a UnitLength parameter.
Returns
pointer on the created grid

Definition at line 467 of file amirameshreader.hh.

◆ readData() [1/2]

template<class DataType , class FunctionSpaceElement >
void Kaskade::AmiraMeshReader::readData ( std::string const &  datafile,
std::string const &  dataname,
std::string const &  componentname,
FunctionSpaceElement data,
bool  verbose = false 
)

function reading additional data from an Amira mesh file in ASCII format.

Parameters
DataTypescalar type of the data in the Amira mesh file (e.g., unsigned char)
FunctionSpaceElementtype of FE-Function to store the additional data in
datafilethe name of the Amira mesh file containing additional data
datanamethe location of the data in the Amira mesh file (e.g., "Tetrahedra")
componentnamethe name of the data's components in the Amira mesh file (e.g., "Materials")
dataFE function object for storing the additional data

Definition at line 678 of file amirameshreader.hh.

◆ readData() [2/2]

template<class Scalar , int numberOfComponents>
void Kaskade::AmiraMeshReader::readData ( std::string const &  datafile,
std::string const &  dataname,
std::string const &  componentname,
std::vector< Dune::FieldVector< Scalar, numberOfComponents > > &  data 
)

function reading additional data for each vertex from an Amira mesh file in ASCII format.

Parameters
Scalarscalar type of the data in the Amira mesh file
numberOfComponentsnumber of components of each entry of the data
datafilethe name of the Amira mesh file containing additional node data
datanamethe location of the data in the Amira mesh file (e.g., "Tetrahedra")
componentnamethe name of the data's components in the Amira mesh file (e.g., "Materials")
datavector containing the data

Definition at line 727 of file amirameshreader.hh.

◆ readDeformation()

template<class FunctionSpaceElement , class FileScalar = float>
void Kaskade::AmiraMeshReader::readDeformation ( std::string const &  gridfile,
std::string const &  datafile,
FunctionSpaceElement data 
)

function reading return a fe-function describing the deformation.

Function reading a deformed and a undeformed geometry from Amira mesh files in ASCII format. These geometry must possess the same number of nodes. For each vertex the difference between the geometries is calculated. This difference is read into the fe-function object data.

Parameters
datafilethe name of the Amira mesh file containing the deformed geometry
gridfilethe name of the Amira mesh file containing the undeformed geometry
datafe-function object for storing the deformation

Definition at line 829 of file amirameshreader.hh.

◆ readDeformation2()

template<class GridView , class FunctionSpaceElement , class FileScalar = float>
void Kaskade::AmiraMeshReader::readDeformation2 ( GridView const &  gridView,
std::string const &  datafile,
FunctionSpaceElement data 
)

Definition at line 884 of file amirameshreader.hh.

◆ readDeformationIntoVariableSetRepresentation()

template<class VarSetDesc >
void Kaskade::AmiraMeshReader::readDeformationIntoVariableSetRepresentation ( std::string const &  gridfile,
std::string const &  datafile,
typename VarSetDesc::VariableSet &  data 
)

function reading return a FE-function describing the deformation.

Function reading a deformed and an undeformed geometry from Amira mesh files in ASCII format. These geometries must possess the same number of nodes. For each vertex the difference between the geometries is calculated. This difference is stored into the FE-function at index 0 of the variable set data.

Parameters
datafilethe name of the Amira mesh file containing the deformed geometry
gridfilethe name of the Amira mesh file containing the undeformed geometry
datafe-function object for storing the deformation of type VariableSet::VariableSet

Definition at line 761 of file amirameshreader.hh.

◆ readGrid() [1/2]

template<class Grid , class Scalar , class ScalarEd = Scalar, class Deformation >
std::unique_ptr< Grid > Kaskade::AmiraMeshReader::readGrid ( std::string const &  gridfile,
Deformation const &  deformation,
int  initialGridSize = 0,
std::vector< int > *  boundaryIds = nullptr,
std::vector< Dune::FieldVector< ScalarEd, Grid::dimension > > *  edgeDisplacement = nullptr,
double  scale = 1.0 
)

function reading an Amira mesh file in ASCII format.

This function reads vertices, tetrahedra and, if defined, boundary triangles of an Amira mesh file into a grid and returns this grid.

Template Parameters
Gridthe type of grid to be constructed
Scalarscalar type of the vertex coordinates, i.e. how it is specified in the amira file, it is important to choose it correctly
Parameters
gridfilethe name of the Amira mesh file
deformationperforms a deformation/transformation to each vertex of the mesh to be read (typically a lambda function)
initialGridSizeoptional parameter for reserving memory for the grid
boundaryIdsif ids (e.g. membership to patches) for boundary segments are specified in the grid file, and this pointer is not null, then on return the pointed to vector will contain for each boundary segment (by its index, see Dune::Intersection) the corresponding id
edgeDisplacementif edges (by node indices) and their positions (of midpoints) are specified in the grid file and this pointer is not null, then on return the pointed to vector will contain for each edge (by its global index in the returned grid) the corresponding displacement
scalea factor with which the geometry is scaled. Use this to convert the geometry to standard SI units if it is given in the grid file in a different scale (e.g., millimeter). This is overwritten if the grid file contains a UnitLength parameter.
Returns
pointer on the created grid

Definition at line 296 of file amirameshreader.hh.

◆ readGrid() [2/2]

template<class Grid , class Scalar , class ScalarEd = Scalar>
std::unique_ptr< Grid > Kaskade::AmiraMeshReader::readGrid ( std::string const &  gridfile,
int  initialGridSize = 0,
std::vector< int > *  boundaryIds = nullptr,
std::vector< Dune::FieldVector< ScalarEd, Grid::dimension > > *  edgeDisplacement = nullptr,
double  scale = 1.0 
)

function reading an Amira mesh file in ASCII format.

This function reads vertices, tetrahedra and, if defined, boundary triangles of an Amira mesh file into a grid and returns this grid.

Template Parameters
Gridthe type of grid to be constructed
Scalarscalar type of the vertex coordinates, i.e. how it is specified in the amira file, it is important to choose it correctly
Parameters
gridfilethe name of the Amira mesh file
initialGridSizeoptional parameter for reserving memory for the grid
boundaryIdsif ids (e.g. membership to patches) for boundary segments are specified in the grid file, and this pointer is not null, then on return the pointed to vector will contain for each boundary segment (by its index, see Dune::Intersection) the corresponding id
edgeDisplacementif edges (by node indices) and their positions (of midpoints) are specified in the grid file and this pointer is not null, then on return the pointed to vector will contain for each edge (by its global index in the returned grid) the corresponding displacement
scalea factor with which the geometry is scaled. Use this to convert the geometry to standard SI units if it is given in the grid file in a different scale (e.g., millimeter). This is overwritten if the grid file contains a UnitLength parameter.
Returns
pointer on the created grid

Definition at line 261 of file amirameshreader.hh.