* @return vector of indices and distances of the matching points
*/
std::vector<std::pair<unsigned int, double> > get_points_within_ball(const Point<dim> &target,
- const double &radius,
- bool sorted=false) const;
+ const double &radius,
+ bool sorted=false) const;
/**
* Fill two vectors with the indices and distances of the closest
* @return a vector of pairs of indices and distances of the matching points
*/
std::vector<std::pair<unsigned int, double> > get_closest_points(const Point<dim> &target,
- const unsigned int n_points) const;
+ const unsigned int n_points) const;
private:
/**
template<int dim>
std::vector<std::pair<unsigned int, double> > KDTreeDistance<dim>::get_points_within_ball(const Point<dim> ¢er,
- const double &radius,
- bool sorted) const
+ const double &radius,
+ bool sorted) const
{
std::vector<std::pair<unsigned int, double> > matches;
Assert(adaptor, ExcNotInitialized());
template<int dim>
std::vector<std::pair<unsigned int, double> > KDTreeDistance<dim>::get_closest_points(const Point<dim> &target,
- const unsigned int n_points) const
+ const unsigned int n_points) const
{
Assert(adaptor, ExcNotInitialized());
Assert(kdtree, ExcInternalError());
std::vector<std::pair<unsigned int, double> > matches(n_points);
kdtree->knnSearch(&target[0], n_points, &indices[0], &distances[0]);
- for(unsigned int i=0; i<n_points; ++i)
+ for (unsigned int i=0; i<n_points; ++i)
matches[i] = std::make_pair(indices[i], distances[i]);
return matches;
}
kdtree.set_points(points);
- for (auto &p : test_points) {
+ for (auto &p : test_points)
+ {
auto res = kdtree.get_closest_points(p,1)[0];
- deallog << "P: " << p << ", distance: " << res.second << ", index: " << res.first << std::endl;
+ deallog << "P: " << p << ", distance: " << res.second << ", index: " << res.first << std::endl;
}
deallog << "Consistency checking: the following are all the points in the set." << std::endl;
- for (auto &p : points) {
- auto res = kdtree.get_closest_points(p,1)[0];
- deallog << "P: " << p << ", distance: " << res.second << ", index: " << res.first << std::endl;
+ for (auto &p : points)
+ {
+ auto res = kdtree.get_closest_points(p,1)[0];
+ deallog << "P: " << p << ", distance: " << res.second << ", index: " << res.first << std::endl;
}
}