From e36bb3953817d9aa3b1baaa61e51cee4099787b9 Mon Sep 17 00:00:00 2001 From: skachano Date: Fri, 16 Dec 2016 08:42:13 +0000 Subject: memory access violation: here we go again git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1892 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fff0a693f83f8f0a0f93d2fe57640408e7b17c69 --- src/Witness_complex/include/gudhi/Strong_witness_complex.h | 13 +++++++------ src/Witness_complex/test/test_simple_witness_complex.cpp | 8 +++++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Witness_complex/include/gudhi/Strong_witness_complex.h b/src/Witness_complex/include/gudhi/Strong_witness_complex.h index 3803980b..5f9db5a4 100644 --- a/src/Witness_complex/include/gudhi/Strong_witness_complex.h +++ b/src/Witness_complex/include/gudhi/Strong_witness_complex.h @@ -162,7 +162,8 @@ private: // continue inserting limD-faces of the following simplices typeVectorVertex& vertices = simplex; //'simplex' now will be called vertices while (aw_it != aw.end() && aw_it->second < lim_dist2) { - add_all_faces_of_dimension(limD, vertices, vertices.begin(), aw_it, typeVectorVertex({}), complex); + typeVectorVertex facet = {}; + add_all_faces_of_dimension(limit_dimension, vertices, vertices.begin(), aw_it, facet, complex); vertices.push_back(aw_it->first); aw_it++; } @@ -181,17 +182,17 @@ private: * The landmark pointed by aw_it is added to all formed simplices. */ template < typename SimplicialComplexForWitness > - void add_all_faces_of_dimension(int dim, - std::vector& vertices, + void add_all_faces_of_dimension(Landmark_id dim, + typeVectorVertex& vertices, typename typeVectorVertex::iterator curr_it, typename ActiveWitness::iterator aw_it, - std::vector& simplex, + typeVectorVertex& simplex, SimplicialComplexForWitness& sc) { if (dim > 0) while (curr_it != vertices.end()) { - simplex.push_back(curr_it->first); - typename ActiveWitness::iterator next_it = curr_it++; + simplex.push_back(*curr_it); + typename typeVectorVertex::iterator next_it = curr_it++; add_all_faces_of_dimension(dim-1, vertices, next_it, diff --git a/src/Witness_complex/test/test_simple_witness_complex.cpp b/src/Witness_complex/test/test_simple_witness_complex.cpp index a0a1b36c..dc7f3175 100644 --- a/src/Witness_complex/test/test_simple_witness_complex.cpp +++ b/src/Witness_complex/test/test_simple_witness_complex.cpp @@ -32,7 +32,7 @@ typedef Gudhi::witness_complex::Strong_witness_complex StrongWitnessComp */ BOOST_AUTO_TEST_CASE(simple_witness_complex) { - Simplex_tree complex, relaxed_complex, strong_relaxed_complex; + Simplex_tree complex, relaxed_complex, strong_relaxed_complex, strong_relaxed_complex2; std::vector witnesses, landmarks; @@ -73,8 +73,10 @@ BOOST_AUTO_TEST_CASE(simple_witness_complex) { witnesses); strong_witness_complex.create_complex(strong_relaxed_complex, 9.1); - + strong_witness_complex.create_complex(strong_relaxed_complex2, 9.1, 2); + std::cout << "strong_relaxed_complex.num_simplices() = " << strong_relaxed_complex.num_simplices() << std::endl; BOOST_CHECK(strong_relaxed_complex.num_simplices() == 239); - + + std::cout << "strong_relaxed_complex2.num_simplices() = " << strong_relaxed_complex2.num_simplices() << std::endl; } -- cgit v1.2.3