From 7cd2fc5259aaa1b362652a026de1c2006ab3a78c Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 2 Jun 2017 16:55:18 +0000 Subject: Get rid of Boost_system library link git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/boost_system_no_deprecated_test@2509 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 52deba0f2212767b99b801810d356e55417225db --- src/Bitmap_cubical_complex/example/CMakeLists.txt | 3 --- src/Bitmap_cubical_complex/test/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src/Bitmap_cubical_complex') diff --git a/src/Bitmap_cubical_complex/example/CMakeLists.txt b/src/Bitmap_cubical_complex/example/CMakeLists.txt index 47f5e0c6..a0401619 100644 --- a/src/Bitmap_cubical_complex/example/CMakeLists.txt +++ b/src/Bitmap_cubical_complex/example/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 2.6) project(Bitmap_cubical_complex_examples) add_executable ( Bitmap_cubical_complex Bitmap_cubical_complex.cpp ) -target_link_libraries(Bitmap_cubical_complex ${Boost_SYSTEM_LIBRARY}) if (TBB_FOUND) target_link_libraries(Bitmap_cubical_complex ${TBB_LIBRARIES}) endif() @@ -14,7 +13,6 @@ add_test(NAME Bitmap_cubical_complex_example_persistence_two_sphere COMMAND $ Date: Mon, 10 Jul 2017 15:05:46 +0000 Subject: Cubical: use +inf instead of UINT_MAX as filtration value for non-simplices. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2595 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c578be16d9559b6d271cdb63be3a58a015735ab7 --- .../include/gudhi/Bitmap_cubical_complex.h | 27 +++++++++++----------- src/cython/test/test_cubical_complex.py | 4 ++-- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/Bitmap_cubical_complex') diff --git a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h index 5a87b9b8..f395de65 100644 --- a/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h +++ b/src/Bitmap_cubical_complex/include/gudhi/Bitmap_cubical_complex.h @@ -97,7 +97,7 @@ class Bitmap_cubical_complex : public T { * with filtration on top dimensional cells. **/ Bitmap_cubical_complex(const std::vector& dimensions, - const std::vector& top_dimensional_cells) : + const std::vector& top_dimensional_cells) : T(dimensions, top_dimensional_cells), key_associated_to_simplex(this->total_number_of_cells + 1) { for (size_t i = 0; i != this->total_number_of_cells; ++i) { @@ -111,13 +111,13 @@ class Bitmap_cubical_complex : public T { /** * Constructor that requires vector of elements of type unsigned, which gives number of top dimensional cells - * in the following directions and vector of element of a type T::filtration_type + * in the following directions and vector of element of a type Filtration_value * with filtration on top dimensional cells. The last parameter of the constructor is a vector of boolean of a length * equal to the dimension of cubical complex. * If the position i on this vector is true, then we impose periodic boundary conditions in this direction. **/ Bitmap_cubical_complex(const std::vector& dimensions, - const std::vector& top_dimensional_cells, + const std::vector& top_dimensional_cells, std::vector< bool > directions_in_which_periodic_b_cond_are_to_be_imposed) : T(dimensions, top_dimensional_cells, directions_in_which_periodic_b_cond_are_to_be_imposed), key_associated_to_simplex(this->total_number_of_cells + 1) { @@ -170,20 +170,20 @@ class Bitmap_cubical_complex : public T { if (globalDbg) { std::cerr << "unsigned dimension(const Simplex_handle& sh)\n"; } - if (sh != std::numeric_limits::max()) return this->get_dimension_of_a_cell(sh); + if (sh != null_simplex()) return this->get_dimension_of_a_cell(sh); return -1; } /** * Return the filtration of a cell pointed by the Simplex_handle. **/ - typename T::filtration_type filtration(Simplex_handle sh) { + Filtration_value filtration(Simplex_handle sh) { if (globalDbg) { - std::cerr << "T::filtration_type filtration(const Simplex_handle& sh)\n"; + std::cerr << "Filtration_value filtration(const Simplex_handle& sh)\n"; } // Returns the filtration value of a simplex. - if (sh != std::numeric_limits::max()) return this->data[sh]; - return std::numeric_limits::max(); + if (sh != null_simplex()) return this->data[sh]; + return std::numeric_limits::infinity(); } /** @@ -203,7 +203,7 @@ class Bitmap_cubical_complex : public T { if (globalDbg) { std::cerr << "Simplex_key key(const Simplex_handle& sh)\n"; } - if (sh != std::numeric_limits::max()) { + if (sh != null_simplex()) { return this->key_associated_to_simplex[sh]; } return this->null_key(); @@ -216,7 +216,7 @@ class Bitmap_cubical_complex : public T { if (globalDbg) { std::cerr << "Simplex_handle simplex(Simplex_key key)\n"; } - if (key != std::numeric_limits::max()) { + if (key != null_key()) { return this->simplex_associated_to_key[ key ]; } return null_simplex(); @@ -229,7 +229,7 @@ class Bitmap_cubical_complex : public T { if (globalDbg) { std::cerr << "void assign_key(Simplex_handle& sh, Simplex_key key)\n"; } - if (key == std::numeric_limits::max()) return; + if (key == null_key()) return; this->key_associated_to_simplex[sh] = key; this->simplex_associated_to_key[key] = sh; } @@ -566,8 +566,9 @@ class is_before_in_filtration { bool operator()(const typename Bitmap_cubical_complex::Simplex_handle& sh1, const typename Bitmap_cubical_complex::Simplex_handle& sh2) const { // Not using st_->filtration(sh1) because it uselessly tests for null_simplex. - typename T::filtration_type fil1 = CC_->data[sh1]; - typename T::filtration_type fil2 = CC_->data[sh2]; + typedef typename T::filtration_type Filtration_value; + Filtration_value fil1 = CC_->data[sh1]; + Filtration_value fil2 = CC_->data[sh2]; if (fil1 != fil2) { return fil1 < fil2; } diff --git a/src/cython/test/test_cubical_complex.py b/src/cython/test/test_cubical_complex.py index 2e281ee4..9a365823 100755 --- a/src/cython/test/test_cubical_complex.py +++ b/src/cython/test/test_cubical_complex.py @@ -67,7 +67,7 @@ def test_dimension_constructor(): top_dimensional_cells = [1,2,3,4,5,6,7,8,9]) assert cub.__is_defined() == True assert cub.__is_persistence_defined() == False - assert cub.persistence() == [(1, (0.0, 100.0)), (0, (0.0, 1.8446744073709552e+19))] + assert cub.persistence() == [(1, (0.0, 100.0)), (0, (0.0, float('inf')))] assert cub.__is_persistence_defined() == True assert cub.betti_numbers() == [1, 0] assert cub.persistent_betti_numbers(0, 1000) == [0, 0] @@ -80,7 +80,7 @@ def test_dimension_constructor(): cub = CubicalComplex(perseus_file='CubicalOneSphere.txt') assert cub.__is_defined() == True assert cub.__is_persistence_defined() == False - assert cub.persistence() == [(1, (0.0, 100.0)), (0, (0.0, 1.8446744073709552e+19))] + assert cub.persistence() == [(1, (0.0, 100.0)), (0, (0.0, float('inf')))] assert cub.__is_persistence_defined() == True assert cub.betti_numbers() == [1, 0, 0] assert cub.persistent_betti_numbers(0, 1000) == [1, 0, 0] -- cgit v1.2.3 From 526625e6faa7b01430b481d5c21d7d7dfe16e290 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 27 Sep 2017 20:25:21 +0000 Subject: Fix some cpplints git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_remove_useless_global_filtration@2721 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 76b127e54d9511b70294ab48336ca6dbd6fdb1d6 --- ...Bitmap_cubical_complex_periodic_boundary_conditions.cpp | 1 + src/Bottleneck_distance/include/gudhi/Neighbors_finder.h | 8 ++++---- src/Spatial_searching/include/gudhi/Kd_tree_search.h | 14 ++++++-------- src/common/utilities/off_file_from_shape_generator.cpp | 2 +- src/cython/include/Reader_utils_interface.h | 2 ++ 5 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/Bitmap_cubical_complex') diff --git a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp index f8754345..122160a2 100644 --- a/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp +++ b/src/Bitmap_cubical_complex/example/Bitmap_cubical_complex_periodic_boundary_conditions.cpp @@ -30,6 +30,7 @@ #include #include #include +#include int main(int argc, char** argv) { std::cout << "This program computes persistent homology, by using " << diff --git a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h index bdc47578..a6b9b021 100644 --- a/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h +++ b/src/Bottleneck_distance/include/gudhi/Neighbors_finder.h @@ -44,16 +44,16 @@ struct Square_query { typedef Internal_point Point_d; typedef double FT; bool contains(Point_d p) const { - return std::abs(p.x()-c.x())<=size && std::abs(p.y()-c.y())<=size; + return std::abs(p.x()-c.x()) <= size && std::abs(p.y()-c.y()) <= size; } - bool inner_range_intersects(CGAL::Kd_tree_rectangle const&r) const { + bool inner_range_intersects(CGAL::Kd_tree_rectangle const&r) const { return r.max_coord(0) >= c.x() - size && r.min_coord(0) <= c.x() + size && r.max_coord(1) >= c.y() - size && r.min_coord(1) <= c.y() + size; } - bool outer_range_contains(CGAL::Kd_tree_rectangle const&r) const { + bool outer_range_contains(CGAL::Kd_tree_rectangle const&r) const { return r.min_coord(0) >= c.x() - size && r.max_coord(0) <= c.x() + size && @@ -146,7 +146,7 @@ inline int Neighbors_finder::pull_near(int u_point_index) { // Is the query point near to a V point in the plane ? Internal_point u_point = g.get_u_point(u_point_index); auto neighbor = kd_t.search_any_point(Square_query{u_point, r}); - if(!neighbor) + if (!neighbor) return null_point_index(); tmp = neighbor->point_index; auto point = g.get_v_point(tmp); diff --git a/src/Spatial_searching/include/gudhi/Kd_tree_search.h b/src/Spatial_searching/include/gudhi/Kd_tree_search.h index a4385c84..af04736b 100644 --- a/src/Spatial_searching/include/gudhi/Kd_tree_search.h +++ b/src/Spatial_searching/include/gudhi/Kd_tree_search.h @@ -193,7 +193,7 @@ class Kd_tree_search { /// \brief Search incrementally for the nearest neighbors from a query point. /// @param[in] p The query point. /// @param[in] eps Approximation factor. - /// @return A range (whose `value_type` is `std::size_t`) containing the + /// @return A range (whose `value_type` is `std::size_t`) containing the /// neighbors sorted by their distance to p. /// All the neighbors are not computed by this function, but they will be /// computed incrementally when the iterator on the range is incremented. @@ -239,7 +239,7 @@ class Kd_tree_search { /// \brief Search incrementally for the farthest neighbors from a query point. /// @param[in] p The query point. /// @param[in] eps Approximation factor. - /// @return A range (whose `value_type` is `std::size_t`) + /// @return A range (whose `value_type` is `std::size_t`) /// containing the neighbors sorted by their distance to p. /// All the neighbors are not computed by this function, but they will be /// computed incrementally when the iterator on the range is incremented. @@ -264,12 +264,10 @@ class Kd_tree_search { /// Note: `it` is used this way: `*it++ = each_point`. /// @param[in] eps Approximation factor. template - void near_search( - Point const& p, - FT radius, - OutputIterator it, - FT eps = FT(0)) const { - + void near_search(Point const& p, + FT radius, + OutputIterator it, + FT eps = FT(0)) const { m_tree.search(it, Fuzzy_sphere(p, radius, eps, m_tree.traits())); } diff --git a/src/common/utilities/off_file_from_shape_generator.cpp b/src/common/utilities/off_file_from_shape_generator.cpp index 0f310a13..afcd558c 100644 --- a/src/common/utilities/off_file_from_shape_generator.cpp +++ b/src/common/utilities/off_file_from_shape_generator.cpp @@ -77,7 +77,7 @@ int main(int argc, char **argv) { usage(argv[0]); } - enum class Data_shape { sphere, cube, curve, torus, klein, undefined } ; + enum class Data_shape { sphere, cube, curve, torus, klein, undefined}; Data_shape shape = Data_shape::undefined; if (memcmp(argv[2], "sphere", sizeof("sphere")) == 0) { diff --git a/src/cython/include/Reader_utils_interface.h b/src/cython/include/Reader_utils_interface.h index b87b6cca..8ec34f61 100644 --- a/src/cython/include/Reader_utils_interface.h +++ b/src/cython/include/Reader_utils_interface.h @@ -28,6 +28,8 @@ #include #include #include +#include +#include // for pair<> namespace Gudhi { -- cgit v1.2.3