Advanced Multi-Physics (AMP)
On-Line Documentation
Public Member Functions | Private Member Functions | Private Attributes | List of all members
AMP::Mesh::ElementFinder Class Reference

A class used to help find the nearest element to a point. More...

#include <MeshUtilities.h>

Public Member Functions

double distance (const Point &pos, const Point &dir) const
 Calculate the distance to the object given a ray.
 
 ElementFinder ()
 Empty constructor.
 
 ElementFinder (const ElementFinder &)=delete
 Copy constructor.
 
 ElementFinder (ElementFinder &&)=default
 Move constructor.
 
 ElementFinder (std::shared_ptr< AMP::Mesh::Mesh > mesh)
 Empty constructor.
 
 ElementFinder (std::shared_ptr< AMP::Mesh::Mesh > mesh, AMP::Mesh::MeshIterator it)
 Empty constructor.
 
const auto & getTree () const
 Return the underlying tree.
 
std::pair< std::unique_ptr< MeshElement >, Pointnearest (const Point &x) const
 Get the nearest element and point.
 
ElementFinderoperator= (ElementFinder &&)=default
 Move operator.
 
void update () const
 Ensure the tree is up-to-date.
 

Private Member Functions

void initialize () const
 

Private Attributes

double d_dist
 
AMP::Mesh::MeshIterator d_elements
 
std::shared_ptr< AMP::Mesh::Meshd_mesh
 
uint64_t d_pos_hash
 
kdtree2< 3, AMP::Mesh::MeshElementIDd_tree
 

Detailed Description

A class used to help find the nearest element to a point.

This class provides functions to help find the nearest element to a point

Definition at line 51 of file MeshUtilities.h.

Constructor & Destructor Documentation

◆ ElementFinder() [1/5]

AMP::Mesh::ElementFinder::ElementFinder ( )
inline

Empty constructor.

Definition at line 55 of file MeshUtilities.h.

◆ ElementFinder() [2/5]

AMP::Mesh::ElementFinder::ElementFinder ( std::shared_ptr< AMP::Mesh::Mesh mesh)

Empty constructor.

◆ ElementFinder() [3/5]

AMP::Mesh::ElementFinder::ElementFinder ( std::shared_ptr< AMP::Mesh::Mesh mesh,
AMP::Mesh::MeshIterator  it 
)

Empty constructor.

◆ ElementFinder() [4/5]

AMP::Mesh::ElementFinder::ElementFinder ( const ElementFinder )
delete

Copy constructor.

◆ ElementFinder() [5/5]

AMP::Mesh::ElementFinder::ElementFinder ( ElementFinder &&  )
default

Move constructor.

Member Function Documentation

◆ distance()

double AMP::Mesh::ElementFinder::distance ( const Point pos,
const Point dir 
) const

Calculate the distance to the object given a ray.

This function computes the distance to the object given a ray. If the ray is inside the object, this distance is negitive. If the ray will never intersect the object, this distance is inf.

Parameters
[in]posCurrent position of ray
[in]dirDirection of ray (should be normalized for most uses)
Returns
Returns the surface and distance to the nearest surface (intersection = pos + dir*distance)

◆ getTree()

const auto & AMP::Mesh::ElementFinder::getTree ( ) const
inline

Return the underlying tree.

Definition at line 88 of file MeshUtilities.h.

References d_tree.

◆ initialize()

void AMP::Mesh::ElementFinder::initialize ( ) const
private

◆ nearest()

std::pair< std::unique_ptr< MeshElement >, Point > AMP::Mesh::ElementFinder::nearest ( const Point x) const

Get the nearest element and point.

◆ operator=()

ElementFinder & AMP::Mesh::ElementFinder::operator= ( ElementFinder &&  )
default

Move operator.

◆ update()

void AMP::Mesh::ElementFinder::update ( ) const

Ensure the tree is up-to-date.

Member Data Documentation

◆ d_dist

double AMP::Mesh::ElementFinder::d_dist
mutableprivate

Definition at line 100 of file MeshUtilities.h.

◆ d_elements

AMP::Mesh::MeshIterator AMP::Mesh::ElementFinder::d_elements
private

Definition at line 99 of file MeshUtilities.h.

◆ d_mesh

std::shared_ptr<AMP::Mesh::Mesh> AMP::Mesh::ElementFinder::d_mesh
private

Definition at line 97 of file MeshUtilities.h.

◆ d_pos_hash

uint64_t AMP::Mesh::ElementFinder::d_pos_hash
mutableprivate

Definition at line 98 of file MeshUtilities.h.

◆ d_tree

kdtree2<3, AMP::Mesh::MeshElementID> AMP::Mesh::ElementFinder::d_tree
mutableprivate

Definition at line 101 of file MeshUtilities.h.

Referenced by getTree().


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:43.
Comments on this page