20#ifndef LIBMESH_POINT_LOCATOR_NANOFLANN_H
21#define LIBMESH_POINT_LOCATOR_NANOFLANN_H
23#include "libmesh/libmesh_config.h"
26#ifdef LIBMESH_HAVE_NANOFLANN
29#include "libmesh/point_locator_base.h"
30#include "libmesh/point.h"
31#include "libmesh/bounding_box.h"
34#include "libmesh/nanoflann.hpp"
92 virtual void clear() override final;
98 virtual
void init() override final;
105 virtual const
Elem * operator() (const
Point & p,
117 virtual
void operator() (const
Point & p,
118 std::set<const
Elem *> & candidate_elements,
179 const
std::
size_t idx_p2,
180 std::
size_t size) const;
195 template <class BBOX>
222 std::shared_ptr<std::vector<const Elem *>>
_elems;
228 typedef nanoflann::L2_Simple_Adaptor<Real, PointLocatorNanoflann>
adapter_t;
229 typedef nanoflann::KDTreeSingleIndexAdaptor<adapter_t, PointLocatorNanoflann, LIBMESH_DIM>
kd_tree_t;
244 mutable std::vector<std::size_t>
_b;
254 nanoflann::KNNResultSet<Real>
256 std::size_t num_results)
const;
This is the base class from which all geometric element types are derived.
This is the MeshBase class.
This is the base class for point locators.
This is a PointLocator that uses Nanoflann for its implementation.
virtual void enable_out_of_mesh_mode() override final
Enables out-of-mesh mode.
virtual void init() override final
Initializes the locator, so that the operator() methods can be used.
virtual void clear() override final
Restore to PointLocator to a just-constructed state.
Real coord_t
Floating point type used for storing coordinates.
coord_t kdtree_distance(const coord_t *p1, const std::size_t idx_p2, std::size_t size) const
Returns the squared distance between the vector (p1[0], p1[1], p1[2]) and the vertex average of Elem ...
bool _out_of_mesh_mode
true if out-of-mesh mode is enabled.
std::size_t _num_results
The number of results returned by Nanoflann when operator() is called.
nanoflann::KDTreeSingleIndexAdaptor< adapter_t, PointLocatorNanoflann, LIBMESH_DIM > kd_tree_t
std::vector< Real > _out_dist_sqr
virtual ~PointLocatorNanoflann()
Destructor.
std::vector< std::size_t > _ret_index
The operator() functions on PointLocator-derived classes are const, so to avoid re-allocating these r...
std::vector< std::size_t > _b
Vector of indices used by indirect sort.
void set_num_results(std::size_t val)
std::size_t kdtree_get_point_count() const
Must return the number of data points.
nanoflann::L2_Simple_Adaptor< Real, PointLocatorNanoflann > adapter_t
coord_t kdtree_get_pt(const std::size_t idx, int dim) const
Returns the dim'th component of the idx'th vertex average.
std::shared_ptr< std::vector< const Elem * > > _elems
Lists of Points and ids which make up the "point cloud" that is to be searched via Nanoflann.
std::shared_ptr< std::vector< Point > > _point_cloud
bool kdtree_get_bbox(BBOX &) const
Optional bounding-box computation: return false to default to a standard bbox computation loop.
nanoflann::KNNResultSet< Real > kd_tree_find_neighbors(const Point &p, std::size_t num_results) const
Helper function that wraps the call to the KDTree's findNeighbors() routine.
std::size_t get_num_results() const
Set/get the number of results returned by each Nanoflann findNeighbors() search.
virtual void disable_out_of_mesh_mode() override final
Disables out-of-mesh mode (default).
std::shared_ptr< kd_tree_t > _kd_tree
A Point defines a location in LIBMESH_DIM dimensional Real space.
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real