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

Encapsulated the Distributed closest point query for a collection of query points over an "object mesh". More...

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

Public Types

using RuntimePolicy = axom::runtime_policy::Policy
 

Public Member Functions

 DistributedClosestPoint ()
 
 ~DistributedClosestPoint ()
 
void setRuntimePolicy (RuntimePolicy policy)
 Set runtime execution policy for local queries. More...
 
void setDefaultAllocatorID ()
 Sets the allocator ID to the default associated with the execution policy. More...
 
void setAllocatorID (int allocatorID)
 Sets the allocator ID. More...
 
void setMpiCommunicator (MPI_Comm mpiComm, bool duplicate=false)
 Set the MPI communicator. More...
 
void setDistanceThreshold (double threshold)
 Sets the threshold for the query. More...
 
void setOutput (const std::string &field, bool on)
 Set what fields to output. More...
 
void setVerbosity (bool isVerbose)
 Sets the logging verbosity of the query. By default the query is not verbose. More...
 
void setObjectMesh (const conduit::Node &meshNode, const std::string &topologyName)
 Sets the object mesh for the query. More...
 
bool generateBVHTree ()
 Generates a BVH tree over the object mesh using the runtime execution policy. More...
 
void computeClosestPoints (conduit::Node &query_node, const std::string &topology)
 Computes the closest point on the object mesh for each point on the provided query mesh. More...
 

Detailed Description

Encapsulated the Distributed closest point query for a collection of query points over an "object mesh".

The object mesh and the query mesh are provided as conduit nodes using the mesh blueprint schema. Each of these are distributed over the same MPI rank space. Ranks are allowed to have any number of domains, including zero. This class orchestrates passing the query points to all ranks whose object meshes might contain a closest point.

Note
The class currently supports object meshes that are comprised of a collection of points. In the future, we'd like to consider more general object meshes, e.g. triangle meshes.

To use this class, first set some parameters, such as the runtime execution policy, then pass in the object mesh and build a spatial index over this mesh. Finally, compute the closest points in the object mesh to each point in a query mesh using the computeClosestPoints() function.

Note
To prevent mixing unrelated MPI communications, you can set a custom MPI Communicator using setMpiCommunicator().

Member Typedef Documentation

◆ RuntimePolicy

Constructor & Destructor Documentation

◆ DistributedClosestPoint()

axom::quest::DistributedClosestPoint::DistributedClosestPoint ( )

◆ ~DistributedClosestPoint()

axom::quest::DistributedClosestPoint::~DistributedClosestPoint ( )

Member Function Documentation

◆ setRuntimePolicy()

void axom::quest::DistributedClosestPoint::setRuntimePolicy ( RuntimePolicy  policy)
inline

Set runtime execution policy for local queries.

See axom::runtime_policy.

◆ setDefaultAllocatorID()

void axom::quest::DistributedClosestPoint::setDefaultAllocatorID ( )

Sets the allocator ID to the default associated with the execution policy.

◆ setAllocatorID()

void axom::quest::DistributedClosestPoint::setAllocatorID ( int  allocatorID)

Sets the allocator ID.

If not explitly set, the allocator ID is the default is the id associated with the runtime policy.

◆ setMpiCommunicator()

void axom::quest::DistributedClosestPoint::setMpiCommunicator ( MPI_Comm  mpiComm,
bool  duplicate = false 
)

Set the MPI communicator.

By default, the communicator is MPI_COMM_WORLD.

Parameters
[i]mpiComm The MPI communicator to use.
[i]duplicate Whether to duplicate mpiComm for exclusive use

◆ setDistanceThreshold()

void axom::quest::DistributedClosestPoint::setDistanceThreshold ( double  threshold)

Sets the threshold for the query.

Parameters
[in]thresholdIgnore distances greater than this value.

◆ setOutput()

void axom::quest::DistributedClosestPoint::setOutput ( const std::string &  field,
bool  on 
)

Set what fields to output.

Parameters
[i]field Must be one of these: "cp_rank", "cp_index", "cp_distance", "cp_coords", "cp_domain_index".
[i]on Whether to enable outputing field.

By default, all are on.

◆ setVerbosity()

void axom::quest::DistributedClosestPoint::setVerbosity ( bool  isVerbose)
inline

Sets the logging verbosity of the query. By default the query is not verbose.

◆ setObjectMesh()

void axom::quest::DistributedClosestPoint::setObjectMesh ( const conduit::Node &  meshNode,
const std::string &  topologyName 
)

Sets the object mesh for the query.

Parameters
[in]meshNodeConduit node for the object mesh
[in]topologyNameThe name of the topology for the object mesh
Precondition
meshNode must follow the mesh blueprint convention.
Dimension of the mesh must be 2D or 3D

◆ generateBVHTree()

bool axom::quest::DistributedClosestPoint::generateBVHTree ( )

Generates a BVH tree over the object mesh using the runtime execution policy.

Precondition
Users must set the object mesh before generating the BVH tree
See also
setObjectMesh()

◆ computeClosestPoints()

void axom::quest::DistributedClosestPoint::computeClosestPoints ( conduit::Node &  query_node,
const std::string &  topology 
)

Computes the closest point on the object mesh for each point on the provided query mesh.

Parameters
[in]query_nodeThe root node of a mesh blueprint for the query points, which can be empty if there are no query points for the calling rank
[in]topologyThe name of the topology within query_node

queryMesh should have data on the host, regardless of the runtime policy setting. Data will be copied to device as needed.

On completion, the query mesh contains the following fields:

  • cp_rank: will hold the rank of the object point containing the closest point
  • cp_domain_index: will hold the index of the object domain containing the closest points.
  • cp_index: Will hold the index of the closest object points. For multiple object mesh domains on a rank, cp_index is relative to each domain.
  • cp_coords: Will hold the coordinates of the closest points interleaved in a 1D array.
  • cp_distance: Will hold the distances to the closest points. See setOutput() to toggle these outputs.
Note
The current implementation assumes that the mesh coordinates are interleaved or contiguous. The output cp_coords will be contiguous.

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