+++ /dev/null
-## ---------------------------------------------------------------------
-##
-## Copyright (C) 2017 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## The deal.II library is free software; you can use it, redistribute
-## it, and/or modify it under the terms of the GNU Lesser General
-## Public License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-## The full text of the license can be found in the file LICENSE.md at
-## the top level directory of deal.II.
-##
-## ---------------------------------------------------------------------
-
-#
-# Configuration for the nanoflann library:
-#
-
-CONFIGURE_FEATURE(NANOFLANN)
+++ /dev/null
-## ---------------------------------------------------------------------
-##
-## Copyright (C) 2017 by the deal.II authors
-##
-## This file is part of the deal.II library.
-##
-## The deal.II library is free software; you can use it, redistribute
-## it, and/or modify it under the terms of the GNU Lesser General
-## Public License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-## The full text of the license can be found in the file LICENSE.md at
-## the top level directory of deal.II.
-##
-## ---------------------------------------------------------------------
-
-#
-# Try to find the NANOFLANN library
-#
-# This module exports
-#
-# NANOFLANN_INCLUDE_DIRS
-#
-
-SET(NANOFLANN_DIR "" CACHE PATH "An optional hint to a NANOFLANN installation")
-SET_IF_EMPTY(NANOFLANN_DIR "$ENV{NANOFLANN_DIR}")
-
-DEAL_II_FIND_PATH(NANOFLANN_INCLUDE_DIR nanoflann.hpp
- HINTS ${NANOFLANN_DIR}
- PATH_SUFFIXES include
- )
-
-DEAL_II_PACKAGE_HANDLE(NANOFLANN
- INCLUDE_DIRS REQUIRED NANOFLANN_INCLUDE_DIR
- USER_INCLUDE_DIRS REQUIRED NANOFLANN_INCLUDE_DIR
- CLEAR
- NANOFLANN_INCLUDE_DIR
- )
DEAL_II_MPI_VERSION_MAJOR=3 \
DEAL_II_MPI_VERSION_MINOR=0 \
DEAL_II_WITH_MUPARSER=1 \
- DEAL_II_WITH_NANOFLANN=1 \
DEAL_II_WITH_NETCDF=1 \
DEAL_II_WITH_OPENCASCADE=1 \
DEAL_II_WITH_P4EST=1 \
--- /dev/null
+Removed: The deprecated bindings to nanoflann have been removed.
+<br>
+(David Wells, 2020/05/27)
</p>
</dd>
- <dt><a name="nanoflann"/>
- <a href="https://github.com/jlblancoc/nanoflann" target="_top">nanoflann</a></dt>
- <dd>
- <p>
- <a href="https://github.com/jlblancoc/nanoflann" target="_top">nanoflann</a> is a C++11 header-only library for building KD-Trees of datasets with different topologies. In particular, it can be used for operations such as finding the
- vertex or cell closest to a given evaluation point that occur frequently in many applications using unstructured meshes. scale eigenvalue problems.
- <a href="https://github.com/jlblancoc/nanoflann" target="_top">nanoflann</a> should be readily packaged by most Linux distributions. To use a self compiled version, pass
- <code>-DNANOFLANN_DIR=/path/to/nanoflann</code> to the deal.II CMake call.
- </p>
- </dd>
-
<dt><a name="netcdf"></a><a href="http://www.unidata.ucar.edu/software/netcdf/" target="_top">NetCDF</a></dt>
<dd>
<p>
DEAL_II_WITH_METIS
DEAL_II_WITH_MPI
DEAL_II_WITH_MUPARSER
-DEAL_II_WITH_NANOFLANN
DEAL_II_WITH_NETCDF
DEAL_II_WITH_OPENCASCADE
DEAL_II_WITH_P4EST
DEAL_II_WITH_METIS
DEAL_II_WITH_MPI
DEAL_II_WITH_MUPARSER
-DEAL_II_WITH_NANOFLANN
DEAL_II_WITH_NETCDF
DEAL_II_WITH_OPENCASCADE
DEAL_II_WITH_P4EST
#cmakedefine DEAL_II_WITH_METIS
#cmakedefine DEAL_II_WITH_MPI
#cmakedefine DEAL_II_WITH_MUPARSER
-#cmakedefine DEAL_II_WITH_NANOFLANN
#cmakedefine DEAL_II_WITH_NETCDF
#cmakedefine DEAL_II_WITH_OPENCASCADE
#cmakedefine DEAL_II_WITH_P4EST
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
-#include <deal.II/numerics/kdtree.h>
#include <deal.II/numerics/rtree.h>
#include <boost/signals2.hpp>
const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
get_covering_rtree() const;
-#ifdef DEAL_II_WITH_NANOFLANN
- /**
- * Return the cached vertex_kdtree object, constructed with the vertices of
- * the stored triangulation.
- */
- const KDTree<spacedim> &
- get_vertex_kdtree() const;
-#endif
-
private:
/**
* Keep track of what needs to be updated next.
mutable RTree<std::pair<BoundingBox<spacedim>, unsigned int>>
covering_rtree;
-#ifdef DEAL_II_WITH_NANOFLANN
- /**
- * A KDTree object constructed with the vertices of the triangulation.
- */
- mutable KDTree<spacedim> vertex_kdtree;
-#endif
-
/**
* Store the used vertices of the Triangulation, as generated by
* GridTools::extract_used_vertices().
update_vertex_to_cell_centers_directions =
update_vertex_to_cell_map | 0x002,
- /**
- * Update a KDTree object, initialized with the vertices of the
- * Triangulation.
- */
- update_vertex_kdtree = 0x004,
-
/**
* Update a mapping of used vertices.
*/
s << "|vertex_to_cells_centers_directions";
if (u & update_covering_rtree)
s << "|covering_rtree";
-#ifdef DEAL_II_WITH_NANOFLANN
- if (u & update_vertex_kdtree)
- s << "|vertex_kdtree";
-#endif
return s;
}
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2019 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#ifndef dealii_numerics_kdtree_h
-#define dealii_numerics_kdtree_h
-
-#include <deal.II/base/config.h>
-
-#ifdef DEAL_II_WITH_NANOFLANN
-
-# include <deal.II/base/point.h>
-
-# include <nanoflann.hpp>
-
-# include <memory>
-
-
-DEAL_II_NAMESPACE_OPEN
-
-/**
- * A wrapper for the nanoflann library, used to compute the distance from a
- * collection of points, and to efficiently return nearest neighbors to a
- * target point. This class uses nanoflann to efficiently partition the
- * space in a $k$-dimensional tree. The cost of each query is then roughly of
- * order $\log(n)$, where $n$ is the number of points stored in this class.
- *
- * The wrapper provides methods that give access to some of the functionalities
- * of the nanoflann library, like searching the $p$ nearest neighbors of a given
- * point, or searching the points that fall within a radius of a target point.
- *
- * > From wikipedia (https://en.wikipedia.org/wiki/K-d_tree):
- * >
- * > A k-d tree is a binary tree in which every node is a $k$-dimensional point.
- * > Every non-leaf node can be thought of as implicitly generating a splitting
- * > hyperplane that divides the space into two parts, known as half-spaces.
- * > Points to the left of this hyperplane are represented by the left subtree
- * > of that node and points right of the hyperplane are represented by the
- * > right subtree. The hyperplane direction is chosen in the following way:
- * > every node in the tree is associated with one of the $k$-dimensions, with
- * > the hyperplane perpendicular to that dimension's axis. So, for example, if
- * > for a particular split the "x" axis is chosen, all points in the subtree
- * > with a smaller "x" value than the node will appear in the left subtree and
- * > all points with larger "x" value will be in the right subtree. In such a
- * > case, the hyperplane would be set by the $x$-value of the point, and its
- * > normal would be the unit $x$-axis.
- *
- * @deprecated This class has been deprecated in favor of RTree, which is
- * based on <code>boost::geometry::index::rtree</code>.
- *
- * @author Luca Heltai, 2017.
- */
-template <int dim>
-class DEAL_II_DEPRECATED KDTree
-{
-public:
- /**
- * Constructor.
- *
- * @param[in] max_leaf_size A number denoting how many points per leaf
- * are used in the kdtree algorithm.
- *
- * @param[in] pts A vector of points that are to be represented by the current
- * object. If no points are passed to this constructor (or if the default
- * value of the argument is used), then you have to pass them later to this
- * object by calling the set_points() method.
- *
- * Access to any of the methods without first passing a reference to a vector
- * of points will result in an exception. Only a reference to the points is
- * stored, so you should make sure that the life of the vector you pass is
- * longer than the life of this class, or you will get undefined behaviour.
- *
- * @warning If you change the contents of the vector of points that you passed
- * either to the constructor or to set_points(), remember to call the
- * set_points() method again. The tree and the index are constructed only once
- * when you pass the points (either at construction time, or when you call
- * set_points()). If you update your points, and do not call set_points()
- * again, then all following results will likely be wrong.
- */
- KDTree(const unsigned int max_leaf_size = 10,
- const std::vector<Point<dim>> &pts = {});
-
-
- /**
- * Adaptor class used internally by nanoflann. This class stores a reference
- * to the vector of points, and generates some helper functions for nanoflann.
- */
- struct PointCloudAdaptor
- {
- /**
- * An alias used by nanoflann.
- */
- using coord_t = double;
-
-
- /**
- * Reference to the vector of points from which we want to compute
- * the distance.
- */
- const std::vector<Point<dim>> &points;
-
-
- /**
- * The constructor needs the vector of points from which we want to build
- * the tree.
- */
- PointCloudAdaptor(const std::vector<Point<dim>> &_points);
-
-
- /**
- * Return number of points in the data set (required by nanoflann).
- */
- size_t
- kdtree_get_point_count() const;
-
-
- /**
- * Return the L2 distance between points
- */
- coord_t
- kdtree_distance(const coord_t * p1,
- const std::size_t idx_p2,
- const std::size_t size) const;
-
-
- /**
- * Return the d-th component of the idx-th point in the class.
- */
- coord_t
- kdtree_get_pt(const std::size_t idx, const int d) const;
-
-
- /**
- * Optional bounding-box computation: return false to default to a
- * standard bbox computation loop. Return true if the BBOX was
- * already computed by the class and returned in "bb" so it can be
- * avoided to redo it again. Look at bb.size() to find out the
- * expected dimensionality (e.g. 2 or 3 for point clouds).
- */
- template <class BBOX>
- bool
- kdtree_get_bbox(BBOX &) const;
- };
-
-
- /**
- * An alias for the actual KDTree object.
- */
- using NanoFlannKDTree = typename nanoflann::KDTreeSingleIndexAdaptor<
- nanoflann::L2_Simple_Adaptor<double, PointCloudAdaptor>,
- PointCloudAdaptor,
- dim,
- unsigned int>;
-
-
- /**
- * Store a reference to the passed points. After you called this method, you
- * can call the value() method to compute the minimum distance between an
- * evaluation point and the collection of points you passed to this method, or
- * the get_points_within_ball() and the get_closest_points() methods.
- *
- * Notice that the constructor calls this method internally if you
- * pass it a non-empty vector of points.
- *
- * Whenever your points change, you should call this method again,
- * since this is the method responsible for building the index and
- * storing the actual tree internally. If you change your points and
- * don't call again this method, any function you call later will
- * happily return wrong values without you noticing.
- *
- * @param[in] pts A collection of points
- */
- void
- set_points(const std::vector<Point<dim>> &pts);
-
-
- /**
- * A const accessor to the @p i'th one among the underlying points.
- */
- const Point<dim> &operator[](const unsigned int i) const;
-
-
- /**
- * The number of points currently stored by this class.
- */
- unsigned int
- size() const;
-
-
- /**
- * Fill and return a vector with the indices and the distance of the points
- * that are at distance less than or equal to the given radius from
- * the target point.
- *
- * @param[in] target The target point
- * @param[in] radius The radius of the ball
- * @param[in] sorted If @p true, sort the output results in ascending order
- * with respect to distance
- *
- * @return A vector of indices and distances to @p target
- * of the matching points
- */
- std::vector<std::pair<unsigned int, double>>
- get_points_within_ball(const Point<dim> &target,
- const double radius,
- const bool sorted = false) const;
-
- /**
- * Fill and return a vector with the indices and distances of the closest
- * @p n_points points to the given target point.
- *
- * @param[in] target The target point
- * @param[in] n_points The number of requested points
- *
- * @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;
-
-private:
- /**
- * Max number of points per leaf as set in the constructor.
- */
- const unsigned int max_leaf_size;
-
-
- /**
- * A point cloud adaptor, to be filled when set points is called.
- */
- std::unique_ptr<PointCloudAdaptor> adaptor;
-
-
- /**
- * The actual kdtree.
- */
- std::unique_ptr<NanoFlannKDTree> kdtree;
-};
-
-
-//------------ inline functions -------------
-# ifndef DOXYGEN
-
-template <int dim>
-inline unsigned int
-KDTree<dim>::size() const
-{
- if (adaptor)
- return adaptor->points.size();
- else
- return 0;
-}
-
-
-
-template <int dim>
-inline const Point<dim> &KDTree<dim>::operator[](const unsigned int i) const
-{
- AssertIndexRange(i, size());
- return adaptor->points[i];
-}
-
-
-
-template <int dim>
-KDTree<dim>::PointCloudAdaptor::PointCloudAdaptor(
- const std::vector<Point<dim>> &_points)
- : points(_points)
-{}
-
-
-
-template <int dim>
-inline size_t
-KDTree<dim>::PointCloudAdaptor::kdtree_get_point_count() const
-{
- return points.size();
-}
-
-
-
-template <int dim>
-inline double
-KDTree<dim>::PointCloudAdaptor::kdtree_get_pt(const std::size_t idx,
- int d) const
-{
- AssertIndexRange(d, dim);
- return points[idx][d];
-}
-
-
-
-template <int dim>
-template <class BBOX>
-inline bool
-KDTree<dim>::PointCloudAdaptor::kdtree_get_bbox(BBOX &) const
-{
- return false;
-}
-
-
-
-template <int dim>
-inline double
-KDTree<dim>::PointCloudAdaptor::kdtree_distance(const double * p1,
- const std::size_t idx_p2,
- const std::size_t size) const
-{
- AssertDimension(size, dim);
- double res = 0.0;
- for (std::size_t d = 0; d < size; ++d)
- res += (p1[d] - points[idx_p2][d]) * (p1[d] - points[idx_p2][d]);
- return std::sqrt(res);
-}
-# endif
-
-DEAL_II_NAMESPACE_CLOSE
-
-#endif // DEAL_II_WITH_NANO_FLANN
-#endif
}
-#ifdef DEAL_II_WITH_NANOFLANN
- template <int dim, int spacedim>
- const KDTree<spacedim> &
- Cache<dim, spacedim>::get_vertex_kdtree() const
- {
- if (update_flags & update_vertex_kdtree)
- {
- vertex_kdtree.set_points(tria->get_vertices());
- update_flags = update_flags & ~update_vertex_kdtree;
- }
- return vertex_kdtree;
- }
-#endif
-
-
template <int dim, int spacedim>
const RTree<std::pair<BoundingBox<spacedim>, unsigned int>> &
data_postprocessor.cc
dof_output_operator.cc
histogram.cc
- kdtree.cc
matrix_tools_once.cc
matrix_tools.cc
time_dependent.cc
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2019 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-// ---------------------------------------------------------------------
-
-#include <deal.II/numerics/kdtree.h>
-
-#ifdef DEAL_II_WITH_NANOFLANN
-
-# include <memory>
-
-DEAL_II_NAMESPACE_OPEN
-
-
-template <int dim>
-KDTree<dim>::KDTree(const unsigned int max_leaf_size,
- const std::vector<Point<dim>> &pts)
- : max_leaf_size(max_leaf_size)
-{
- if (pts.size() > 0)
- set_points(pts);
-}
-
-
-
-template <int dim>
-std::vector<std::pair<unsigned int, double>>
-KDTree<dim>::get_points_within_ball(const Point<dim> ¢er,
- const double radius,
- bool sorted) const
-{
- Assert(adaptor, ExcNotInitialized());
- Assert(kdtree, ExcInternalError());
-
- Assert(radius > 0, ExcMessage("Radius is expected to be positive."));
-
- nanoflann::SearchParams params;
- params.sorted = sorted;
-
- std::vector<std::pair<unsigned int, double>> matches;
-# if NANOFLANN_VERSION < 0x130
- kdtree->radiusSearch(center.begin_raw(), radius, matches, params);
-# else
- // nanoflann 1.3 performs distance comparisons with squared distances, so
- // square the radius before we query and square root after:
- kdtree->radiusSearch(center.begin_raw(), radius * radius, matches, params);
- for (std::pair<unsigned int, double> &match : matches)
- match.second = std::sqrt(match.second);
-# endif
-
- return matches;
-}
-
-
-
-template <int dim>
-std::vector<std::pair<unsigned int, double>>
-KDTree<dim>::get_closest_points(const Point<dim> & target,
- const unsigned int n_points) const
-{
- Assert(adaptor, ExcNotInitialized());
- Assert(kdtree, ExcInternalError());
-
- // get the information out of nanoflann
- std::vector<unsigned int> indices(n_points);
- std::vector<double> distances(n_points);
-
- kdtree->knnSearch(target.begin_raw(),
- n_points,
- indices.data(),
- distances.data());
-
- // convert it to the format we want to return
- std::vector<std::pair<unsigned int, double>> matches(n_points);
- for (unsigned int i = 0; i < n_points; ++i)
-# if NANOFLANN_VERSION < 0x130
- matches[i] = std::make_pair(indices[i], distances[i]);
-# else
- // nanoflann 1.3 performs distance comparisons with squared distances, so
- // take a square root:
- matches[i] = std::make_pair(indices[i], std::sqrt(distances[i]));
-# endif
-
- return matches;
-}
-
-
-
-template <int dim>
-void
-KDTree<dim>::set_points(const std::vector<Point<dim>> &pts)
-{
- Assert(pts.size() > 0, ExcMessage("Expecting a non zero set of points."));
- adaptor = std::make_unique<PointCloudAdaptor>(pts);
- kdtree = std::make_unique<NanoFlannKDTree>(
- dim, *adaptor, nanoflann::KDTreeSingleIndexAdaptorParams(max_leaf_size));
- kdtree->buildIndex();
-}
-
-
-template class KDTree<1>;
-template class KDTree<2>;
-template class KDTree<3>;
-
-DEAL_II_NAMESPACE_CLOSE
-
-#endif
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2019 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-//---------------------------------------------------------------------
-
-// Create a list of points, and compute the minimum distance from some other
-// points to this set, using a kdtree library
-
-#include <deal.II/numerics/kdtree.h>
-
-#include "../tests.h"
-
-
-int
-main()
-{
- initlog();
-
- KDTree<2> kdtree;
-
- std::vector<Point<2>> points;
-
- // Add four points
- points.push_back(Point<2>(0, 0));
- points.push_back(Point<2>(0, 1));
- points.push_back(Point<2>(1, 0));
- points.push_back(Point<2>(1, 1));
-
- deallog << "Distance from unit square:" << std::endl;
-
- std::vector<Point<2>> test_points;
- test_points.push_back(Point<2>(.5, .5));
- test_points.push_back(Point<2>(2, 0));
- test_points.push_back(Point<2>(2, 2));
-
- kdtree.set_points(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;
- AssertThrow(std::abs(points[res.first].distance(p) - res.second) < 1e-10,
- ExcInternalError());
- }
-
- 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;
- }
-}
+++ /dev/null
-
-DEAL::Distance from unit square:
-DEAL::P: 0.500000 0.500000, distance: 0.707107, index: 0
-DEAL::P: 2.00000 0.00000, distance: 1.00000, index: 2
-DEAL::P: 2.00000 2.00000, distance: 1.41421, index: 3
-DEAL::Consistency checking: the following are all the points in the set.
-DEAL::P: 0.00000 0.00000, distance: 0.00000, index: 0
-DEAL::P: 0.00000 1.00000, distance: 0.00000, index: 1
-DEAL::P: 1.00000 0.00000, distance: 0.00000, index: 2
-DEAL::P: 1.00000 1.00000, distance: 0.00000, index: 3
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-//---------------------------------------------------------------------
-
-// Create a list of points, and compute the closest points to a given one.
-
-#include <deal.II/numerics/kdtree.h>
-
-#include "../tests.h"
-
-int
-main()
-{
- initlog();
-
- KDTree<2> kdtree;
-
- std::vector<Point<2>> points;
-
- // Add four points
- points.push_back(Point<2>(0, 0));
- points.push_back(Point<2>(0, 1));
- points.push_back(Point<2>(1, 0));
- points.push_back(Point<2>(1, 1));
-
- std::vector<Point<2>> test_points;
- test_points.push_back(Point<2>(.5, .5));
- test_points.push_back(Point<2>(2, 0));
- test_points.push_back(Point<2>(2, 2));
-
- kdtree.set_points(points);
-
- std::vector<unsigned int> indices;
- std::vector<double> distances;
-
- // Get closest points. Do a few rounds
- for (auto &p : test_points)
- {
- for (unsigned int i = 1; i < points.size() + 1; ++i)
- {
- auto res = kdtree.get_closest_points(p, i);
-
- deallog << std::endl
- << "The first " << i << " closest points to " << p
- << " are:" << std::endl;
- for (unsigned int j = 0; j < i; ++j)
- {
- deallog << "points[" << res[j].first
- << "] = " << points[res[j].first]
- << ", distance: " << res[j].second << std::endl;
- }
- }
- }
-}
+++ /dev/null
-
-DEAL::
-DEAL::The first 1 closest points to 0.500000 0.500000 are:
-DEAL::points[0] = 0.00000 0.00000, distance: 0.707107
-DEAL::
-DEAL::The first 2 closest points to 0.500000 0.500000 are:
-DEAL::points[0] = 0.00000 0.00000, distance: 0.707107
-DEAL::points[1] = 0.00000 1.00000, distance: 0.707107
-DEAL::
-DEAL::The first 3 closest points to 0.500000 0.500000 are:
-DEAL::points[0] = 0.00000 0.00000, distance: 0.707107
-DEAL::points[1] = 0.00000 1.00000, distance: 0.707107
-DEAL::points[2] = 1.00000 0.00000, distance: 0.707107
-DEAL::
-DEAL::The first 4 closest points to 0.500000 0.500000 are:
-DEAL::points[0] = 0.00000 0.00000, distance: 0.707107
-DEAL::points[1] = 0.00000 1.00000, distance: 0.707107
-DEAL::points[2] = 1.00000 0.00000, distance: 0.707107
-DEAL::points[3] = 1.00000 1.00000, distance: 0.707107
-DEAL::
-DEAL::The first 1 closest points to 2.00000 0.00000 are:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::
-DEAL::The first 2 closest points to 2.00000 0.00000 are:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::
-DEAL::The first 3 closest points to 2.00000 0.00000 are:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::points[0] = 0.00000 0.00000, distance: 2.00000
-DEAL::
-DEAL::The first 4 closest points to 2.00000 0.00000 are:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::points[0] = 0.00000 0.00000, distance: 2.00000
-DEAL::points[1] = 0.00000 1.00000, distance: 2.23607
-DEAL::
-DEAL::The first 1 closest points to 2.00000 2.00000 are:
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::
-DEAL::The first 2 closest points to 2.00000 2.00000 are:
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::points[1] = 0.00000 1.00000, distance: 2.23607
-DEAL::
-DEAL::The first 3 closest points to 2.00000 2.00000 are:
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::points[1] = 0.00000 1.00000, distance: 2.23607
-DEAL::points[2] = 1.00000 0.00000, distance: 2.23607
-DEAL::
-DEAL::The first 4 closest points to 2.00000 2.00000 are:
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::points[1] = 0.00000 1.00000, distance: 2.23607
-DEAL::points[2] = 1.00000 0.00000, distance: 2.23607
-DEAL::points[0] = 0.00000 0.00000, distance: 2.82843
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-//---------------------------------------------------------------------
-
-// Create a list of points, and the ones within a specified radius of the target
-// points
-
-#include <deal.II/numerics/kdtree.h>
-
-#include "../tests.h"
-
-int
-main()
-{
- initlog();
-
- KDTree<2> kdtree;
-
- std::vector<Point<2>> points;
-
- // Add four points
- points.push_back(Point<2>(0, 0));
- points.push_back(Point<2>(0, 1));
- points.push_back(Point<2>(1, 0));
- points.push_back(Point<2>(1, 1));
-
- std::vector<Point<2>> test_points;
- test_points.push_back(Point<2>(2, 0));
- test_points.push_back(Point<2>(2, 2));
-
- std::vector<double> radii;
- radii.push_back(.8);
- radii.push_back(1.1);
- radii.push_back(1.5);
- radii.push_back(2);
-
-
- kdtree.set_points(points);
-
- std::vector<std::pair<unsigned int, double>> matches;
-
- // Get points within ball
- for (auto &p : test_points)
- {
- for (auto &r : radii)
- {
- auto matches = kdtree.get_points_within_ball(p, r, true);
-
- deallog << std::endl
- << "At distance less than " << r << " from " << p
- << " we have:" << std::endl;
- for (auto &m : matches)
- {
- deallog << "points[" << m.first << "] = " << points[m.first]
- << ", distance: " << m.second << std::endl;
- }
- }
- }
-}
+++ /dev/null
-
-DEAL::
-DEAL::At distance less than 0.800000 from 2.00000 0.00000 we have:
-DEAL::
-DEAL::At distance less than 1.10000 from 2.00000 0.00000 we have:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::
-DEAL::At distance less than 1.50000 from 2.00000 0.00000 we have:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::
-DEAL::At distance less than 2.00000 from 2.00000 0.00000 we have:
-DEAL::points[2] = 1.00000 0.00000, distance: 1.00000
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::
-DEAL::At distance less than 0.800000 from 2.00000 2.00000 we have:
-DEAL::
-DEAL::At distance less than 1.10000 from 2.00000 2.00000 we have:
-DEAL::
-DEAL::At distance less than 1.50000 from 2.00000 2.00000 we have:
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
-DEAL::
-DEAL::At distance less than 2.00000 from 2.00000 2.00000 we have:
-DEAL::points[3] = 1.00000 1.00000, distance: 1.41421
make_quicktest("hdf5" ${_mybuild} "")
ENDIF()
-# Test Nanoflann
-IF (DEAL_II_WITH_NANOFLANN)
- make_quicktest("nanoflann" ${_mybuild} "")
-ENDIF()
-
# Test Arpack
IF (DEAL_II_WITH_ARPACK AND DEAL_II_WITH_UMFPACK)
make_quicktest("arpack" ${_mybuild} "")
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2017 - 2018 by the deal.II authors
-//
-// This file is part of the deal.II library.
-//
-// The deal.II library is free software; you can use it, redistribute
-// it, and/or modify it under the terms of the GNU Lesser General
-// Public License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-// The full text of the license can be found in the file LICENSE.md at
-// the top level directory of deal.II.
-//
-//---------------------------------------------------------------------
-
-// Create a list of points, and compute the minimum distance from some other
-// points to this set, using a kdtree library
-
-#include <deal.II/base/logstream.h>
-
-#include <deal.II/numerics/kdtree.h>
-
-using namespace dealii;
-
-
-int
-main()
-{
- KDTree<2> kdtree;
-
- std::vector<Point<2>> points;
-
- // Add four points
- points.emplace_back(0, 0);
- points.emplace_back(0, 1);
- points.emplace_back(1, 0);
- points.emplace_back(1, 1);
-
- deallog << "Distance from unit square:" << std::endl;
-
- std::vector<Point<2>> test_points;
- test_points.emplace_back(.5, .5);
- test_points.emplace_back(2, 0);
- test_points.emplace_back(2, 2);
-
- kdtree.set_points(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
- << "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;
- Assert(res.second < 1e-10, ExcMessage("Should be zero!"));
- }
-}