diff options
Diffstat (limited to 'src/Simplex_tree')
-rw-r--r-- | src/Simplex_tree/example/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/Simplex_tree/example/simple_simplex_tree.cpp | 13 | ||||
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 6 | ||||
-rw-r--r-- | src/Simplex_tree/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Simplex_tree/test/simplex_tree_unit_test.cpp | 13 |
5 files changed, 23 insertions, 17 deletions
diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index 6a392d3b..956d1fa9 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -7,9 +7,12 @@ message("Boost_lib = ${Boost_LIBRARIES}") add_executable ( simplex_tree_from_file simplex_tree_from_file.cpp ) target_link_libraries(simplex_tree_from_file ${Boost_LIBRARIES}) - +add_test(simplex_tree_from_file_2 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_file ${CMAKE_SOURCE_DIR}/data/points/Klein_bottle_complex.txt 2) +add_test(simplex_tree_from_file_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_file ${CMAKE_SOURCE_DIR}/data/points/Klein_bottle_complex.txt 3) + add_executable ( simple_simplex_tree simple_simplex_tree.cpp ) target_link_libraries(simple_simplex_tree ${Boost_LIBRARIES}) +add_test(simple_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/simple_simplex_tree) # An example with Simplex-tree using CGAL alpha_shapes_3 if(GMPXX_FOUND AND GMP_FOUND AND CGAL_FOUND) @@ -19,4 +22,5 @@ if(GMPXX_FOUND AND GMP_FOUND AND CGAL_FOUND) add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp ) target_link_libraries(simplex_tree_from_alpha_shapes_3 ${Boost_LIBRARIES} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY}) + add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000) endif() diff --git a/src/Simplex_tree/example/simple_simplex_tree.cpp b/src/Simplex_tree/example/simple_simplex_tree.cpp index 0ed2039f..11b96a0d 100644 --- a/src/Simplex_tree/example/simple_simplex_tree.cpp +++ b/src/Simplex_tree/example/simple_simplex_tree.cpp @@ -48,12 +48,12 @@ int main (int argc, char * const argv[]) //Construct the Simplex Tree Simplex_tree<> simplexTree; - // Simplex to be inserted: - // 1 - // o - // /X\ - // o---o---o - // 2 0 3 + /* Simplex to be inserted: */ + /* 1 */ + /* o */ + /* /X\ */ + /* o---o---o */ + /* 2 0 3 */ // ++ FIRST std::cout << " * INSERT 0" << std::endl; @@ -299,4 +299,5 @@ int main (int argc, char * const argv[]) // [0.2] 2 1 // [0.2] 3 0 // [0.3] 2 1 0 + return 0; } diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 9b3de20a..db7ad2b8 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -360,7 +360,7 @@ class Simplex_tree { /** \brief Returns the number of simplices in the complex. * * Does not count the empty simplex. */ - size_t num_simplices() { + const unsigned int& num_simplices() const { return num_simplices_; } @@ -526,7 +526,7 @@ class Simplex_tree { threshold_ = fil; } /** Set a number of simplices for the simplicial complex. */ - void set_num_simplices(size_t num_simplices) { + void set_num_simplices(const unsigned int& num_simplices) { num_simplices_ = num_simplices; } /** Set a dimension for the simplicial complex. */ @@ -793,7 +793,7 @@ class Simplex_tree { /** \brief Upper bound on the filtration values of the simplices.*/ Filtration_value threshold_; /** \brief Total number of simplices in the complex, without the empty simplex.*/ - size_t num_simplices_; + unsigned int num_simplices_; /** \brief Set of simplex tree Nodes representing the vertices.*/ Siblings root_; /** \brief Simplices ordered according to a filtration.*/ diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt index d7f968af..e3fcc557 100644 --- a/src/Simplex_tree/test/CMakeLists.txt +++ b/src/Simplex_tree/test/CMakeLists.txt @@ -20,7 +20,7 @@ add_test(simplex_tree_unit_test ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_unit_te if (LCOV_PATH) # Lcov code coverage of unitary test - add_test(simplex_tree_unit_test_coverage.info ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Simplex_tree) + add_test(src/Simplex_tree/lcov/coverage.log ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Simplex_tree) endif() if (PYTHON_PATH) diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index a3671f56..b44f95a8 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -166,7 +166,7 @@ void set_and_test_simplex_tree_dim_fil(typeST& simplexTree, int vectorSize, cons simplexTree.set_filtration(max_fil); std::cout << " set_and_test_simplex_tree_dim_fil - max_fil=" << max_fil << std::endl; } - int nb_simplices = simplexTree.num_simplices() + 1; + unsigned int nb_simplices = simplexTree.num_simplices() + 1; simplexTree.set_num_simplices(nb_simplices); BOOST_CHECK( simplexTree.dimension() == dim_max ); @@ -347,11 +347,12 @@ BOOST_AUTO_TEST_CASE( simplex_tree_insertion ) BOOST_CHECK( st.dimension() == dim_max ); BOOST_CHECK( AreAlmostTheSame(st.filtration(), max_fil) ); - // 1 - // o - // /X\ - // o---o---o - // 2 0 3 + /* Inserted simplex: */ + /* 1 */ + /* o */ + /* /X\ */ + /* o---o---o */ + /* 2 0 3 */ // [0.1] 0 // [0.1] 1 |