From f0e5330a88f9e89a887769ab79f6db6dd4e1c35a Mon Sep 17 00:00:00 2001 From: glisse Date: Mon, 12 Dec 2016 05:23:28 +0000 Subject: Boost bug https://svn.boost.org/trac/boost/ticket/12534 git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1847 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 063ad9bf7bcf1163dc4935f8bdd93d6ea334609f --- src/GudhUI/gui/MainWindow.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/GudhUI') diff --git a/src/GudhUI/gui/MainWindow.h b/src/GudhUI/gui/MainWindow.h index c8c3fcf6..3fe0d720 100644 --- a/src/GudhUI/gui/MainWindow.h +++ b/src/GudhUI/gui/MainWindow.h @@ -26,6 +26,9 @@ // Workaround for moc-qt4 not parsing boost headers #include +// Workaround https://svn.boost.org/trac/boost/ticket/12534 +#include + #include #include "ui_main_window.h" #include "model/Model.h" -- cgit v1.2.3 From de0bdf55c16de11d47809dc6f347773b10cc3673 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 16 Dec 2016 16:11:45 +0000 Subject: Warning fixes git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1905 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7b7222ebe65fd01fde30f8ba527ebaee633fc87e --- src/Contraction/example/Garland_heckbert.cpp | 12 ++--- src/GudhUI/utils/Critical_points.h | 2 - src/GudhUI/utils/Is_manifold.h | 1 - src/GudhUI/utils/Vertex_collapsor.h | 1 - .../include/gudhi/choose_n_farthest_points.h | 3 +- .../include/gudhi/pick_n_random_points.h | 4 +- .../test/test_choose_n_farthest_points.cpp | 55 ++++++++++++++++++++-- .../include/gudhi/Tangential_complex.h | 10 +--- .../test/test_tangential_complex.cpp | 2 - src/common/include/gudhi/random_point_generators.h | 7 ++- 10 files changed, 63 insertions(+), 34 deletions(-) (limited to 'src/GudhUI') diff --git a/src/Contraction/example/Garland_heckbert.cpp b/src/Contraction/example/Garland_heckbert.cpp index 5347830c..4689519f 100644 --- a/src/Contraction/example/Garland_heckbert.cpp +++ b/src/Contraction/example/Garland_heckbert.cpp @@ -63,12 +63,10 @@ typedef Skeleton_blocker_contractor Complex_contractor; * the point minimizing the cost of the quadric. */ class GH_placement : public Gudhi::contraction::Placement_policy { - Complex& complex_; - public: typedef Gudhi::contraction::Placement_policy::Placement_type Placement_type; - GH_placement(Complex& complex) : complex_(complex) { } + GH_placement(Complex& complex) { } Placement_type operator()(const EdgeProfile& profile) const override { auto sum_quad(profile.v0().quadric); @@ -87,12 +85,10 @@ class GH_placement : public Gudhi::contraction::Placement_policy { * which expresses a squared distances with triangles planes. */ class GH_cost : public Gudhi::contraction::Cost_policy { - Complex& complex_; - public: typedef Gudhi::contraction::Cost_policy::Cost_type Cost_type; - GH_cost(Complex& complex) : complex_(complex) { } + GH_cost(Complex& complex) { } Cost_type operator()(EdgeProfile const& profile, boost::optional const& new_point) const override { Cost_type res; @@ -111,10 +107,8 @@ class GH_cost : public Gudhi::contraction::Cost_policy { * and we update them when contracting an edge (the quadric become the sum of both quadrics). */ class GH_visitor : public Gudhi::contraction::Contraction_visitor { - Complex& complex_; - public: - GH_visitor(Complex& complex) : complex_(complex) { } + GH_visitor(Complex& complex) { } // Compute quadrics for every vertex v // The quadric of v consists in the sum of quadric diff --git a/src/GudhUI/utils/Critical_points.h b/src/GudhUI/utils/Critical_points.h index 3021a5fe..b88293e9 100644 --- a/src/GudhUI/utils/Critical_points.h +++ b/src/GudhUI/utils/Critical_points.h @@ -105,8 +105,6 @@ template class Critical_points { if (link.empty()) return 0; - Edge_contractor contractor(link, link.num_vertices() - 1); - if (link.num_connected_components() > 1) // one than more CC -> not contractible return 0; diff --git a/src/GudhUI/utils/Is_manifold.h b/src/GudhUI/utils/Is_manifold.h index 0640ea47..6dd7898e 100644 --- a/src/GudhUI/utils/Is_manifold.h +++ b/src/GudhUI/utils/Is_manifold.h @@ -76,7 +76,6 @@ template class Is_manifold { bool is_k_sphere(Vertex_handle v, int k) { auto link = input_complex_.link(v); - Edge_contractor contractor(link, link.num_vertices() - 1); return (is_sphere_simplex(link) == k); } diff --git a/src/GudhUI/utils/Vertex_collapsor.h b/src/GudhUI/utils/Vertex_collapsor.h index 2b36cb3a..3f0e7ffd 100644 --- a/src/GudhUI/utils/Vertex_collapsor.h +++ b/src/GudhUI/utils/Vertex_collapsor.h @@ -80,7 +80,6 @@ template class Vertex_collapsor { if (link.empty()) return false; if (link.is_cone()) return true; if (link.num_connected_components() > 1) return false; - Edge_contractor contractor(link, link.num_vertices() - 1); return (link.num_vertices() == 1); } }; diff --git a/src/Subsampling/include/gudhi/choose_n_farthest_points.h b/src/Subsampling/include/gudhi/choose_n_farthest_points.h index ea387bf9..5e908090 100644 --- a/src/Subsampling/include/gudhi/choose_n_farthest_points.h +++ b/src/Subsampling/include/gudhi/choose_n_farthest_points.h @@ -145,7 +145,8 @@ void choose_n_farthest_points(Kernel const& k, std::random_device rd; std::mt19937 gen(rd()); std::uniform_int_distribution<> dis(0, (input_pts.size() - 1)); - int starting_point = dis(gen); + std::size_t starting_point = dis(gen); + choose_n_farthest_points(k, input_pts, final_size, starting_point, output_it); } diff --git a/src/Subsampling/include/gudhi/pick_n_random_points.h b/src/Subsampling/include/gudhi/pick_n_random_points.h index e89b2b2d..f0e3f1f1 100644 --- a/src/Subsampling/include/gudhi/pick_n_random_points.h +++ b/src/Subsampling/include/gudhi/pick_n_random_points.h @@ -57,7 +57,9 @@ void pick_n_random_points(Point_container const &points, #endif std::size_t nbP = boost::size(points); - assert(nbP >= final_size); + if (final_size > nbP) + final_size = nbP; + std::vector landmarks(nbP); std::iota(landmarks.begin(), landmarks.end(), 0); diff --git a/src/Subsampling/test/test_choose_n_farthest_points.cpp b/src/Subsampling/test/test_choose_n_farthest_points.cpp index d064899a..0bc0dff4 100644 --- a/src/Subsampling/test/test_choose_n_farthest_points.cpp +++ b/src/Subsampling/test/test_choose_n_farthest_points.cpp @@ -39,18 +39,65 @@ typedef CGAL::Epick_d K; typedef typename K::FT FT; typedef typename K::Point_d Point_d; -BOOST_AUTO_TEST_CASE(test_choose_farthest_point) { +typedef boost::mpl::list, CGAL::Epick_d>> list_of_tested_kernels; + +BOOST_AUTO_TEST_CASE_TEMPLATE(test_choose_farthest_point, Kernel, list_of_tested_kernels) { + typedef typename Kernel::FT FT; + typedef typename Kernel::Point_d Point_d; std::vector< Point_d > points, landmarks; // Add grid points (625 points) for (FT i = 0; i < 5; i += 1.0) for (FT j = 0; j < 5; j += 1.0) for (FT k = 0; k < 5; k += 1.0) - for (FT l = 0; l < 5; l += 1.0) - points.push_back(Point_d(std::vector({i, j, k, l}))); + for (FT l = 0; l < 5; l += 1.0) { + std::vector point({i, j, k, l}); + points.push_back(Point_d(point.begin(), point.end())); + } landmarks.clear(); - K k; + Kernel k; Gudhi::subsampling::choose_n_farthest_points(k, points, 100, std::back_inserter(landmarks)); BOOST_CHECK(landmarks.size() == 100); + for (auto landmark : landmarks) + { + // Check all landmarks are in points + BOOST_CHECK(std::find (points.begin(), points.end(), landmark) != points.end()); + } +} + +BOOST_AUTO_TEST_CASE_TEMPLATE(test_choose_farthest_point_limits, Kernel, list_of_tested_kernels) { + typedef typename Kernel::FT FT; + typedef typename Kernel::Point_d Point_d; + std::vector< Point_d > points, landmarks; + landmarks.clear(); + Kernel k; + // Choose -1 farthest points in an empty point cloud + Gudhi::subsampling::choose_n_farthest_points(k, points, -1, std::back_inserter(landmarks)); + BOOST_CHECK(landmarks.size() == 0); + landmarks.clear(); + // Choose 0 farthest points in an empty point cloud + Gudhi::subsampling::choose_n_farthest_points(k, points, 0, std::back_inserter(landmarks)); + BOOST_CHECK(landmarks.size() == 0); + landmarks.clear(); + // Choose 1 farthest points in an empty point cloud + Gudhi::subsampling::choose_n_farthest_points(k, points, 1, std::back_inserter(landmarks)); + BOOST_CHECK(landmarks.size() == 0); + landmarks.clear(); + + std::vector point({0.0, 0.0, 0.0, 0.0}); + points.push_back(Point_d(point.begin(), point.end())); + // Choose -1 farthest points in an empty point cloud + Gudhi::subsampling::choose_n_farthest_points(k, points, -1, std::back_inserter(landmarks)); + BOOST_CHECK(landmarks.size() == 1); + landmarks.clear(); + // Choose 0 farthest points in a one point cloud + Gudhi::subsampling::choose_n_farthest_points(k, points, 0, std::back_inserter(landmarks)); + BOOST_CHECK(landmarks.size() == 0); + landmarks.clear(); + // Choose 1 farthest points in a one point cloud + Gudhi::subsampling::choose_n_farthest_points(k, points, 1, std::back_inserter(landmarks)); + BOOST_CHECK(landmarks.size() == 1); + landmarks.clear(); + } diff --git a/src/Tangential_complex/include/gudhi/Tangential_complex.h b/src/Tangential_complex/include/gudhi/Tangential_complex.h index 65de2743..cfc82eb1 100644 --- a/src/Tangential_complex/include/gudhi/Tangential_complex.h +++ b/src/Tangential_complex/include/gudhi/Tangential_complex.h @@ -1314,14 +1314,6 @@ class Tangential_complex { m_k.construct_vector_d_object(); typename K::Compute_coordinate_d coord = m_k.compute_coordinate_d_object(); - typename K::Squared_length_d sqlen = - m_k.squared_length_d_object(); - typename K::Scaled_vector_d scaled_vec = - m_k.scaled_vector_d_object(); - typename K::Scalar_product_d scalar_pdct = - m_k.scalar_product_d_object(); - typename K::Difference_of_vectors_d diff_vec = - m_k.difference_of_vectors_d_object(); #ifdef GUDHI_TC_USE_ANOTHER_POINT_SET_FOR_TANGENT_SPACE_ESTIM KNS_range kns_range = m_points_ds_for_tse.query_k_nearest_neighbors( @@ -2159,7 +2151,7 @@ class Tangential_complex { typedef std::vector Triangles; Triangles triangles; - std::size_t num_vertices = c.size(); + int num_vertices = static_cast(c.size()); // Do not export smaller dimension simplices if (num_vertices < m_intrinsic_dim + 1) continue; diff --git a/src/Tangential_complex/test/test_tangential_complex.cpp b/src/Tangential_complex/test/test_tangential_complex.cpp index ebe5cdb4..48156440 100644 --- a/src/Tangential_complex/test/test_tangential_complex.cpp +++ b/src/Tangential_complex/test/test_tangential_complex.cpp @@ -71,9 +71,7 @@ BOOST_AUTO_TEST_CASE(test_Spatial_tree_data_structure) { BOOST_AUTO_TEST_CASE(test_mini_tangential) { typedef CGAL::Epick_d Kernel; - typedef Kernel::FT FT; typedef Kernel::Point_d Point; - typedef Kernel::Vector_d Vector; typedef tc::Tangential_complex TC; diff --git a/src/common/include/gudhi/random_point_generators.h b/src/common/include/gudhi/random_point_generators.h index c643a1e3..2ec465ef 100644 --- a/src/common/include/gudhi/random_point_generators.h +++ b/src/common/include/gudhi/random_point_generators.h @@ -192,10 +192,9 @@ static void generate_uniform_points_on_torus_d(const Kernel &k, int dim, std::si double radius_noise_percentage = 0., std::vector current_point = std::vector()) { CGAL::Random rng; - if (current_point.size() == 2 * dim) { - *out++ = k.construct_point_d_object()( - static_cast (current_point.size()), - current_point.begin(), current_point.end()); + int point_size = static_cast(current_point.size()); + if (point_size == 2 * dim) { + *out++ = k.construct_point_d_object()(point_size, current_point.begin(), current_point.end()); } else { for (std::size_t slice_idx = 0; slice_idx < num_slices; ++slice_idx) { double radius_noise_ratio = 1.; -- cgit v1.2.3