1#ifndef included_AMP_kdtree
2#define included_AMP_kdtree
45 kdtree(
int ndim,
size_t N,
const double *
const *x );
77 static std::shared_ptr<kdtree>
create2d(
size_t N,
const double *x,
const double *y );
87 static std::shared_ptr<kdtree>
88 create3d(
size_t N,
const double *x,
const double *y,
const double *z );
92 std::vector<double>
box()
const;
101 void add(
const double *x );
118 size_t find_nearest(
const double *x,
double *dist =
nullptr,
double *pos =
nullptr )
const;
132 double *dist =
nullptr,
133 double *pos =
nullptr )
const;
A class used to to perform kd-tree based operations.
size_t find_nearest(const double *x, double *dist=nullptr, double *pos=nullptr) const
Search the tree for the nearest neighbor point.
kdtree(const std::vector< AMP::Mesh::MeshPoint< double > > &x)
Default constructor.
size_t find_nearest3d(const double x, const double y, const double z) const
Search the tree for the nearest neighbor point.
std::vector< double > box() const
Function to return the bounding box for the tree.
static std::shared_ptr< kdtree > create2d(size_t N, const double *x, const double *y)
Constructor for 2d.
kdtree & operator=(const kdtree &)=delete
Assignment operator.
void add(const double *x)
Add a point.
void find_nearest(int N, const double *x, size_t *index, double *dist=nullptr, double *pos=nullptr) const
Search the tree for the nearest neighbor point.
kdtree(const kdtree &)=delete
Copy constructor.
size_t find_nearest2(const double *x, double &dist, double *pos) const
kdtree & operator=(kdtree &&)
Move operator.
kdtree(kdtree &&)
Move constructor.
kdtree(int ndim, size_t N, const double *const *x)
Default constructor.
size_t find_nearest2d(const double x, const double y) const
Search the tree for the nearest neighbor point.
static std::shared_ptr< kdtree > create3d(size_t N, const double *x, const double *y, const double *z)
Constructor for 3d.
AMP::Mesh::MeshPoint< double > find_nearest(const AMP::Mesh::MeshPoint< double > &p) const
Search the tree for the nearest neighbor point.