From: David Wells Date: Wed, 27 May 2020 14:54:45 +0000 (-0400) Subject: Remove our deprecated nanoflann bindings X-Git-Tag: v9.3.0-rc1~1534^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987e21be8c0fae3a7e7c7c2af9bf7a73791b1977;p=dealii.git Remove our deprecated nanoflann bindings --- diff --git a/cmake/configure/configure_nanoflann.cmake b/cmake/configure/configure_nanoflann.cmake deleted file mode 100644 index d36d216b3c..0000000000 --- a/cmake/configure/configure_nanoflann.cmake +++ /dev/null @@ -1,20 +0,0 @@ -## --------------------------------------------------------------------- -## -## 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) diff --git a/cmake/modules/FindNANOFLANN.cmake b/cmake/modules/FindNANOFLANN.cmake deleted file mode 100644 index 8191b9933b..0000000000 --- a/cmake/modules/FindNANOFLANN.cmake +++ /dev/null @@ -1,37 +0,0 @@ -## --------------------------------------------------------------------- -## -## 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 - ) diff --git a/doc/doxygen/options.dox.in b/doc/doxygen/options.dox.in index 1d65cb36d6..642b2cda14 100644 --- a/doc/doxygen/options.dox.in +++ b/doc/doxygen/options.dox.in @@ -206,7 +206,6 @@ PREDEFINED = DOXYGEN=1 \ 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 \ diff --git a/doc/news/changes/incompatibilities/20200527DavidWells b/doc/news/changes/incompatibilities/20200527DavidWells new file mode 100644 index 0000000000..6121c3937e --- /dev/null +++ b/doc/news/changes/incompatibilities/20200527DavidWells @@ -0,0 +1,3 @@ +Removed: The deprecated bindings to nanoflann have been removed. +
+(David Wells, 2020/05/27) diff --git a/doc/readme.html b/doc/readme.html index db44b08335..b37052d0e7 100644 --- a/doc/readme.html +++ b/doc/readme.html @@ -526,17 +526,6 @@

-
- nanoflann
-
-

- nanoflann 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. - nanoflann should be readily packaged by most Linux distributions. To use a self compiled version, pass - -DNANOFLANN_DIR=/path/to/nanoflann to the deal.II CMake call. -

-
-
NetCDF

