From fc44fa8c77f957379531310215ca2cd1fa3dfcae Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 26 Jun 2018 06:53:17 +0000 Subject: Add insert_simplex in Alpha_complex_3d.h Modify periodic_alpha_complex_3d_persistence.cpp with new module git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3636 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 271e55ce7363a1af991fb107896307887827df65 --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 26 +++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/Alpha_complex/include/gudhi/Alpha_complex_3d.h') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index ff6eb3e6..58364802 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -225,16 +225,17 @@ public: (z_max - z_min == y_max - y_min), std::invalid_argument("The size of the cuboid in every directions is not the same.")); -#ifdef GUDHI_DEBUG - // Defined in GUDHI_DEBUG to avoid unused variable warning - double maximal_possible_weight = 0.015625 * (x_max - x_min) * (x_max - x_min); -#endif - using Weighted_point_3 = typename AlphaComplex3dOptions::Weighted_point_3; std::vector weighted_points_3; std::size_t index = 0; weighted_points_3.reserve(points.size()); + +#ifdef GUDHI_DEBUG + // Defined in GUDHI_DEBUG to avoid unused variable warning for GUDHI_CHECK + double maximal_possible_weight = 0.015625 * (x_max - x_min) * (x_max - x_min); +#endif + while ((index < weights.size()) && (index < points.size())) { GUDHI_CHECK((weights[index] < maximal_possible_weight) || (weights[index] >= 0), std::invalid_argument("Invalid weight at line" + std::to_string(index + 1) + @@ -325,7 +326,9 @@ public: #endif // DEBUG_TRACES vertex_list.push_back((*cell)->vertex(i)); } +#ifdef DEBUG_TRACES count_cells++; +#endif // DEBUG_TRACES } else if (const Facet *facet = CGAL::object_cast(&object_iterator)) { for (auto i = 0; i < 4; i++) { if ((*facet).second != i) { @@ -335,7 +338,9 @@ public: vertex_list.push_back((*facet).first->vertex(i)); } } +#ifdef DEBUG_TRACES count_facets++; +#endif // DEBUG_TRACES } else if (const Edge *edge = CGAL::object_cast(&object_iterator)) { for (auto i : {(*edge).second, (*edge).third}) { #ifdef DEBUG_TRACES @@ -343,13 +348,15 @@ public: #endif // DEBUG_TRACES vertex_list.push_back((*edge).first->vertex(i)); } +#ifdef DEBUG_TRACES count_edges++; +#endif // DEBUG_TRACES } else if (const Alpha_vertex_handle *vertex = CGAL::object_cast(&object_iterator)) { - count_vertices++; #ifdef DEBUG_TRACES - std::cout << "from vertex=" << (*vertex)->point() << std::endl; + count_vertices++; + std::cout << "from vertex=" << (*vertex)->point() << std::endl; #endif // DEBUG_TRACES - vertex_list.push_back((*vertex)); + vertex_list.push_back((*vertex)); } // Construction of the vector of simplex_tree vertex from list of alpha_shapes vertex Simplex_tree_vector_vertex the_simplex; @@ -378,11 +385,10 @@ public: AlphaComplex3dOptions::template value_from_iterator::iterator> (the_alpha_value_iterator); - //Filtration_value filtr = CGAL::to_double(the_alpha_value_iterator->exact()); #ifdef DEBUG_TRACES std::cout << "filtration = " << filtr << std::endl; #endif // DEBUG_TRACES - //complex.insert_simplex(the_simplex, static_cast(filtr)); + complex.insert_simplex(the_simplex, static_cast(filtr)); GUDHI_CHECK(the_alpha_value_iterator != alpha_values_.end(), "CGAL provided more simplices than values"); ++the_alpha_value_iterator; } -- cgit v1.2.3