AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::quest::SignedDistance< NDIMS, ExecSpace > Class Template Reference

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

Public Types

using PointType = axom::primal::Point< double, NDIMS >
 
using VectorType = axom::primal::Vector< double, NDIMS >
 
using TriangleType = axom::primal::Triangle< double, NDIMS >
 
using BoxType = axom::primal::BoundingBox< double, NDIMS >
 
using ZipPoint = axom::primal::ZipIndexable< PointType >
 
using BVHTreeType = axom::spin::BVH< NDIMS, ExecSpace >
 

Public Member Functions

 SignedDistance (const mint::Mesh *surfaceMesh, bool isWatertight, bool computeSign=true, int allocatorID=axom::execution_space< ExecSpace >::allocatorID())
 Creates a SignedDistance instance for queries on the given mesh. More...
 
bool setMesh (const mint::Mesh *surfaceMesh, int allocatorID=axom::execution_space< ExecSpace >::allocatorID())
 Reinitializes a SignedDistance instance with a new surface mesh. More...
 
double computeDistance (double x, double y, double z=0.0)
 Computes the distance of the given point to the input surface mesh. More...
 
double computeDistance (const PointType &queryPnt) const
 Computes the distance of the given point to the surface mesh. More...
 
double computeDistance (const PointType &queryPnt, PointType &closestPnt, VectorType &surfaceNormal) const
 Computes the distance of the given point to the surface mesh This overload also returns the computed closest point on the surface to the query point and the surface normal at that point. More...
 
template<typename PointIndexable >
void computeDistances (int npts, PointIndexable queryPts, double *outSgnDist, PointType *outClosestPts=nullptr, VectorType *outNormals=nullptr) const
 Computes the distances of a set of points to the surface mesh. Optionally also returns the computed closest points on the surface to each query point and the surface normals at those points. More...
 
const BVHTreeTypegetBVHTree () const
 Returns a const reference to the underlying bucket tree. More...
 

Member Typedef Documentation

◆ PointType

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::SignedDistance< NDIMS, ExecSpace >::PointType = axom::primal::Point<double, NDIMS>

◆ VectorType

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::SignedDistance< NDIMS, ExecSpace >::VectorType = axom::primal::Vector<double, NDIMS>

◆ TriangleType

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::SignedDistance< NDIMS, ExecSpace >::TriangleType = axom::primal::Triangle<double, NDIMS>

◆ BoxType

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::SignedDistance< NDIMS, ExecSpace >::BoxType = axom::primal::BoundingBox<double, NDIMS>

◆ ZipPoint

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::SignedDistance< NDIMS, ExecSpace >::ZipPoint = axom::primal::ZipIndexable<PointType>

◆ BVHTreeType

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::SignedDistance< NDIMS, ExecSpace >::BVHTreeType = axom::spin::BVH<NDIMS, ExecSpace>

Constructor & Destructor Documentation

◆ SignedDistance()

template<int NDIMS, typename ExecSpace >
axom::quest::SignedDistance< NDIMS, ExecSpace >::SignedDistance ( const mint::Mesh surfaceMesh,
bool  isWatertight,
bool  computeSign = true,
int  allocatorID = axom::execution_space<ExecSpace>::allocatorID() 
)

Creates a SignedDistance instance for queries on the given mesh.

Parameters
[in]surfaceMeshuser-supplied surface mesh.
[in]isWatertightindicates if the surface mesh is closed.
[in]computeSignindicates if distance queries should compute signs (optional).
[in]allocatorIDthe allocator to create the underlying BVH with (optional).
Note
computeSign defaults to true when not specified.
The given surface mesh must be allocated in a memory space compatible with the execution space specified in the SignedDistance instantiation.
The given allocatorID must be compatible with the execution space specified in the SignedDistance instantiation. By default, a compatible allocator ID used if allocatorID is not specified.
Precondition
surfaceMesh != nullptr

References AXOM_UNUSED_VAR, axom::quest::SignedDistance< NDIMS, ExecSpace >::setMesh(), and SLIC_ASSERT.

Member Function Documentation

◆ setMesh()

template<int NDIMS, typename ExecSpace >
bool axom::quest::SignedDistance< NDIMS, ExecSpace >::setMesh ( const mint::Mesh surfaceMesh,
int  allocatorID = axom::execution_space<ExecSpace>::allocatorID() 
)

Reinitializes a SignedDistance instance with a new surface mesh.

Parameters
[in]surfaceMeshuser-supplied surface mesh.
[in]allocatorIDthe allocator to create the underlying BVH with (optional).
Note
The given surface mesh must be allocated in a memory space compatible with the execution space specified in the SignedDistance instantiation.
The given allocatorID must be compatible with the execution space specified in the SignedDistance instantiation. By default, a compatible allocator ID used if allocatorID is not specified.
Returns
status true if reinitialization was successful.
Precondition
surfaceMesh != nullptr

References axom::primal::BoundingBox< T, NDIMS >::addPoint(), AXOM_ANNOTATE_SCOPE, AXOM_LAMBDA, AXOM_UNUSED_VAR, axom::spin::BVH_BUILD_OK, axom::deallocate(), axom::mint::Mesh::getNumberOfCells(), axom::utilities::max(), axom::quest::detail::SD_GetUcdMeshData(), SLIC_ASSERT, and SLIC_CHECK_MSG.

