summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/include/gudhi/Simplex_tree.h
diff options
context:
space:
mode:
authorMathieuCarriere <mathieu.carriere3@gmail.com>2020-03-17 12:31:18 -0400
committerMathieuCarriere <mathieu.carriere3@gmail.com>2020-03-17 12:31:18 -0400
commit18a0eb17d9370eca6dde7c0cada0624302ded002 (patch)
tree29e51a58c0d6cd4ed122f61026168670902b1547 /src/Simplex_tree/include/gudhi/Simplex_tree.h
parent50427c9fe5c63f3bfe27270db0ea26480e73cb1a (diff)
implement Marc's suggestions
Diffstat (limited to 'src/Simplex_tree/include/gudhi/Simplex_tree.h')
-rw-r--r--src/Simplex_tree/include/gudhi/Simplex_tree.h11
1 files changed, 4 insertions, 7 deletions
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<int>::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<Vertex_handle> 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();
}