summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test/simplex_tree_unit_test.cpp
diff options
context:
space:
mode:
authorROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-07-03 16:04:45 +0200
committerROUVREAU Vincent <vincent.rouvreau@inria.fr>2020-07-03 16:04:45 +0200
commit85eec1ba750d56b66e3739dc486c6205f49fb31e (patch)
tree74053406d8f1d5ebbf2b6d51c6b8c6f7931b566e /src/Simplex_tree/test/simplex_tree_unit_test.cpp
parent444ec77fe16783c35ef86598011a662c5d6e8d92 (diff)
A proposal for simplex_tree reset_filtration (python & C++)
Diffstat (limited to 'src/Simplex_tree/test/simplex_tree_unit_test.cpp')
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index 9b5fa8fe..9780f5b0 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -940,3 +940,50 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(generators, typeST, list_of_tested_variants) {
BOOST_CHECK(st.edge_with_same_filtration(st.find({1,5}))==st.find({1,5}));
}
}
+
+BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_reset_filtration, typeST, list_of_tested_variants) {
+ std::clog << "********************************************************************" << std::endl;
+ std::clog << "TEST RESET FILTRATION" << std::endl;
+ typeST st;
+
+ st.insert_simplex_and_subfaces({2, 1, 0}, 3.);
+ st.insert_simplex_and_subfaces({3, 0}, 2.);
+ st.insert_simplex_and_subfaces({3, 4, 5}, 3.);
+ st.insert_simplex_and_subfaces({0, 1, 6, 7}, 4.);
+
+ /* Inserted simplex: */
+ /* 1 6 */
+ /* o---o */
+ /* /X\7/ */
+ /* o---o---o---o */
+ /* 2 0 3\X/4 */
+ /* o */
+ /* 5 */
+
+ for (auto f_simplex : st.skeleton_simplex_range(3)) {
+ std::clog << "vertex = (";
+ for (auto vertex : st.simplex_vertex_range(f_simplex)) {
+ std::clog << vertex << ",";
+ }
+ std::clog << ") - filtration =" << st.filtration(f_simplex) << std::endl;
+ BOOST_CHECK(st.filtration(f_simplex) >= 2.);
+ }
+
+ // dimension until 5 even if simplex tree is of dimension 3 to test the limits
+ for(int dimension = 0; dimension < 6; dimension ++) {
+ st.reset_filtration(0., dimension);
+ for (auto f_simplex : st.skeleton_simplex_range(3)) {
+ std::clog << "vertex = (";
+ for (auto vertex : st.simplex_vertex_range(f_simplex)) {
+ std::clog << vertex << ",";
+ }
+ std::clog << ") - filtration =" << st.filtration(f_simplex) << std::endl;
+ if (st.dimension(f_simplex) > dimension)
+ BOOST_CHECK(st.filtration(f_simplex) >= 1.);
+ else
+ BOOST_CHECK(st.filtration(f_simplex) == 0.);
+ }
+ }
+
+}
+