AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::quest::PointInCell< mesh_tag, ExecSpace > 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/develop/src/axom/quest/PointInCell.hpp>

Public Types

using Point2DType = primal::Point< double, 2 >
 
using Point3DType = primal::Point< double, 3 >
 
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, ExecSpace >
 
using PointFinder3D = detail::PointFinder< 3, mesh_tag, ExecSpace >
 

Public Member Functions

 PointInCell (MeshType *mesh, int *resolution=nullptr, double bboxTolerance=1e-8, int allocatorID=axom::execution_space< ExecSpace >::allocatorID())
 
 ~PointInCell ()
 
IndexType locatePoint (const double *pos, double *isopar=nullptr) const
 
void locatePoints (axom::ArrayView< const Point2DType > pts, IndexType *outCellIds, Point2DType *outIsopar=nullptr)
 
void locatePoints (axom::ArrayView< const Point3DType > pts, IndexType *outCellIds, Point3DType *outIsopar=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
 
void setPrintLevel (int level)
 Sets the print verbosity level for the point in cell query. More...
 
void setInitialGuessType (int guessType)
 Sets the initial guess type for the element-based point in cell query. More...
 
void setInitialGridOrder (int order)
 Sets the grid size for the initial guess in the element-based point in cell query. More...
 
void setSolverProjectionType (int type)
 Sets the solution strategy for the element-based point in cell query. More...
 

Detailed Description

template<typename mesh_tag, typename ExecSpace = axom::SEQ_EXEC>
class axom::quest::PointInCell< mesh_tag, ExecSpace >

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

◆ Point2DType

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::PointInCell< mesh_tag, ExecSpace >::Point2DType = primal::Point<double, 2>

◆ Point3DType

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
using axom::quest::PointInCell< mesh_tag, ExecSpace >::Point3DType = primal::Point<double, 3>

◆ MeshTraits

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

◆ MeshType

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

◆ IndexType

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

◆ MeshWrapperType

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

◆ PointFinder2D

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

◆ PointFinder3D

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

Constructor & Destructor Documentation

◆ PointInCell()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
axom::quest::PointInCell< mesh_tag, ExecSpace >::PointInCell ( MeshType mesh,
int *  resolution = nullptr,
double  bboxTolerance = 1e-8,
int  allocatorID = axom::execution_space<ExecSpace>::allocatorID() 
)
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
[in]allocatorIdCurrently unused. Default value is based on the allocator ID set for the specified execution space.
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 , typename ExecSpace = axom::SEQ_EXEC>
axom::quest::PointInCell< mesh_tag, ExecSpace >::~PointInCell ( )
inline

Destructor

Member Function Documentation

◆ locatePoint()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
IndexType axom::quest::PointInCell< mesh_tag, ExecSpace >::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.

◆ locatePoints() [1/2]

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::locatePoints ( axom::ArrayView< const Point2DType pts,
IndexType outCellIds,
Point2DType outIsopar = nullptr 
)
inline

◆ locatePoints() [2/2]

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::locatePoints ( axom::ArrayView< const Point3DType pts,
IndexType outCellIds,
Point3DType outIsopar = nullptr 
) const
inline

◆ locatePointInCell()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
bool axom::quest::PointInCell< mesh_tag, ExecSpace >::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 , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::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 , typename ExecSpace = axom::SEQ_EXEC>
int axom::quest::PointInCell< mesh_tag, ExecSpace >::meshDimension ( ) const
inline

Returns the dimension of the mesh

◆ setPrintLevel()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::setPrintLevel ( int  level)
inline

Sets the print verbosity level for the point in cell query.

Parameters
[in]levelThe verbosity level (increases with level)

This is useful for debugging the point in cell query

For the mfem mesh wrapper, the valid options are:

  • -1: never print (default)
  • 0: print only errors
  • 1: print the first and last iterations
  • 2: print every iteration
  • 3: print every iteration including point coordinates.

◆ setInitialGuessType()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::setInitialGuessType ( int  guessType)
inline

Sets the initial guess type for the element-based point in cell query.

Parameters
[in]guessTypeThe guess type

For the mfem mesh wrapper, the valid options are:

  • 0: Use the element center in reference space
  • 1: Use the closest physical node on a grid of points in physical space
  • 2: Use the closest reference node on a grid of points in reference space

The grid size is controlled by setInitialGridOrder()

◆ setInitialGridOrder()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::setInitialGridOrder ( int  order)
inline

Sets the grid size for the initial guess in the element-based point in cell query.

Parameters
[in]orderThe order for the grid size

For the mfem mesh wrapper, the number of points in each spatial direction is given by max(trans_order+order,0)+1, where trans_order is the order of the current element.

See also
setInitialGuessType

◆ setSolverProjectionType()

template<typename mesh_tag , typename ExecSpace = axom::SEQ_EXEC>
void axom::quest::PointInCell< mesh_tag, ExecSpace >::setSolverProjectionType ( int  type)
inline

Sets the solution strategy for the element-based point in cell query.

Parameters
[in]typeThe strategy type

For the mfem mesh wrapper, the valid options all use a Newton solve but differ in their handling of iterates that leave the reference element

  • 0: Allow the iterates to leave the reference element
  • 1: Project external iterates to the reference space boundary along their current line
  • 2: Project external iterates to the closest reference space boundary location

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