AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Represents an hexahedral geometric shape defined by eight points. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/primal/geometry/Hexahedron.hpp>
Public Types | |
enum | { NUM_HEX_VERTS = 8 , NUM_TRIANGULATE = 24 } |
using | PointType = Point< T, NDIMS > |
using | VectorType = Vector< T, NDIMS > |
using | TetrahedronType = Tetrahedron< T, NDIMS > |
using | NumArrayType = NumericArray< T, NDIMS > |
Public Member Functions | |
Hexahedron ()=default | |
Default constructor. Creates a degenerate hexahedron. More... | |
AXOM_HOST_DEVICE | Hexahedron (const PointType &p, const PointType &q, const PointType &r, const PointType &s, const PointType &t, const PointType &u, const PointType &v, const PointType &w) |
Creates an hexahedron from the 8 points p,q,r,s,t,u,v,w. More... | |
AXOM_HOST_DEVICE | Hexahedron (const PointType *pts) |
Hexahedron constructor from an array of Points. More... | |
AXOM_HOST_DEVICE | Hexahedron (const axom::ArrayView< PointType > pts) |
Hexahedron constructor from an Array of Points. More... | |
AXOM_HOST_DEVICE | Hexahedron (std::initializer_list< PointType > pts) |
Hexahedron constructor from an initializer list of Points. More... | |
AXOM_HOST_DEVICE PointType & | operator[] (int idx) |
Index operator to get the i^th vertex. More... | |
AXOM_HOST_DEVICE const PointType & | operator[] (int idx) const |
Index operator to get the i^th vertex. More... | |
AXOM_HOST_DEVICE PointType | vertexMean () const |
Computes the average of the hexahedron's vertex positions. More... | |
AXOM_HOST_DEVICE double | signedVolume () const |
Finds the signed volume of the hexahedron. More... | |
AXOM_HOST_DEVICE double | volume () const |
Returns the absolute (unsigned) volume of the hexahedron. More... | |
AXOM_HOST_DEVICE void | triangulate (axom::StackArray< TetrahedronType, NUM_TRIANGULATE > &tets) |
Method to decompose a Hexahedron into 24 Tetrahedrons. Each Tetrahedron consists of 4 points: (1) The mean of all Hexahedron points (2,3) Two adjacent vertices on a Hexahedron face (4) The mean of the current Hexahedron face. More... | |
AXOM_HOST_DEVICE bool | equals (const Hexahedron &other, double eps=1.e-24) const |
Test if this Hexahedron is equal to another, within a tolerance. More... | |
std::ostream & | print (std::ostream &os) const |
Simple formatted print of an hexahedron instance. More... | |
Represents an hexahedral geometric shape defined by eight points.
T | the coordinate type, e.g., double, float, etc. |
NDIMS | the number of spatial dimensions |
There are eight vertices in the hexahedron, labelled P through W as the constructor's arguments. They are accessible using the square-brackets operator, with P being index 0, Q index 1, through W as index 7.
Here's a diagram showing a cube with the labeled vertices.
* * S +---------+ R +y * |\ |\ * | \ | \ ^ * | W + --------+ V | * P +---|-----+ Q | | * \ | \ | -----> +x * \ | \ | \ * \ | \ | \ * T +----------+ U > * +z *
using axom::primal::Hexahedron< T, NDIMS >::PointType = Point<T, NDIMS> |
using axom::primal::Hexahedron< T, NDIMS >::VectorType = Vector<T, NDIMS> |
using axom::primal::Hexahedron< T, NDIMS >::TetrahedronType = Tetrahedron<T, NDIMS> |
using axom::primal::Hexahedron< T, NDIMS >::NumArrayType = NumericArray<T, NDIMS> |
|
default |
Default constructor. Creates a degenerate hexahedron.
|
inline |
Creates an hexahedron from the 8 points p,q,r,s,t,u,v,w.
[in] | Point | corresponding to vertex p of the hexahedron. |
[in] | Point | corresponding to vertex q of the hexahedron. |
[in] | Point | corresponding to vertex r of the hexahedron. |
[in] | Point | corresponding to vertex s of the hexahedron. |
[in] | Point | corresponding to vertex t of the hexahedron. |
[in] | Point | corresponding to vertex u of the hexahedron. |
[in] | Point | corresponding to vertex v of the hexahedron. |
[in] | Point | corresponding to vertex w of the hexahedron. |
|
inlineexplicit |
Hexahedron constructor from an array of Points.
[in] | pts | An array containing at least 8 Points. |
References axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS.
|
inlineexplicit |
Hexahedron constructor from an Array of Points.
[in] | pts | An ArrayView containing 8 Points. |
References axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS, axom::ArrayView< T, DIM, SPACE >::size(), and SLIC_ASSERT.
|
inlineexplicit |
Hexahedron constructor from an initializer list of Points.
[in] | pts | an initializer list containing 8 Points |
References axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS, and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS, and SLIC_ASSERT.
|
inline |
Index operator to get the i^th vertex.
idx | The index of the desired vertex |
References axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS, and SLIC_ASSERT.
|
inline |
Computes the average of the hexahedron's vertex positions.
References axom::primal::Point< T, NDIMS >::array(), and axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS.
|
inline |
Finds the signed volume of the hexahedron.
Uses algorithm in Grandy, J. Efficient computation of volume of hexahedral cells. United States: N. p., 1997. Web. doi:10.2172/632793.
References axom::primal::Vector< T, NDIMS >::scalar_triple_product().
|
inline |
Returns the absolute (unsigned) volume of the hexahedron.
References axom::utilities::abs(), and axom::primal::Hexahedron< T, NDIMS >::signedVolume().
|
inline |
Method to decompose a Hexahedron into 24 Tetrahedrons. Each Tetrahedron consists of 4 points: (1) The mean of all Hexahedron points (2,3) Two adjacent vertices on a Hexahedron face (4) The mean of the current Hexahedron face.
tets | [out] The tetrahedrons |
References axom::primal::Point< T, NDIMS >::midpoint(), and axom::primal::Hexahedron< T, NDIMS >::vertexMean().
|
inline |
Test if this Hexahedron is equal to another, within a tolerance.
References axom::primal::Hexahedron< T, NDIMS >::NUM_HEX_VERTS, and axom::primal::squared_distance().
|
inline |
Simple formatted print of an hexahedron instance.
os | The output stream to write to |