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

A class to accelerate Point-In-Cell queries on a computational mesh. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/v0.5.0/src/axom/quest/PointInCell.hpp>

Public Types

using MeshTraits = PointInCellTraits< mesh_tag >
 
using MeshType = typename MeshTraits::MeshType
 
using IndexType = typename MeshTraits::IndexType
 
using MeshWrapperType = detail::PointInCellMeshWrapper< mesh_tag >
 
using PointFinder2D = detail::PointFinder< 2, mesh_tag >
 
using PointFinder3D = detail::PointFinder< 3, mesh_tag >
 

Public Member Functions

 PointInCell (MeshType *mesh, int *resolution=nullptr, double bboxTolerance=1e-8)
 
 ~PointInCell ()
 
IndexType locatePoint (const double *pos, double *isopar=nullptr) const
 
bool locatePointInCell (IndexType cellIdx, const double *pos, double *isopar) const
 
void reconstructPoint (IndexType cellIdx, const double *isopar, double *pos) const
 
int meshDimension () const
 

Detailed Description

template<typename mesh_tag>
class axom::quest::PointInCell< mesh_tag >

A class to accelerate Point-In-Cell queries on a computational mesh.

A point in cell query over a computational mesh determines if a given point is contained in one of its cells. If so, it returns the index of the cell containing the point as well as the isoparametric coordinates of the point within the cell.

Template Parameters
mesh_tagA tag type (e.g. an empty struct) for the underlying computational mesh. There must also be corresponding template specializations of PointInCellMeshWrapper<mesh_tag> and PointInCellTraits<mesh_tag> for the provided mesh_tag in the axom::quest::detail namespace
Note
This class was designed to support point in cell queries against 2D or 3D computational meshes. The queries to the mesh are wrapped in a PointInCellMeshWrapper class templated on a mesh_tag type. To extend this design, one must create a new mesh tag (e.g.. an empty struct custom_mesh_tag) and add custom template specializations of PointInCellMeshWrapper and PointInCellTraits for this tag in the axom::quest namespace.
See also
PointInCellMeshWrapper_mfem.hpp for a specialized implementation for mfem meshes of arbitrary order. It uses the mesh_tag quest_point_in_cell_mfem_tag

Member Typedef Documentation

◆ MeshTraits

template<typename mesh_tag >
using axom::quest::PointInCell< mesh_tag >::MeshTraits = PointInCellTraits<mesh_tag>

◆ MeshType

template<typename mesh_tag >
using axom::quest::PointInCell< mesh_tag >::MeshType = typename MeshTraits::MeshType

◆ IndexType

template<typename mesh_tag >
using axom::quest::PointInCell< mesh_tag >::IndexType = typename MeshTraits::IndexType

◆ MeshWrapperType

template<typename mesh_tag >
using axom::quest::PointInCell< mesh_tag >::MeshWrapperType = detail::PointInCellMeshWrapper<mesh_tag>

◆ PointFinder2D

template<typename mesh_tag >
using axom::quest::PointInCell< mesh_tag >::PointFinder2D = detail::PointFinder<2, mesh_tag>

◆ PointFinder3D

template<typename mesh_tag >
using axom::quest::PointInCell< mesh_tag >::PointFinder3D = detail::PointFinder<3, mesh_tag>

Constructor & Destructor Documentation

◆ PointInCell()

template<typename mesh_tag >
axom::quest::PointInCell< mesh_tag >::PointInCell ( MeshType mesh,
int *  resolution = nullptr,
double  bboxTolerance = 1e-8 
)
inline

Construct a point in cell query structure over a computational mesh

Parameters
[in]meshA pointer to the computational mesh
[in]resolutionGrid resolution for the spatial index. Default: NULL
[in]bboxToleranceA tolerance factor by which to expand the bounding boxes. Default: 1e-8
Note
The bboxTolerance should be a small positive number. It helps avoid numerical issues in the bounding box containment queries by slightly expanding the cell bounding boxes.
If the resolution is not provided, a heuristic based on the number of cells in the mesh is used to set the resolution.
See also
ImplicitGrid
Precondition
mesh must not be a NULL pointer
If resolution is not NULL, it must have space for at least meshDimension() entries.

References SLIC_ASSERT, and SLIC_ERROR.

◆ ~PointInCell()

template<typename mesh_tag >
axom::quest::PointInCell< mesh_tag >::~PointInCell ( )
inline

Destructor

Member Function Documentation

◆ locatePoint()

template<typename mesh_tag >
IndexType axom::quest::PointInCell< mesh_tag >::locatePoint ( const double *  pos,
double *  isopar = nullptr 
) const
inline

Attempt to find the index of the mesh cell containing the given point.

If found, and isopar is not NULL, isopar contains the isoparametric coordinates the point within this cell.

Parameters
[in]posThe coordinates of the query point in space
[out]isoparThe isoparametric coordinates of the query pt. Only valid when a cell is found.
Returns
The index of the mesh cell containing the query point. If no cell is found, returns the special value MeshTraits::NO_CELL. Otherwise, the result will be between 0 and N, where N is the number of cells in the mesh.
Precondition
pos is a non-null array with at least meshDimension() coords
When not NULL, isopar has space for meshDimension() coords

References SLIC_ASSERT, and SLIC_ERROR.

◆ locatePointInCell()

template<typename mesh_tag >
bool axom::quest::PointInCell< mesh_tag >::locatePointInCell ( IndexType  cellIdx,
const double *  pos,
double *  isopar 
) const
inline

Determine if a query point is located within a specified mesh cell

Parameters
[in]cellIdxThe index of the cell within the mesh
[in]posThe coordinates of the query point in space
[out]isoparThe isoparametric coordinates of the point within cell cellIdx. Only valid when the return value is true
Returns
True, if the query point is located within the specified cell
Precondition
pos is not NULL and has meshDimension() entries
isopar is not NULL and has space for meshDimension() entries

◆ reconstructPoint()

template<typename mesh_tag >
void axom::quest::PointInCell< mesh_tag >::reconstructPoint ( IndexType  cellIdx,
const double *  isopar,
double *  pos 
) const
inline

Evaluate the position of a point within a mesh cell at the given isoparametric coordinates.

Parameters
[in]cellIdxThe index of the cell within the mesh
[in[isopar The isoparametric coordinates at which to evaluate
[out]posThe computed coordinates of the evaluated point

◆ meshDimension()

template<typename mesh_tag >
int axom::quest::PointInCell< mesh_tag >::meshDimension ( ) const
inline

Returns the dimension of the mesh


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