diff --git a/doc/users/cmake_dealii.html b/doc/users/cmake_dealii.html index c91e866900..11088c15b0 100644 --- a/doc/users/cmake_dealii.html +++ b/doc/users/cmake_dealii.html @@ -466,7 +466,6 @@ DEAL_II_WITH_LAPACK 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 diff --git a/doc/users/cmake_user.html b/doc/users/cmake_user.html index f087f00840..da78db4d29 100644 --- a/doc/users/cmake_user.html +++ b/doc/users/cmake_user.html @@ -856,7 +856,6 @@ DEAL_II_WITH_LAPACK 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 diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index e31b71df5f..bb96f7fe2f 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -51,7 +51,6 @@ #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 diff --git a/include/deal.II/grid/grid_tools_cache.h b/include/deal.II/grid/grid_tools_cache.h index 75204a92a1..d592924ec2 100644 --- a/include/deal.II/grid/grid_tools_cache.h +++ b/include/deal.II/grid/grid_tools_cache.h @@ -30,7 +30,6 @@ #include #include -#include #include #include @@ -177,15 +176,6 @@ namespace GridTools const RTree, 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 & - get_vertex_kdtree() const; -#endif - private: /** * Keep track of what needs to be updated next. @@ -224,13 +214,6 @@ namespace GridTools mutable RTree, unsigned int>> covering_rtree; -#ifdef DEAL_II_WITH_NANOFLANN - /** - * A KDTree object constructed with the vertices of the triangulation. - */ - mutable KDTree vertex_kdtree; -#endif - /** * Store the used vertices of the Triangulation, as generated by * GridTools::extract_used_vertices(). diff --git a/include/deal.II/grid/grid_tools_cache_update_flags.h b/include/deal.II/grid/grid_tools_cache_update_flags.h index 2c8c32578f..323c615705 100644 --- a/include/deal.II/grid/grid_tools_cache_update_flags.h +++ b/include/deal.II/grid/grid_tools_cache_update_flags.h @@ -52,12 +52,6 @@ namespace GridTools 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. */ @@ -106,10 +100,6 @@ namespace GridTools 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; } diff --git a/include/deal.II/numerics/kdtree.h b/include/deal.II/numerics/kdtree.h deleted file mode 100644 index 2649b21191..0000000000 --- a/include/deal.II/numerics/kdtree.h +++ /dev/null @@ -1,331 +0,0 @@ -// --------------------------------------------------------------------- -// -// 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 - -#ifdef DEAL_II_WITH_NANOFLANN - -# include - -# include - -# include - - -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 boost::geometry::index::rtree. - * - * @author Luca Heltai, 2017. - */ -template -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> &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> &points; - - - /** - * The constructor needs the vector of points from which we want to build - * the tree. - */ - PointCloudAdaptor(const std::vector> &_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 - bool - kdtree_get_bbox(BBOX &) const; - }; - - - /** - * An alias for the actual KDTree object. - */ - using NanoFlannKDTree = typename nanoflann::KDTreeSingleIndexAdaptor< - nanoflann::L2_Simple_Adaptor, - 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> &pts); - - - /** - * A const accessor to the @p i'th one among the underlying points. - */ - const Point &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> - get_points_within_ball(const Point &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> - get_closest_points(const Point & 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 adaptor; - - - /** - * The actual kdtree. - */ - std::unique_ptr kdtree; -}; - - -//------------ inline functions ------------- -# ifndef DOXYGEN - -template -inline unsigned int -KDTree::size() const -{ - if (adaptor) - return adaptor->points.size(); - else - return 0; -} - - - -template -inline const Point &KDTree::operator[](const unsigned int i) const -{ - AssertIndexRange(i, size()); - return adaptor->points[i]; -} - - - -template -KDTree::PointCloudAdaptor::PointCloudAdaptor( - const std::vector> &_points) - : points(_points) -{} - - - -template -inline size_t -KDTree::PointCloudAdaptor::kdtree_get_point_count() const -{ - return points.size(); -} - - - -template -inline double -KDTree::PointCloudAdaptor::kdtree_get_pt(const std::size_t idx, - int d) const -{ - AssertIndexRange(d, dim); - return points[idx][d]; -} - - - -template -template -inline bool -KDTree::PointCloudAdaptor::kdtree_get_bbox(BBOX &) const -{ - return false; -} - - - -template -inline double -KDTree::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 diff --git a/source/grid/grid_tools_cache.cc b/source/grid/grid_tools_cache.cc index f9a8005806..22e8796b5d 100644 --- a/source/grid/grid_tools_cache.cc +++ b/source/grid/grid_tools_cache.cc @@ -142,21 +142,6 @@ namespace GridTools } -#ifdef DEAL_II_WITH_NANOFLANN - template - const KDTree & - Cache::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 const RTree, unsigned int>> & diff --git a/source/numerics/CMakeLists.txt b/source/numerics/CMakeLists.txt index 7ae55dc1ba..b0f86d4c1e 100644 --- a/source/numerics/CMakeLists.txt +++ b/source/numerics/CMakeLists.txt @@ -23,7 +23,6 @@ SET(_unity_include_src data_postprocessor.cc dof_output_operator.cc histogram.cc - kdtree.cc matrix_tools_once.cc matrix_tools.cc time_dependent.cc diff --git a/source/numerics/kdtree.cc b/source/numerics/kdtree.cc deleted file mode 100644 index 43d4952349..0000000000 --- a/source/numerics/kdtree.cc +++ /dev/null @@ -1,117 +0,0 @@ -// --------------------------------------------------------------------- -// -// 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 - -#ifdef DEAL_II_WITH_NANOFLANN - -# include - -DEAL_II_NAMESPACE_OPEN - - -template -KDTree::KDTree(const unsigned int max_leaf_size, - const std::vector> &pts) - : max_leaf_size(max_leaf_size) -{ - if (pts.size() > 0) - set_points(pts); -} - - - -template -std::vector> -KDTree::get_points_within_ball(const Point ¢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> 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 &match : matches) - match.second = std::sqrt(match.second); -# endif - - return matches; -} - - - -template -std::vector> -KDTree::get_closest_points(const Point & target, - const unsigned int n_points) const -{ - Assert(adaptor, ExcNotInitialized()); - Assert(kdtree, ExcInternalError()); - - // get the information out of nanoflann - std::vector indices(n_points); - std::vector 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> 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 -void -KDTree::set_points(const std::vector> &pts) -{ - Assert(pts.size() > 0, ExcMessage("Expecting a non zero set of points.")); - adaptor = std::make_unique(pts); - kdtree = std::make_unique( - 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 diff --git a/tests/numerics/kdtree_01.cc b/tests/numerics/kdtree_01.cc deleted file mode 100644 index 1d54ddd83d..0000000000 --- a/tests/numerics/kdtree_01.cc +++ /dev/null @@ -1,66 +0,0 @@ -// --------------------------------------------------------------------- -// -// 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 - -#include "../tests.h" - - -int -main() -{ - initlog(); - - KDTree<2> kdtree; - - std::vector> 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> 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; - } -} diff --git a/tests/numerics/kdtree_01.with_nanoflann=true.output b/tests/numerics/kdtree_01.with_nanoflann=true.output deleted file mode 100644 index e1196a586a..0000000000 --- a/tests/numerics/kdtree_01.with_nanoflann=true.output +++ /dev/null @@ -1,10 +0,0 @@ - -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 diff --git a/tests/numerics/kdtree_02.cc b/tests/numerics/kdtree_02.cc deleted file mode 100644 index 7e171238c0..0000000000 --- a/tests/numerics/kdtree_02.cc +++ /dev/null @@ -1,65 +0,0 @@ -// --------------------------------------------------------------------- -// -// 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 - -#include "../tests.h" - -int -main() -{ - initlog(); - - KDTree<2> kdtree; - - std::vector> 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> 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 indices; - std::vector 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; - } - } - } -} diff --git a/tests/numerics/kdtree_02.with_nanoflann=true.output b/tests/numerics/kdtree_02.with_nanoflann=true.output deleted file mode 100644 index 67ed6786cc..0000000000 --- a/tests/numerics/kdtree_02.with_nanoflann=true.output +++ /dev/null @@ -1,55 +0,0 @@ - -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 diff --git a/tests/numerics/kdtree_03.cc b/tests/numerics/kdtree_03.cc deleted file mode 100644 index 1da44a5e06..0000000000 --- a/tests/numerics/kdtree_03.cc +++ /dev/null @@ -1,70 +0,0 @@ -// --------------------------------------------------------------------- -// -// 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 - -#include "../tests.h" - -int -main() -{ - initlog(); - - KDTree<2> kdtree; - - std::vector> 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> test_points; - test_points.push_back(Point<2>(2, 0)); - test_points.push_back(Point<2>(2, 2)); - - std::vector 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> 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; - } - } - } -} diff --git a/tests/numerics/kdtree_03.with_nanoflann=true.output b/tests/numerics/kdtree_03.with_nanoflann=true.output deleted file mode 100644 index e4e38ed33b..0000000000 --- a/tests/numerics/kdtree_03.with_nanoflann=true.output +++ /dev/null @@ -1,24 +0,0 @@ - -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 diff --git a/tests/quick_tests/CMakeLists.txt b/tests/quick_tests/CMakeLists.txt index 998f590843..774b17709c 100644 --- a/tests/quick_tests/CMakeLists.txt +++ b/tests/quick_tests/CMakeLists.txt @@ -152,11 +152,6 @@ IF (DEAL_II_WITH_HDF5) 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} "") diff --git a/tests/quick_tests/nanoflann.cc b/tests/quick_tests/nanoflann.cc deleted file mode 100644 index 5e6b6fb03c..0000000000 --- a/tests/quick_tests/nanoflann.cc +++ /dev/null @@ -1,65 +0,0 @@ -// --------------------------------------------------------------------- -// -// 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 - -#include - -using namespace dealii; - - -int -main() -{ - KDTree<2> kdtree; - - std::vector> 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> 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!")); - } -}