From 2d103de78114f3d4ac4a49e8e244824f0fbb3a25 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 14 Nov 2018 10:45:37 +0000 Subject: Fix cpplint git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3981 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6ce28c75070b0f5d962472f5452e4b03fccbd94f --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 13d7372c..78697ea2 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -323,8 +323,7 @@ class Simplex_tree { } /** \brief User-defined copy assignment reproduces the whole tree structure. */ - Simplex_tree& operator= (const Simplex_tree& complex_source) - { + Simplex_tree& operator= (const Simplex_tree& complex_source) { #ifdef DEBUG_TRACES std::cout << "Simplex_tree copy assignment" << std::endl; #endif // DEBUG_TRACES @@ -341,8 +340,7 @@ class Simplex_tree { /** \brief User-defined move assignment relocates the whole tree structure. * \exception std::invalid_argument In debug mode, if the complex_source is invalid. */ - Simplex_tree& operator=(Simplex_tree&& complex_source) - { + Simplex_tree& operator=(Simplex_tree&& complex_source) { #ifdef DEBUG_TRACES std::cout << "Simplex_tree move assignment" << std::endl; #endif // DEBUG_TRACES -- cgit v1.2.3 From 743306053c7ad2bad617e3e48fb95545d619cdb2 Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 17 Nov 2018 16:54:34 +0000 Subject: Repeated "if" in the doc. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/AC-glisse@3998 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 39df24b52cd76333ffcdadfb7d9102ff8c29c3c8 --- src/Alpha_complex/doc/Intro_alpha_complex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Alpha_complex/doc/Intro_alpha_complex.h b/src/Alpha_complex/doc/Intro_alpha_complex.h index 648fb6d6..2fe9f4ca 100644 --- a/src/Alpha_complex/doc/Intro_alpha_complex.h +++ b/src/Alpha_complex/doc/Intro_alpha_complex.h @@ -106,7 +106,7 @@ namespace alpha_complex { * \quad\quad\quad\quad \text{filtration(} \tau \text{) = min( filtration(} \tau \text{), filtration(} \sigma * \text{) )}\\ * \quad\quad\quad \textbf{else}\\ - * \quad\quad\quad\quad \textbf{if } \textbf{if } \tau \text{ is not Gabriel for } \sigma \textbf{ then}\\ + * \quad\quad\quad\quad \textbf{if } \tau \text{ is not Gabriel for } \sigma \textbf{ then}\\ * \quad\quad\quad\quad\quad \text{filtration(} \tau \text{) = filtration(} \sigma \text{)}\\ * \quad\quad\quad\quad \textbf{end if}\\ * \quad\quad\quad \textbf{end if}\\ -- cgit v1.2.3 From 5bf47de6d86a0ea718937ca1dc950bfefad4f211 Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 17 Nov 2018 16:55:05 +0000 Subject: Simplify example. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/AC-glisse@3999 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ec94f4c900994fea36d76663a352bf9a5cf232c9 --- .../example/Alpha_complex_from_points.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/Alpha_complex/example/Alpha_complex_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_from_points.cpp index c19f7cc8..981aa470 100644 --- a/src/Alpha_complex/example/Alpha_complex_from_points.cpp +++ b/src/Alpha_complex/example/Alpha_complex_from_points.cpp @@ -5,29 +5,13 @@ #include #include -#include #include -#include // for numeric limits using Kernel = CGAL::Epick_d< CGAL::Dimension_tag<2> >; using Point = Kernel::Point_d; using Vector_of_points = std::vector; -void usage(int nbArgs, char * const progName) { - std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n"; - std::cerr << "Usage: " << progName << " [alpha_square_max_value]\n"; - std::cerr << " i.e.: " << progName << " 60.0\n"; - exit(-1); // ----- >> -} - -int main(int argc, char **argv) { - if ((argc != 1) && (argc != 2)) usage(argc, (argv[0] - 1)); - - // Delaunay complex if alpha_square_max_value is not given by the user. - double alpha_square_max_value {std::numeric_limits::infinity()}; - if (argc == 2) - alpha_square_max_value = atof(argv[1]); - +int main() { // ---------------------------------------------------------------------------- // Init of a list of points // ---------------------------------------------------------------------------- @@ -46,7 +30,7 @@ int main(int argc, char **argv) { Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); Gudhi::Simplex_tree<> simplex; - if (alpha_complex_from_points.create_complex(simplex, alpha_square_max_value)) { + if (alpha_complex_from_points.create_complex(simplex)) { // ---------------------------------------------------------------------------- // Display information about the alpha complex // ---------------------------------------------------------------------------- -- cgit v1.2.3 From be73897dd4288a66dad29c2b8331c35dcc6aeebd Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 17 Nov 2018 16:57:38 +0000 Subject: Make it clearer that create_complex can/should be called without a second argument. Move the test restricting propagation to dim>1 earlier. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/AC-glisse@4000 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 108a3ce1b96e097d5218f9154c7f17c13203cfa1 --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 73 +++++++++++-------------- 1 file changed, 33 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 4c07eddb..38fb6772 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -228,11 +228,6 @@ class Alpha_complex { } public: - template - bool create_complex(SimplicialComplexForAlpha& complex) { - typedef typename SimplicialComplexForAlpha::Filtration_value Filtration_value; - return create_complex(complex, std::numeric_limits::infinity()); - } /** \brief Inserts all Delaunay triangulation into the simplicial complex. * It also computes the filtration values accordingly to the \ref createcomplexalgorithm @@ -240,7 +235,7 @@ class Alpha_complex { * \tparam SimplicialComplexForAlpha must meet `SimplicialComplexForAlpha` concept. * * @param[in] complex SimplicialComplexForAlpha to be created. - * @param[in] max_alpha_square maximum for alpha square value. Default value is +\f$\infty\f$. + * @param[in] max_alpha_square maximum for alpha square value. Default value is +\f$\infty\f$, and there is very little point using anything else since it does not save time. * * @return true if creation succeeds, false otherwise. * @@ -249,8 +244,8 @@ class Alpha_complex { * * Initialization can be launched once. */ - template - bool create_complex(SimplicialComplexForAlpha& complex, Filtration_value max_alpha_square) { + template + bool create_complex(SimplicialComplexForAlpha& complex, Filtration_value max_alpha_square = std::numeric_limits::infinity()) { // From SimplicialComplexForAlpha type required to insert into a simplicial complex (with or without subfaces). typedef typename SimplicialComplexForAlpha::Vertex_handle Vertex_handle; typedef typename SimplicialComplexForAlpha::Simplex_handle Simplex_handle; @@ -333,7 +328,9 @@ class Alpha_complex { std::cout << "filt(Sigma) is NaN : filt(Sigma) =" << complex.filtration(f_simplex) << std::endl; #endif // DEBUG_TRACES } - propagate_alpha_filtration(complex, f_simplex, decr_dim); + // No need to propagate further, unweighted points all have value 0 + if (decr_dim > 1) + propagate_alpha_filtration(complex, f_simplex, decr_dim); } } } @@ -379,46 +376,42 @@ class Alpha_complex { #endif // DEBUG_TRACES // ### Else } else { - // No need to compute is_gabriel for dimension <= 2 - // i.e. : Sigma = (3,1) => Tau = 1 - if (decr_dim > 1) { - // insert the Tau points in a vector for is_gabriel function - Vector_of_CGAL_points pointVector; + // insert the Tau points in a vector for is_gabriel function + Vector_of_CGAL_points pointVector; #ifdef DEBUG_TRACES - Vertex_handle vertexForGabriel = Vertex_handle(); + Vertex_handle vertexForGabriel = Vertex_handle(); #endif // DEBUG_TRACES - for (auto vertex : complex.simplex_vertex_range(f_boundary)) { - pointVector.push_back(get_point(vertex)); - } - // Retrieve the Sigma point that is not part of Tau - parameter for is_gabriel function - Point_d point_for_gabriel; - for (auto vertex : complex.simplex_vertex_range(f_simplex)) { - point_for_gabriel = get_point(vertex); - if (std::find(pointVector.begin(), pointVector.end(), point_for_gabriel) == pointVector.end()) { + for (auto vertex : complex.simplex_vertex_range(f_boundary)) { + pointVector.push_back(get_point(vertex)); + } + // Retrieve the Sigma point that is not part of Tau - parameter for is_gabriel function + Point_d point_for_gabriel; + for (auto vertex : complex.simplex_vertex_range(f_simplex)) { + point_for_gabriel = get_point(vertex); + if (std::find(pointVector.begin(), pointVector.end(), point_for_gabriel) == pointVector.end()) { #ifdef DEBUG_TRACES - // vertex is not found in Tau - vertexForGabriel = vertex; + // vertex is not found in Tau + vertexForGabriel = vertex; #endif // DEBUG_TRACES - // No need to continue loop - break; - } + // No need to continue loop + break; } - // is_gabriel function initialization - Is_Gabriel is_gabriel = kernel_.side_of_bounded_sphere_d_object(); - bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel) - != CGAL::ON_BOUNDED_SIDE; + } + // is_gabriel function initialization + Is_Gabriel is_gabriel = kernel_.side_of_bounded_sphere_d_object(); + bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel) + != CGAL::ON_BOUNDED_SIDE; #ifdef DEBUG_TRACES - std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl; + std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl; #endif // DEBUG_TRACES - // ### If Tau is not Gabriel of Sigma - if (false == is_gab) { - // ### filt(Tau) = filt(Sigma) - Filtration_value alpha_complex_filtration = complex.filtration(f_simplex); - complex.assign_filtration(f_boundary, alpha_complex_filtration); + // ### If Tau is not Gabriel of Sigma + if (false == is_gab) { + // ### filt(Tau) = filt(Sigma) + Filtration_value alpha_complex_filtration = complex.filtration(f_simplex); + complex.assign_filtration(f_boundary, alpha_complex_filtration); #ifdef DEBUG_TRACES - std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl; + std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl; #endif // DEBUG_TRACES - } } } } -- cgit v1.2.3 From 2ead33fd01bbe97e3b88070d169647c68c3db359 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 19 Nov 2018 21:56:16 +0000 Subject: Fix cpplint and no more need of incr_dim in propagate_alpha_filtration git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@4002 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 7e4a3924d93b8bbb235376bf074811ec827f4e9d --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 38fb6772..08db14fb 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -235,7 +235,8 @@ class Alpha_complex { * \tparam SimplicialComplexForAlpha must meet `SimplicialComplexForAlpha` concept. * * @param[in] complex SimplicialComplexForAlpha to be created. - * @param[in] max_alpha_square maximum for alpha square value. Default value is +\f$\infty\f$, and there is very little point using anything else since it does not save time. + * @param[in] max_alpha_square maximum for alpha square value. Default value is +\f$\infty\f$, and there is very + * little point using anything else since it does not save time. * * @return true if creation succeeds, false otherwise. * @@ -244,8 +245,10 @@ class Alpha_complex { * * Initialization can be launched once. */ - template - bool create_complex(SimplicialComplexForAlpha& complex, Filtration_value max_alpha_square = std::numeric_limits::infinity()) { + template + bool create_complex(SimplicialComplexForAlpha& complex, + Filtration_value max_alpha_square = std::numeric_limits::infinity()) { // From SimplicialComplexForAlpha type required to insert into a simplicial complex (with or without subfaces). typedef typename SimplicialComplexForAlpha::Vertex_handle Vertex_handle; typedef typename SimplicialComplexForAlpha::Simplex_handle Simplex_handle; @@ -267,7 +270,9 @@ class Alpha_complex { // -------------------------------------------------------------------------------------------- // Simplex_tree construction from loop on triangulation finite full cells list if (triangulation_->number_of_vertices() > 0) { - for (auto cit = triangulation_->finite_full_cells_begin(); cit != triangulation_->finite_full_cells_end(); ++cit) { + for (auto cit = triangulation_->finite_full_cells_begin(); + cit != triangulation_->finite_full_cells_end(); + ++cit) { Vector_vertex vertexVector; #ifdef DEBUG_TRACES std::cout << "Simplex_tree insertion "; @@ -330,7 +335,7 @@ class Alpha_complex { } // No need to propagate further, unweighted points all have value 0 if (decr_dim > 1) - propagate_alpha_filtration(complex, f_simplex, decr_dim); + propagate_alpha_filtration(complex, f_simplex); } } } @@ -347,7 +352,7 @@ class Alpha_complex { private: template - void propagate_alpha_filtration(SimplicialComplexForAlpha& complex, Simplex_handle f_simplex, int decr_dim) { + void propagate_alpha_filtration(SimplicialComplexForAlpha& complex, Simplex_handle f_simplex) { // From SimplicialComplexForAlpha type required to assign filtration values. typedef typename SimplicialComplexForAlpha::Filtration_value Filtration_value; #ifdef DEBUG_TRACES -- cgit v1.2.3