From 18a0eb17d9370eca6dde7c0cada0624302ded002 Mon Sep 17 00:00:00 2001 From: MathieuCarriere Date: Tue, 17 Mar 2020 12:31:18 -0400 Subject: implement Marc's suggestions --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/Simplex_tree/include/gudhi') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 1c06e7cb..5b36cc1c 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -1552,13 +1552,13 @@ class Simplex_tree { double f = this->filtration(sh); this->minval_ = std::min(this->minval_, f); this->maxval_ = std::max(this->maxval_, f); - maxvert = std::max(*this->simplex_vertex_range(sh).begin(), maxvert); + maxvert = std::max(sh->first, maxvert); } GUDHI_CHECK(maxvert < std::numeric_limits::max(), std::invalid_argument("Simplex_tree contains a vertex with the largest Vertex_handle")); maxvert += 1; - Simplex_tree* st_copy = new Simplex_tree(*this); + Simplex_tree st_copy = *this; // Add point for coning the simplicial complex int count = this->num_simplices(); @@ -1566,11 +1566,11 @@ class Simplex_tree { count++; // For each simplex - for (auto sh_copy : st_copy->complex_simplex_range()){ + for (auto sh_copy : st_copy.complex_simplex_range()){ // Locate simplex std::vector vr; - for (auto vh : st_copy->simplex_vertex_range(sh_copy)){ + for (auto vh : st_copy.simplex_vertex_range(sh_copy)){ vr.push_back(vh); } auto sh = this->find(vr); @@ -1592,9 +1592,6 @@ class Simplex_tree { count++; } - // Deallocate memory - delete st_copy; - // Automatically assign good values for simplices this->make_filtration_non_decreasing(); } -- cgit v1.2.3