◆ computeDistance() [1/3]

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
double axom::quest::SignedDistance< NDIMS, ExecSpace >::computeDistance ( double  x,
double  y,
double  z = 0.0 
)
inline

Computes the distance of the given point to the input surface mesh.

Parameters
[in]xx-coordinate of the query point
[in]yy-coordinate of the query point
[in]zz-coordinate of the query point
Note
When the input is not a closed surface mesh, the assumption is that the surface mesh divides the computational mesh domain into two regions. Hence, the surface mesh has to span the entire domain of interest, e.g., the computational mesh at which the signed distance field is evaluated, along some plane.
Warning
The sign of the distance from a given query point is determined by a pseudo-normal which is computed at the closest point on the surface mesh. For a non-watertight mesh, the sign of the distance is not defined everywhere. Specifically, the sign is ambiguous for all points for which a normal projection onto the surface does not exist.
Returns
minimum signed distance of the query point to the surface.

◆ computeDistance() [2/3]

template<int NDIMS, typename ExecSpace >
double axom::quest::SignedDistance< NDIMS, ExecSpace >::computeDistance ( const PointType queryPnt) const
inline

Computes the distance of the given point to the surface mesh.

Parameters
[in]queryPntuser-supplied point.
Note
When the input is not a closed surface mesh, the assumption is that the surface mesh divides the computational mesh domain into two regions. Hence, the surface mesh has to span the entire domain of interest, e.g., the computational mesh at which the signed distance field is evaluated, along some plane.
Warning
The sign of the distance from a given query point is determined by a pseudo-normal which is computed at the closest point on the surface mesh. For a non-watertight mesh, the sign of the distance is not defined everywhere. Specifically, the sign is ambiguous for all points for which a normal projection onto the surface does not exist.
Returns
the signed minimum distance to the surface mesh.

◆ computeDistance() [3/3]

template<int NDIMS, typename ExecSpace >
double axom::quest::SignedDistance< NDIMS, ExecSpace >::computeDistance ( const PointType queryPnt,
PointType closestPnt,
VectorType surfaceNormal 
) const
inline

Computes the distance of the given point to the surface mesh This overload also returns the computed closest point on the surface to the query point and the surface normal at that point.

Parameters
[in]queryPntuser-supplied point.
[out]closestPntthe closest point on the surface to queryPnt
[out]surfaceNormalthe surface normal of closestPt
Note
When the underlying surface mesh is not watertight, the assumption is that the surface mesh divides the computational mesh domain into two regions. Hence, the surface mesh has to span the entire domain of interest, e.g., the computational mesh at which the signed distance field is evaluated, along some plane.
Warning
The sign of the distance from a given query point is determined by a pseudo-normal which is computed at the closest point on the surface mesh. For a non-watertight mesh, the sign of the distance is not defined everywhere. Specifically, the sign is ambiguous for all points for which a normal projection onto the surface does not exist.
Returns
the signed minimum distance to the surface mesh.

◆ computeDistances()

template<int NDIMS, typename ExecSpace >
template<typename PointIndexable >
void axom::quest::SignedDistance< NDIMS, ExecSpace >::computeDistances ( int  npts,
PointIndexable  queryPts,
double *  outSgnDist,
PointType outClosestPts = nullptr,
VectorType outNormals = nullptr 
) const
inline

Computes the distances of a set of points to the surface mesh. Optionally also returns the computed closest points on the surface to each query point and the surface normals at those points.

Parameters
[in]nptsnumber of points to query
[in]queryPntuser-supplied point indexable type. This can be a pointer-to-array, or a ZipIndexable<PointType>.
[out]outSgnDistarray to fill with corresponding signed distances for query points
[out]outClosestPtsarray to fill with closest points on the mesh. Optional.
[out]outNormalsarray to fill with surface normals associated with closest points on the mesh. Optional.
Note
When the input is not a closed surface mesh, the assumption is that the surface mesh divides the computational mesh domain into two regions. Hence, the surface mesh has to span the entire domain of interest, e.g., the computational mesh at which the signed distance field is evaluated, along some plane.
Warning
The sign of the distance from a given query point is determined by a pseudo-normal which is computed at the closest point on the surface mesh. For a non-watertight mesh, the sign of the distance is not defined everywhere. Specifically, the sign is ambiguous for all points for which a normal projection onto the surface does not exist.
Returns
the signed minimum distance to the surface mesh.
Precondition
outSgnDist != nullptr

References AXOM_ANNOTATE_SCOPE, AXOM_LAMBDA, AXOM_UNUSED_VAR, axom::primal::BoundingBox< T, NDIMS >::contains(), axom::quest::detail::SD_GetUcdMeshData(), SLIC_ASSERT, SLIC_CHECK_MSG, axom::primal::squared_distance(), and axom::primal::Vector< T, NDIMS >::unitVector().

◆ getBVHTree()

template<int NDIMS, typename ExecSpace = axom::SEQ_EXEC>
const BVHTreeType& axom::quest::SignedDistance< NDIMS, ExecSpace >::getBVHTree ( ) const
inline

Returns a const reference to the underlying bucket tree.

Returns
ptr pointer to the underlying bucket tree

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