Skip to content

Commit

Permalink
Merge branch 'GUDHI:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLapous authored Sep 28, 2023
2 parents 82ce7d0 + 78d8440 commit 8fd1ccd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/Simplex_tree/include/gudhi/Simplex_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,13 @@ class Simplex_tree {
return Dit_value_t(v, Node(&root_, filt)); });
root_.members_.insert(boost::begin(verts), boost::end(verts));
if (dimension_ < 0 && !root_.members_.empty()) dimension_ = 0;
if constexpr (Options::link_nodes_by_label) {
for (auto sh = root_.members().begin(); sh != root_.members().end(); sh++) {
// update newly inserted simplex (the one that are not linked)
if (!sh->second.list_max_vertex_hook_.is_linked())
update_simplex_tree_after_node_insertion(sh);
}
}
}

/** \brief Expands the Simplex_tree containing only its one skeleton
Expand Down
18 changes: 16 additions & 2 deletions src/Simplex_tree/test/simplex_tree_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_boundaries_and_opposite_vertex_iterat
}
}

BOOST_AUTO_TEST_CASE(batch_vertices) {
typedef Simplex_tree<> typeST;
typedef boost::mpl::list<Simplex_tree<>,
Simplex_tree<Simplex_tree_options_fast_cofaces>,
Simplex_tree<Simplex_tree_options_stable_simplex_handles> >
list_of_tested_variants_wo_fast_persistence;

BOOST_AUTO_TEST_CASE_TEMPLATE(batch_vertices, typeST, list_of_tested_variants_wo_fast_persistence) {
std::clog << "********************************************************************" << std::endl;
std::clog << "TEST BATCH VERTEX INSERTION" << std::endl;
typeST st;
Expand All @@ -1169,6 +1173,16 @@ BOOST_AUTO_TEST_CASE(batch_vertices) {
BOOST_CHECK(st.num_simplices() == 4);
BOOST_CHECK(st.filtration(st.find({2})) == 0.);
BOOST_CHECK(st.filtration(st.find({3})) == 1.5);

for (auto coface : st.star_simplex_range(st.find({5}))) {
std::clog << "coface";
for (auto vertex : st.simplex_vertex_range(coface)) {
std::clog << " " << vertex;
// Should be the only one
BOOST_CHECK(vertex == 5);
}
std::clog << "\n";
}
}

BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_clear, typeST, list_of_tested_variants) {
Expand Down

0 comments on commit 8fd1ccd

Please sign in to comment.