16 #include <deal.II/numerics/kdtree.h> 18 #ifdef DEAL_II_WITH_NANOFLANN 20 # include <deal.II/base/std_cxx14/memory.h> 22 DEAL_II_NAMESPACE_OPEN
28 : max_leaf_size(max_leaf_size)
37 std::vector<std::pair<unsigned int, double>>
39 const double & radius,
47 nanoflann::SearchParams params;
48 params.sorted = sorted;
50 std::vector<std::pair<unsigned int, double>> matches;
51 kdtree->radiusSearch(¢er[0], radius, matches, params);
59 std::vector<std::pair<unsigned int, double>>
61 const unsigned int n_points)
const 67 std::vector<unsigned int> indices(n_points);
68 std::vector<double> distances(n_points);
70 kdtree->knnSearch(&target[0], n_points, &indices[0], &distances[0]);
73 std::vector<std::pair<unsigned int, double>> matches(n_points);
74 for (
unsigned int i = 0; i < n_points; ++i)
75 matches[i] = std::make_pair(indices[i], distances[i]);
87 adaptor = std_cxx14::make_unique<PointCloudAdaptor>(pts);
88 kdtree = std_cxx14::make_unique<NanoFlannKDTree>(
98 DEAL_II_NAMESPACE_CLOSE
std::unique_ptr< NanoFlannKDTree > kdtree
static::ExceptionBase & ExcNotInitialized()
KDTree(const unsigned int max_leaf_size=10, const std::vector< Point< dim >> &pts=std::vector< Point< dim >>())
std::vector< std::pair< unsigned int, double > > get_closest_points(const Point< dim > &target, const unsigned int n_points) const
static::ExceptionBase & ExcMessage(std::string arg1)
#define Assert(cond, exc)
void set_points(const std::vector< Point< dim >> &pts)
std::vector< std::pair< unsigned int, double > > get_points_within_ball(const Point< dim > &target, const double &radius, const bool sorted=false) const
std::unique_ptr< PointCloudAdaptor > adaptor
const unsigned int max_leaf_size
static::ExceptionBase & ExcInternalError()