AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::quest::experimental::ShapeMesh Class Reference

Computational mesh and intermediate data typically used in shaping. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/main/src/axom/quest/ShapeMesh.hpp>

Public Types

using RuntimePolicy = axom::runtime_policy::Policy
 
using Point3DType = primal::Point< double, 3 >
 
using TetrahedronType = primal::Tetrahedron< double, 3 >
 
using HexahedronType = primal::Hexahedron< double, 3 >
 
using Plane3DType = axom::primal::Plane< double, 3 >
 
using BoundingBox3DType = primal::BoundingBox< double, 3 >
 

Public Member Functions

 ShapeMesh (RuntimePolicy runtimePolicy, int allocatorId, conduit::Node &bpMesh, const std::string &topoName={}, const std::string &matsetName={})
 Constructor with computational mesh in a conduit::Node. More...
 
RuntimePolicy getRuntimePolicy () const
 Runtime policy set in constructor. More...
 
int getAllocatorID () const
 Allocator id set in constructor. More...
 
sidre::GroupgetMeshAsSidre ()
 
conduit::Node * getMeshAsConduit ()
 Return computational mesh as a conduit::Node if it has that form, or nullptr otherwise. More...
 
int dimension () const
 Dimension of the mesh (2 or 3) More...
 
IndexType getCellCount () const
 Number of cells in mesh. More...
 
IndexType getVertexCount () const
 Number of vertices in mesh. More...
 
void setZeroThreshold (double threshold)
 Set the threshold to snapping vertex coordinates near. More...
 

Static Public Member Functions

static AXOM_HOST_DEVICE void hexToTets (const HexahedronType &hex, TetrahedronType *tets)
 Decompose a hexahedron into NUM_TETS_PER_HEX tetrahedra. More...
 

Static Public Attributes

static constexpr axom::IndexType NUM_TETS_PER_HEX = 18
 Number of tetrahedra that a hexahedron decomposes into. More...
 
static constexpr axom::IndexType NUM_VERTS_PER_CELL_3D = 8
 Number of vertices per cell. More...
 

Accessors to mesh-dependent intermediate data.

axom::ArrayView< const TetrahedronTypegetCellsAsTets ()
 Tetrahedral version of mesh cells with cell i having tet ids in [i*NUM_TETS_PER_HEX, (i+1)*NUM_TETS_PER_HEX). More...
 
axom::ArrayView< const HexahedronTypegetCellsAsHexes ()
 
axom::ArrayView< const double > getCellVolumes ()
 Get volume of mesh cells. More...
 
axom::ArrayView< const double > getTetVolumes ()
 Get volumes of tets in getCellsAsTets(). More...
 
axom::ArrayView< const double > getCellLengths ()
 Get characteristic lengths of mesh cells. More...
 
axom::ArrayView< const BoundingBox3DTypegetCellBoundingBoxes ()
 
axom::ArrayView< const IndexType, 2 > getCellNodeConnectivity ()
 
axom::ArrayView< const Point3DTypegetVertexPoints ()
 
const axom::StackArray< axom::ArrayView< const double >, 3 > & getVertexCoords3D () const
 
void precomputeMeshData ()
 Precompute (and cache) mesh-dependent intermediate data that may be used in clipping. More...
 
bool isValidForShaping (std::string &whyNot) const
 Check whether mesh meets requirements for shaping. More...
 
void setMatsetFromVolume (const std::string &materialName, const axom::ArrayView< double > &volumes, bool isFraction=false)
 Create (Blueprint) matset in the mesh for a material. More...
 
void setFreeVolumeFractions (const std::string &freeName)
 Compute and set the free volume fraction. More...
 

Detailed Description

Computational mesh and intermediate data typically used in shaping.

This wrapper class:

  • encapsulate mesh-dependent data
  • provide a common interface to mesh data regardless of the mesh format
  • avoid redundant work
  • provides some convenience tools typically used in shaping

The wrapped mesh must have an unstructured 3D hex topology. That is the only topology currently supported. It can be extended to support 2D.

TODO: Support MFEM mesh. First pass only supports blueprint.

Member Typedef Documentation

◆ RuntimePolicy

◆ Point3DType

◆ TetrahedronType

◆ HexahedronType

◆ Plane3DType

◆ BoundingBox3DType

Constructor & Destructor Documentation

◆ ShapeMesh()

axom::quest::experimental::ShapeMesh::ShapeMesh ( RuntimePolicy  runtimePolicy,
int  allocatorId,
conduit::Node &  bpMesh,
const std::string &  topoName = {},
const std::string &  matsetName = {} 
)

Constructor with computational mesh in a conduit::Node.

Parameters
[in]runtimePolicyThe run-time policy used for computations
[in]allocatorIdAllocator id for internal and scratch space. It should be compatible with runtimePolicy. If axom::INVALID_ALLOCATOR_ID is specified, it will be replaced with the default allocator for runtimePolicy. For good performance, especially on GPUs, fast memory pools should be used.
[in/out]bpMesh Blueprint mesh to shape into.
[in]topoNameName of the Blueprint topology. If empty, use the first topology in bpMesh.
[in]matsetNameName of the Blueprint material set. If empty, use the first material set in bpMesh.

Incoming mesh array data are assumed to be accessible by the runtime policy, or an error will result. (However the data need not correspond to the allocator id.)

Member Function Documentation

◆ getRuntimePolicy()

RuntimePolicy axom::quest::experimental::ShapeMesh::getRuntimePolicy ( ) const
inline

Runtime policy set in constructor.

◆ getAllocatorID()

int axom::quest::experimental::ShapeMesh::getAllocatorID ( ) const
inline

