From f82dc289e2ebe3eb257c42f27876fbc1c64341dd Mon Sep 17 00:00:00 2001 From: glisse Date: Fri, 11 Dec 2015 08:08:40 +0000 Subject: Clarify the semantics of FilteredComplex::simplex(key). git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@941 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a2cb908a642ef53c5de25ba5113e03bb45652b9b --- src/Persistent_cohomology/concept/FilteredComplex.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Persistent_cohomology/concept/FilteredComplex.h') diff --git a/src/Persistent_cohomology/concept/FilteredComplex.h b/src/Persistent_cohomology/concept/FilteredComplex.h index 1834903b..e124d524 100644 --- a/src/Persistent_cohomology/concept/FilteredComplex.h +++ b/src/Persistent_cohomology/concept/FilteredComplex.h @@ -65,9 +65,9 @@ struct FilteredComplex Simplex_key key ( Simplex_handle sh ); /** \brief Returns the simplex associated to a key. * - * If key is different from null_key(), there must be a unique - * simplex having this key. */ - Simplex_handle simplex ( Simplex_key key ); + * If key is different from null_key(), returns the simplex that + * has index idx in the filtration. */ + Simplex_handle simplex ( Simplex_key idx ); /** \brief Assign a key to a simplex. */ void assign_key(Simplex_handle sh, Simplex_key key); -- cgit v1.2.3 From 2e66c57e9290fd1ac0304dbd8050bb57ead4b683 Mon Sep 17 00:00:00 2001 From: glisse Date: Sun, 20 Mar 2016 13:22:02 +0000 Subject: Clarify some details in the concept FilteredComplex. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@1058 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 825978488684e4dcf5b4fc491e6c4467332dbd20 --- src/Persistent_cohomology/concept/FilteredComplex.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Persistent_cohomology/concept/FilteredComplex.h') diff --git a/src/Persistent_cohomology/concept/FilteredComplex.h b/src/Persistent_cohomology/concept/FilteredComplex.h index e124d524..e47babe4 100644 --- a/src/Persistent_cohomology/concept/FilteredComplex.h +++ b/src/Persistent_cohomology/concept/FilteredComplex.h @@ -43,7 +43,7 @@ struct FilteredComplex * is model of IndexingTag. */ typedef unspecified Indexing_tag; -/** Returns a Simplex_hanlde that is different from all simplex handles +/** Returns a Simplex_handle that is different from all simplex handles * of the simplices. */ Simplex_handle null_simplex(); /** \brief Returns the number of simplices in the complex. @@ -61,12 +61,13 @@ struct FilteredComplex /** \brief Returns a key that is different from the keys associated * to the simplices. */ Simplex_key null_key (); -/** \brief Returns the key associated to a simplex. */ +/** \brief Returns the key associated to a simplex. + * + * This is never called on null_simplex(). */ Simplex_key key ( Simplex_handle sh ); -/** \brief Returns the simplex associated to a key. - * - * If key is different from null_key(), returns the simplex that - * has index idx in the filtration. */ +/** \brief Returns the simplex that has index idx in the filtration. + * + * This is never called on null_key(). */ Simplex_handle simplex ( Simplex_key idx ); /** \brief Assign a key to a simplex. */ void assign_key(Simplex_handle sh, Simplex_key key); -- cgit v1.2.3 From 8e76285d6d2ea35a9709117896390b718f1f15f1 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 6 Apr 2016 21:11:38 +0000 Subject: Marc review fix cpplint/cppcheck fix git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@1102 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: f47277da05debb56dd9a4a96bf89ec7b3ffa2e27 --- src/Alpha_complex/include/gudhi/Alpha_complex.h | 22 ++++++++-------------- .../concept/FilteredComplex.h | 2 +- src/common/example/CGAL_points_off_reader.cpp | 1 + src/common/include/gudhi/Off_reader.h | 1 + src/common/include/gudhi/Points_off_io.h | 7 +++---- 5 files changed, 14 insertions(+), 19 deletions(-) (limited to 'src/Persistent_cohomology/concept/FilteredComplex.h') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index 21eb5f48..753fa58a 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -33,7 +33,6 @@ #include #include // isnan, fmax -//#include #include #include #include @@ -79,7 +78,7 @@ class Alpha_complex : public Simplex_tree<> { public: // Add an int in TDS to save point index in the structure typedef CGAL::Triangulation_data_structure, + CGAL::Triangulation_vertex, CGAL::Triangulation_full_cell > TDS; /** \brief A Delaunay triangulation of a set of points in \f$ \mathbb{R}^D\f$.*/ typedef CGAL::Delaunay_triangulation Delaunay_triangulation; @@ -111,13 +110,10 @@ class Alpha_complex : public Simplex_tree<> { // size_type type from CGAL. typedef typename Delaunay_triangulation::size_type size_type; - // Double map type to switch from CGAL vertex iterator to simplex tree vertex handle and vice versa. - typedef typename std::map< CGAL_vertex_iterator, Vertex_handle > Map_vertex_iterator_to_handle; + // Map type to switch from simplex tree vertex handle to CGAL vertex iterator. typedef typename std::map< Vertex_handle, CGAL_vertex_iterator > Vector_vertex_iterator; private: - /** \brief Map to switch from CGAL vertex iterator to simplex tree vertex handle.*/ - Map_vertex_iterator_to_handle vertex_iterator_to_handle_; /** \brief Vertex iterator vector to switch from simplex tree vertex handle to CGAL vertex iterator. * Vertex handles are inserted sequentially, starting at 0.*/ Vector_vertex_iterator vertex_handle_to_iterator_; @@ -198,15 +194,15 @@ class Alpha_complex : public Simplex_tree<> { triangulation_ = new Delaunay_triangulation(point_dimension(*first)); std::vector points(first, last); - + // Creates a vector {0, 1, ..., N-1} std::vector indices(boost::counting_iterator(0), boost::counting_iterator(points.size())); - + // Sort indices considering CGAL spatial sort typedef CGAL::Spatial_sort_traits_adapter_d Search_traits_d; - spatial_sort(indices.begin(),indices.end(),Search_traits_d(&(points[0]))); - + spatial_sort(indices.begin(), indices.end(), Search_traits_d(&(points[0]))); + typename Delaunay_triangulation::Full_cell_handle hint; for (auto index : indices) { typename Delaunay_triangulation::Vertex_handle pos = triangulation_->insert(points[index], hint); @@ -261,8 +257,6 @@ class Alpha_complex : public Simplex_tree<> { #ifdef DEBUG_TRACES std::cout << "Vertex insertion - " << vit->data() << " -> " << vit->point() << std::endl; #endif // DEBUG_TRACES - - vertex_iterator_to_handle_.emplace(vit, vit->data()); vertex_handle_to_iterator_.emplace(vit->data(), vit); } } @@ -278,10 +272,10 @@ class Alpha_complex : public Simplex_tree<> { for (auto vit = cit->vertices_begin(); vit != cit->vertices_end(); ++vit) { if (*vit != nullptr) { #ifdef DEBUG_TRACES - std::cout << " " << vertex_iterator_to_handle_[*vit]; + std::cout << " " << (*vit)->data(); #endif // DEBUG_TRACES // Vector of vertex construction for simplex_tree structure - vertexVector.push_back(vertex_iterator_to_handle_[*vit]); + vertexVector.push_back((*vit)->data()); } } #ifdef DEBUG_TRACES diff --git a/src/Persistent_cohomology/concept/FilteredComplex.h b/src/Persistent_cohomology/concept/FilteredComplex.h index e124d524..949aafc2 100644 --- a/src/Persistent_cohomology/concept/FilteredComplex.h +++ b/src/Persistent_cohomology/concept/FilteredComplex.h @@ -138,6 +138,6 @@ Filtration_simplex_range filtration_simplex_range(); * @todo use an enum? Just a bool? */ //int is_before_in_filtration(Simplex_handle s, Simplex_handle t); -/*************************************************/ +/*************************************************/ }; diff --git a/src/common/example/CGAL_points_off_reader.cpp b/src/common/example/CGAL_points_off_reader.cpp index 076afd5b..45e9f1e6 100644 --- a/src/common/example/CGAL_points_off_reader.cpp +++ b/src/common/example/CGAL_points_off_reader.cpp @@ -6,6 +6,7 @@ #include #include +#include typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel; typedef typename Kernel::Point_d Point_d; diff --git a/src/common/include/gudhi/Off_reader.h b/src/common/include/gudhi/Off_reader.h index 2420ae72..4fcd2af2 100644 --- a/src/common/include/gudhi/Off_reader.h +++ b/src/common/include/gudhi/Off_reader.h @@ -31,6 +31,7 @@ #include #include #include +#include namespace Gudhi { diff --git a/src/common/include/gudhi/Points_off_io.h b/src/common/include/gudhi/Points_off_io.h index d9f9a74b..79287e3c 100644 --- a/src/common/include/gudhi/Points_off_io.h +++ b/src/common/include/gudhi/Points_off_io.h @@ -22,13 +22,13 @@ #ifndef POINTS_OFF_IO_H_ #define POINTS_OFF_IO_H_ +#include + #include #include #include #include -#include - namespace Gudhi { /** @@ -87,7 +87,7 @@ class Points_off_visitor_reader { // Off_reader visitor done implementation - Only points are read void done() { } - + /** \brief Point cloud getter. * * @return point_cloud. @@ -95,7 +95,6 @@ class Points_off_visitor_reader { const std::vector& get_point_cloud() { return point_cloud; } - }; /** -- cgit v1.2.3