WARPXM v1.10.0
|
Class used for generating mesh geometry concerns. More...
#include <wmunstructuredgeometry.h>
Class used for generating mesh geometry concerns.
Public Types | |
typedef std::pair< std::string, std::vector< int > > | nodeGroupPair_t |
typedef std::map< std::string, std::vector< int > > | nodeGroupMap_t |
Public Member Functions | |
WmUnstructuredGeometry (const WmUnstructuredPatch &patch) | |
Create unstructured geometry for a given patch. | |
~WmUnstructuredGeometry () | |
Destroy geometry. | |
void | generateGeometry (real *coordinates, int *connectivity, int *neighborhood, int *orientations) |
Generates geometry concerns. | |
void | addNodeGroup (const std::string name, const std::vector< int > &nodeIndexes) |
Add node group to geometry. | |
const real * | getCoordinates () const |
Access coordinates. | |
const int * | getConnectivity () const |
Access connectivity. | |
const int * | getNeighborhood () const |
Access neighborhood. | |
const int * | getOrientations () const |
Access orientations. | |
std::string | getNodeGroupOfNodes (const std::vector< int > &nodes) const |
Identify which node group a set of nodes belong to. | |
int | getFaceOrientation (const int elementIndex, const int faceIndex) const |
Get the orientation of a specific face with respect to neighbor. | |
real | getVolume (const int elementIndex) const |
Get the volume of an element. | |
real | getArea (const int elementIndex, const int faceIndex) const |
Get area of element face. | |
real | getElementWidth (const int elementIndex) const |
Get rough estimate of element's characteristic width. | |
const int * | getLocalNeighborhood (const int elementIndex) const |
Get list of element neighbors. | |
const std::type_info & | getType () const |
Get typeid of floats used to store coordinates/geometry stuff. | |
int | getPrimitiveID () const |
Get primitive ID for geometry. | |
int | getFacePrimitiveID () const |
Get primitive's face primitive ID. | |
const real * | getCentroid (const int elementIndex) const |
Get centroid of element. | |
const real * | getNorm (const int elementIndex, const int faceIndex, const int normType) const |
Get norm of element. | |
int | getNumElements () const |
Number of total elements in geometry. | |
int | getNumNodes () const |
Number of total nodes in geometry. | |
int | getNumDimsPerNode () const |
Number of dimensions used to store coordinates. | |
int | getNumDimsPerPrimitive () const |
Number of dimensions used to express primtive. | |
int | getNumNodesPerFace () const |
Number of nodes/vertexes on an element's face. | |
int | getNumNodesPerElement () const |
Number of nodes/vertexes on an element. | |
int | getNumFacesPerElement () const |
Number of faces on an element. | |
void | getFaceNodes (const int elementIndex, const int faceIndex, int *faceNodes) const |
Get the nodes for a given element's face. | |
void | getNodePositions (const int elementIndex, real *nodePositions) const |
Get the node/vertex positions for an element. | |
int | getNumTransformCoordinates () const |
Get number of coordinate transform coordinates for this primitive. | |
void | getTransformCoordinates (const int elementIndex, real tC[][3]) const |
Get the transform coordinates for an element. | |
void | getPositionInElement (const int elementIndex, const real normalizedPosition[3], real position[3]) const |
Generate real/mesh space position from normalized position for given element. | |
int | getJumpedElementIndex (const int elementIndex, const int neighborElementIndex, const int numJumps) const |
Get element index on other side of neighbor. | |
int | getOppositeFace (const int faceIndex) const |
Get face index opposite of a given face index. | |
int | getFaceIndex (const int elementIndex, const int neighborElementIndex) const |
Get the face index through which an neighbor element is found. | |
real | generateVolumeJacobian (const int elementIndex, const real normalizedPosition[3]) const |
Generate the volume Jacobian (ie Jacobian or determinant of the Jacobian matrix given appropriate dimensions, I think) at a given point within an element. | |
void | generateInverseJacobian (const int elementIndex, const real *normalizedPosition, real *inverseJacobian) const |
Generate the inverse Jacobian matrix for a given point within an element. | |
void | getCentralPositionInElement (const int elementIndex, const real normalizedPosition[3], real position[3]) const |
Get the real/mesh position within an element w.r.t the element centroid. | |
void | getFaceDistanceBetweenNeighborCentroids (const int fromElementIndex, const int toElementIndex, real dx[3]) const |
Get the distance between two elements through a face. | |
void | get_face_centroid (const int element_index, const int face_index, real x[3]) const |
Get the centroid of element's face. | |
bool | isEnclosedByElement (const int elementIndex, const real *x) const |
Check if the element encloses the given location. | |
int | getEnclosingElementIndex (const real *x) const |
Find the element enclosing the given location. | |
void | printElement (const int elementIndex) const |
Print element info to std::cout - used for DEBUG. | |
int | num_boundary_faces () const |
Returns the number of boundary faces associated with the edge of a domain (i.e. | |
void | reflect_centroid (const int element_index, const int face_index, real reflected_centroid[3]) const |
Static Public Member Functions | |
static int | getNumTransformCoordinates (const int primitiveID) |
Number of coordinate transform coordinates. | |
static void | getTransformCoordinates (const int primitiveID, const real *nodePositions, real tC[]) |
Convert node/vertex positions into coordinate transform coordinates. | |
Protected Attributes | |
const WmUnstructuredPatch & | _patch |
Patch associated with geometry. | |
std::string | _primitive |
Name of element primitive. | |
int | _primitiveID |
PrimitiveID. | |
int | _numElements |
Number of total elements in patch. | |
int | _numNodes |
Number of total nodes in patch. | |
int * | _connectivity |
Connectivity of elements [_numElements X _numNodesPerElement]. | |
int * | _neighborhood |
Neighborhood of elements [_numElements X _numFacesPerElement]. | |
int * | _orientations |
Orientations of faces [_numElements X _numFacesPerElement]. | |
real * | _coordinates |
Node/vertex positions [_numNodes X _numDimsPerNode]. | |
real * | _transformCoordinates |
Coordinate transform coordinates [_numElements X _numTransformCoordinates X 3]. | |
real * | _centroids |
Centroids of elements [_numElements X 3]. | |
real * | _norms |
Face normals for elements [_numElements X 3 X 3]. | |
real * | _volumes |
Volumes of elements [_numElements]. | |
real * | _areas |
Areas of element faces [_numElements X _numFacesPerElement]. | |
nodeGroupMap_t | _nodeGroups |
Node groups associated with geometry/patch. | |
int | _num_boundary_faces |
Number of boundary faces between patch and unknown where neighbor = -1. | |
int | _numDimsPerNode |
Number of dimensions used to store nodes/vertexes. | |
int | _numDimsPerPrimitive |
Number of dimensions for a given primitive. | |
int | _numTransformCoordinates |
Number of coordinate transform coordinates, usually the same as _numNodesPerElement. | |
int | _numNodesPerElement |
Number of nodes/vertexes for a given primitive. | |
int | _numFacesPerElement |
Number of faces on an element. | |
int | _numNodesPerFace |
Number of element nodes/vertexes that make up each face. | |
typedef std::map<std::string, std::vector<int> > WmUnstructuredGeometry::nodeGroupMap_t |
typedef std::pair<std::string, std::vector<int> > WmUnstructuredGeometry::nodeGroupPair_t |
WmUnstructuredGeometry::WmUnstructuredGeometry | ( | const WmUnstructuredPatch & | patch | ) |
Create unstructured geometry for a given patch.
WmUnstructuredGeometry::~WmUnstructuredGeometry | ( | ) |
Destroy geometry.
void WmUnstructuredGeometry::addNodeGroup | ( | const std::string | name, |
const std::vector< int > & | nodeIndexes | ||
) |
Add node group to geometry.
Node groups are used to identify faces (e.g. for use with boundary conditions)
Note: node group will be sorted in geometry class
name | Node group name |
nodeIndexes | List of nodes that make up node group |
void WmUnstructuredGeometry::generateGeometry | ( | real * | coordinates, |
int * | connectivity, | ||
int * | neighborhood, | ||
int * | orientations | ||
) |
Generates geometry concerns.
Includes: coordinate transforms, face normals, volumes, face areas and element centroids
coordinates | Coordinates for mesh nodes/vertexes |
connecitivity | Connectivity array for mesh elements |
neighborhood | Neighborhood array interlinking elements |
orientations | Orienatation array describing inter-element orientations |
void WmUnstructuredGeometry::generateInverseJacobian | ( | const int | elementIndex, |
const real * | normalizedPosition, | ||
real * | inverseJacobian | ||
) | const |
Generate the inverse Jacobian matrix for a given point within an element.
elementIndex | Element of interest |
normalizedPosition | Array [3] containing normalized position within element |
inverseJacobian | Array [9] to store inverse Jacobian matrix |
real WmUnstructuredGeometry::generateVolumeJacobian | ( | const int | elementIndex, |
const real | normalizedPosition[3] | ||
) | const |
Generate the volume Jacobian (ie Jacobian or determinant of the Jacobian matrix given appropriate dimensions, I think) at a given point within an element.
elementIndex | Element of interest |
normalizedPosition | Array [3] containing normalized position within element |
void WmUnstructuredGeometry::get_face_centroid | ( | const int | element_index, |
const int | face_index, | ||
real | x[3] | ||
) | const |
Get the centroid of element's face.
element_index | |
face_index | |
x | Array [3] to store position of face centroid |
|
inline |
Get area of element face.
elementIndex | Element of interest |
faceIndex | Element face of interest |
void WmUnstructuredGeometry::getCentralPositionInElement | ( | const int | elementIndex, |
const real | normalizedPosition[3], | ||
real | position[3] | ||
) | const |
Get the real/mesh position within an element w.r.t the element centroid.
elementIndex | Element of interest |
normalizedPosition | Array [3] containing normalized position within element |
position | Array [3] to store central position |
|
inline |
Get centroid of element.
Warning: no range checking!
elementIndex | Element of interest |
|
inline |
Access connectivity.
|
inline |
Access coordinates.
real WmUnstructuredGeometry::getElementWidth | ( | const int | elementIndex | ) | const |
Get rough estimate of element's characteristic width.
elementIndex | Element of interest |
int WmUnstructuredGeometry::getEnclosingElementIndex | ( | const real * | x | ) | const |
Find the element enclosing the given location.
Note that this call is going to run through all of the elements and compare each one Therefore this is a very slow function and should be called only a few times at most per sim
Note that this function only works if 1D) Line is along x 2D) Triangle is in xy plane 3D) Not yet setup
x | Array[3] of location |
void WmUnstructuredGeometry::getFaceDistanceBetweenNeighborCentroids | ( | const int | fromElementIndex, |
const int | toElementIndex, | ||
real | dx[3] | ||
) | const |
Get the distance between two elements through a face.
Note: This call is required for periodic boundary conditions where two elements are on opposite sides of a mesh but require 'dx' for reconstruction purposes Note: This is a slow call compared to subracting one centroid from another, be sure you need it before using it
dx = x_toIndex - x_fromIndex
fromElementIndex | Element to start from |
toElementIndex | Element to end at |
dx | Array [3] to store dx between elements through face |
int WmUnstructuredGeometry::getFaceIndex | ( | const int | elementIndex, |
const int | neighborElementIndex | ||
) | const |
Get the face index through which an neighbor element is found.
elementIndex | Element of interest |
neighborElementIndex | Neighbor element on other side of face |
void WmUnstructuredGeometry::getFaceNodes | ( | const int | elementIndex, |
const int | faceIndex, | ||
int * | faceNodes | ||
) | const |
Get the nodes for a given element's face.
elementIndex | Element of interest |
faceIndex | Element face of interest |
faceNodes | Array [_numNodesPerFace] to store node/vertex indexes |
|
inline |
Get the orientation of a specific face with respect to neighbor.
elementIndex | Element of interest |
faceIndex | Face index through which neighbor is oriented |
int WmUnstructuredGeometry::getFacePrimitiveID | ( | ) | const |
Get primitive's face primitive ID.
Will return one of WMPRIMITIVE_LINE, WMPRIMITIVE_TRIANGLE, WMPRIMITIVE_QUADRILATERAL, WMPRIMITIVE_TETRAHEDRON, WMPRIMITIVE_HEXAHEDRON, or WMPRIMITIVE_POINT
int WmUnstructuredGeometry::getJumpedElementIndex | ( | const int | elementIndex, |
const int | neighborElementIndex, | ||
const int | numJumps | ||
) | const |
Get element index on other side of neighbor.
I think this is used for moving through ghost cells in boundary conditions, but is... idiotic...
Note: Recursive call Note: Only works for lines/quad/hexahedrons
TODO: This function needs to be removed/phased out
elementIndex | Element of interest |
neighborElementIndex | Neighbor element to jump over |
numJumps | Number of times to jump across neighbor |
|
inline |
Get list of element neighbors.
Warning: no range checking!
elementIndex | Element of interest |
|
inline |
Access neighborhood.
std::string WmUnstructuredGeometry::getNodeGroupOfNodes | ( | const std::vector< int > & | nodes | ) | const |
Identify which node group a set of nodes belong to.
Used for identifying faces contained by node group
nodes | List of nodes |
void WmUnstructuredGeometry::getNodePositions | ( | const int | elementIndex, |
real * | nodePositions | ||
) | const |
Get the node/vertex positions for an element.
elementIndex | Element of interest |
nodePositions | Array [3 X numNodesPerElement] to store node/vertex positions |
|
inline |
Get norm of element.
Warning: no range checking!
norm type 0: face normal norm type 1: first transverse vector norm type 2: second transverse vector
elementIndex | Element of interest |
faceIndex | Element of interest |
normType | Norm type of interese (see above) |
|
inline |
Number of dimensions used to store coordinates.
|
inline |
Number of dimensions used to express primtive.
1D: Line = 1 2D: Triangle, Quad = 2 3D: Tetrahedron, Hexahedron = 3
|
inline |
Number of total elements in geometry.
|
inline |
Number of faces on an element.
|
inline |
Number of total nodes in geometry.
|
inline |
Number of nodes/vertexes on an element.
|
inline |
Number of nodes/vertexes on an element's face.
|
inline |
Get number of coordinate transform coordinates for this primitive.
Note: Coordinate transform converts isoparametric primitive (normalized space) to geometric primitive (real/mesh space)
|
static |
Number of coordinate transform coordinates.
Note: Coordinate transform converts isoparametric primitive (normalized space) to geometric primitive (real/mesh space)
Note: Static call
primitiveID | Primitive of interest |
int WmUnstructuredGeometry::getOppositeFace | ( | const int | faceIndex | ) | const |
Get face index opposite of a given face index.
Another ghost cell function that shouldn't exist
Note: Static call Note: Only works for lines/quad/hexahedrons
TODO: This function needs to be removed/phased out
faceIndex | Face index |
neighborElementIndex | Neighbor element to jump over |
numJumps | Number of times to jump across neighbor |
|
inline |
Access orientations.
void WmUnstructuredGeometry::getPositionInElement | ( | const int | elementIndex, |
const real | normalizedPosition[3], | ||
real | position[3] | ||
) | const |
Generate real/mesh space position from normalized position for given element.
elementIndex | Element of interest |
normalizedPosition | Array [3] of position in isoparametric space (normalized space) |
position | Array [3] of position in real/mesh space |
|
inline |
Get primitive ID for geometry.
Will return one of WMPRIMITIVE_LINE, WMPRIMITIVE_TRIANGLE, WMPRIMITIVE_QUADRILATERAL, WMPRIMITIVE_TETRAHEDRON, WMPRIMITIVE_HEXAHEDRON, or WMPRIMITIVE_POINT
void WmUnstructuredGeometry::getTransformCoordinates | ( | const int | elementIndex, |
real | tC[][3] | ||
) | const |
Get the transform coordinates for an element.
elementIndex | Element of interest |
tC | Array [numTransformCoordinates][3] to store transformCoordinates |
|
static |
Convert node/vertex positions into coordinate transform coordinates.
Note: Coordinate transform converts isoparametric primitive (normalized space) to geometric primitive (real/mesh space)
Note: Static call
primitiveID | Primitive of interest |
nodePositions | Node positions making up element |
tC | Array [_numTransformCoordinates][3] containing coordinate transform coordinates for element |
|
inline |
Get typeid of floats used to store coordinates/geometry stuff.
|
inline |
Get the volume of an element.
elementIndex | Element of interest |
bool WmUnstructuredGeometry::isEnclosedByElement | ( | const int | elementIndex, |
const real * | x | ||
) | const |
Check if the element encloses the given location.
elementIndex | Element to test |
x | Array[3] of location |
|
inline |
Returns the number of boundary faces associated with the edge of a domain (i.e.
neighbor = -1)
void WmUnstructuredGeometry::printElement | ( | const int | elementIndex | ) | const |
Print element info to std::cout - used for DEBUG.
elementIndex | Element of interest |
void WmUnstructuredGeometry::reflect_centroid | ( | const int | element_index, |
const int | face_index, | ||
real | reflected_centroid[3] | ||
) | const |
|
protected |
Areas of element faces [_numElements X _numFacesPerElement].
|
protected |
Centroids of elements [_numElements X 3].
|
protected |
Connectivity of elements [_numElements X _numNodesPerElement].
|
protected |
Node/vertex positions [_numNodes X _numDimsPerNode].
|
protected |
Neighborhood of elements [_numElements X _numFacesPerElement].
|
protected |
Node groups associated with geometry/patch.
|
protected |
Face normals for elements [_numElements X 3 X 3].
|
protected |
Number of boundary faces between patch and unknown where neighbor = -1.
|
protected |
Number of dimensions used to store nodes/vertexes.
|
protected |
Number of dimensions for a given primitive.
|
protected |
Number of total elements in patch.
|
protected |
Number of faces on an element.
|
protected |
Number of total nodes in patch.
|
protected |
Number of nodes/vertexes for a given primitive.
|
protected |
Number of element nodes/vertexes that make up each face.
|
protected |
Number of coordinate transform coordinates, usually the same as _numNodesPerElement.
|
protected |
Orientations of faces [_numElements X _numFacesPerElement].
|
protected |
Patch associated with geometry.
|
protected |
Name of element primitive.
|
protected |
PrimitiveID.
Is either: WMPRIMITIVE_LINE, WMPRIMITIVE_TRIANGLE, WMPRIMITIVE_QUADRILATERAL, WMPRIMITIVE_TETRAHEDRON, WMPRIMITIVE_HEXAHEDRON, or WMPRIMITIVE_POINT
|
protected |
Coordinate transform coordinates [_numElements X _numTransformCoordinates X 3].
|
protected |
Volumes of elements [_numElements].