Allocator id set in constructor.

◆ getMeshAsSidre()

sidre::Group* axom::quest::experimental::ShapeMesh::getMeshAsSidre ( )
inline

◆ getMeshAsConduit()

conduit::Node* axom::quest::experimental::ShapeMesh::getMeshAsConduit ( )
inline

Return computational mesh as a conduit::Node if it has that form, or nullptr otherwise.

◆ dimension()

int axom::quest::experimental::ShapeMesh::dimension ( ) const
inline

Dimension of the mesh (2 or 3)

◆ getCellCount()

IndexType axom::quest::experimental::ShapeMesh::getCellCount ( ) const
inline

Number of cells in mesh.

◆ getVertexCount()

IndexType axom::quest::experimental::ShapeMesh::getVertexCount ( ) const
inline

Number of vertices in mesh.

◆ setZeroThreshold()

void axom::quest::experimental::ShapeMesh::setZeroThreshold ( double  threshold)
inline

Set the threshold to snapping vertex coordinates near.

◆ hexToTets()

AXOM_HOST_DEVICE void axom::quest::experimental::ShapeMesh::hexToTets ( const HexahedronType hex,
TetrahedronType tets 
)
inlinestatic

Decompose a hexahedron into NUM_TETS_PER_HEX tetrahedra.

Parameters
hex[in] The hexahedron
tets[out] Pointer to space for NUM_TETS_PER_HEX tetrahedra.

To avoid ambiguity due to the choice of 2 diagonals for dividing each hex face into 2 triangles, we introduce a face-centered point at the average of the face vertices and decompose the face into 4 triangles.

It is expected that this method will be used in long inner loops, so it is bare-bones for best performance. Caller must ensure tets points to at least NUM_TETS_PER_HEX objects. This method neither checks the pointer nor reallocates the space.

References AXOM_STATIC_ASSERT, axom::primal::Point< double, 3 >::midpoint(), NUM_TETS_PER_HEX, and axom::primal::Hexahedron< T, NDIMS >::triangulate().

◆ getCellsAsTets()

axom::ArrayView<const TetrahedronType> axom::quest::experimental::ShapeMesh::getCellsAsTets ( )

Tetrahedral version of mesh cells with cell i having tet ids in [i*NUM_TETS_PER_HEX, (i+1)*NUM_TETS_PER_HEX).

◆ getCellsAsHexes()

axom::ArrayView<const HexahedronType> axom::quest::experimental::ShapeMesh::getCellsAsHexes ( )

◆ getCellVolumes()

axom::ArrayView<const double> axom::quest::experimental::ShapeMesh::getCellVolumes ( )

Get volume of mesh cells.

◆ getTetVolumes()

axom::ArrayView<const double> axom::quest::experimental::ShapeMesh::getTetVolumes ( )

Get volumes of tets in getCellsAsTets().

◆ getCellLengths()

axom::ArrayView<const double> axom::quest::experimental::ShapeMesh::getCellLengths ( )

Get characteristic lengths of mesh cells.

◆ getCellBoundingBoxes()

axom::ArrayView<const BoundingBox3DType> axom::quest::experimental::ShapeMesh::getCellBoundingBoxes ( )

◆ getCellNodeConnectivity()

axom::ArrayView<const IndexType, 2> axom::quest::experimental::ShapeMesh::getCellNodeConnectivity ( )

◆ getVertexPoints()

axom::ArrayView<const Point3DType> axom::quest::experimental::ShapeMesh::getVertexPoints ( )

◆ getVertexCoords3D()

const axom::StackArray<axom::ArrayView<const double>, 3>& axom::quest::experimental::ShapeMesh::getVertexCoords3D ( ) const
inline

◆ precomputeMeshData()

void axom::quest::experimental::ShapeMesh::precomputeMeshData ( )

Precompute (and cache) mesh-dependent intermediate data that may be used in clipping.

Mesh-dependent data are computed as needed and cached, but this computes them all at once.

◆ isValidForShaping()

bool axom::quest::experimental::ShapeMesh::isValidForShaping ( std::string &  whyNot) const

Check whether mesh meets requirements for shaping.

Parameters
whyNot[out] Diagnostic message if mesh is invalid.

Requirements for the mesh are:

◆ setMatsetFromVolume()

void axom::quest::experimental::ShapeMesh::setMatsetFromVolume ( const std::string &  materialName,
const axom::ArrayView< double > &  volumes,
bool  isFraction = false 
)

Create (Blueprint) matset in the mesh for a material.

Parameters
materialName[in] Name of material
volumes[in] Cell-centered volumes
isFraction[in] Whether volumes is actually volume fractions.
Precondition
volumes.size() == getCellCount()
Mesh's matsets is multi-buffer, material-dominant form (see https://llnl-conduit.readthedocs.io/en/latest/blueprint_mesh.html#material-sets). Currently not supporting other matset forms.

◆ setFreeVolumeFractions()

void axom::quest::experimental::ShapeMesh::setFreeVolumeFractions ( const std::string &  freeName)

Compute and set the free volume fraction.

Parameters
freeName[in] Name of free material.

Member Data Documentation

◆ NUM_TETS_PER_HEX

constexpr axom::IndexType axom::quest::experimental::ShapeMesh::NUM_TETS_PER_HEX = 18
staticconstexpr

Number of tetrahedra that a hexahedron decomposes into.

See also
hexToTets()

◆ NUM_VERTS_PER_CELL_3D

constexpr axom::IndexType axom::quest::experimental::ShapeMesh::NUM_VERTS_PER_CELL_3D = 8
staticconstexpr

Number of vertices per cell.


The documentation for this class was generated from the following file: