From bf4b4eeda9762ed9e99c2b24f19331fa0111fcfe Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Mon, 27 Jan 2020 10:43:16 +0100 Subject: Code review: Use std::clog instead of std::cout --- .../example/cech_complex_cgal_mini_sphere_3d.cpp | 30 +-- ...e_alpha_shapes_3_simplex_tree_from_off_file.cpp | 68 +++--- .../example/graph_expansion_with_blocker.cpp | 22 +- src/Simplex_tree/example/mini_simplex_tree.cpp | 4 +- src/Simplex_tree/example/simple_simplex_tree.cpp | 138 ++++++------ .../example/simplex_tree_from_cliques_of_graph.cpp | 56 ++--- src/Simplex_tree/include/gudhi/Simplex_tree.h | 12 +- .../test/simplex_tree_ctor_and_move_unit_test.cpp | 32 +-- .../simplex_tree_graph_expansion_unit_test.cpp | 88 ++++---- .../simplex_tree_iostream_operator_unit_test.cpp | 46 ++-- .../test/simplex_tree_remove_unit_test.cpp | 154 ++++++------- src/Simplex_tree/test/simplex_tree_unit_test.cpp | 248 ++++++++++----------- 12 files changed, 449 insertions(+), 449 deletions(-) (limited to 'src/Simplex_tree') diff --git a/src/Simplex_tree/example/cech_complex_cgal_mini_sphere_3d.cpp b/src/Simplex_tree/example/cech_complex_cgal_mini_sphere_3d.cpp index d716fb1f..0e7e382b 100644 --- a/src/Simplex_tree/example/cech_complex_cgal_mini_sphere_3d.cpp +++ b/src/Simplex_tree/example/cech_complex_cgal_mini_sphere_3d.cpp @@ -55,18 +55,18 @@ class Cech_blocker { bool operator()(Simplex_handle sh) { std::vector points; #if DEBUG_TRACES - std::cout << "Cech_blocker on ["; + std::clog << "Cech_blocker on ["; #endif // DEBUG_TRACES for (auto vertex : simplex_tree_.simplex_vertex_range(sh)) { points.push_back(point_cloud_[vertex]); #if DEBUG_TRACES - std::cout << vertex << ", "; + std::clog << vertex << ", "; #endif // DEBUG_TRACES } Min_sphere ms(points.begin(), points.end()); Filtration_value radius = ms.radius(); #if DEBUG_TRACES - std::cout << "] - radius = " << radius << " - returns " << (radius > threshold_) << std::endl; + std::clog << "] - radius = " << radius << " - returns " << (radius > threshold_) << std::endl; #endif // DEBUG_TRACES simplex_tree_.assign_filtration(sh, radius); return (radius > threshold_); @@ -106,24 +106,24 @@ int main(int argc, char* argv[]) { // expand the graph until dimension dim_max st.expansion_with_blockers(dim_max, Cech_blocker(st, threshold, off_reader.get_point_cloud())); - std::cout << "The complex contains " << st.num_simplices() << " simplices \n"; - std::cout << " and has dimension " << st.dimension() << " \n"; + std::clog << "The complex contains " << st.num_simplices() << " simplices \n"; + std::clog << " and has dimension " << st.dimension() << " \n"; // Sort the simplices in the order of the filtration st.initialize_filtration(); #if DEBUG_TRACES - std::cout << "********************************************************************\n"; + std::clog << "********************************************************************\n"; // Display the Simplex_tree - Can not be done in the middle of 2 inserts - std::cout << "* The complex contains " << st.num_simplices() << " simplices - dimension=" << st.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "* The complex contains " << st.num_simplices() << " simplices - dimension=" << st.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << static_cast(vertex) << " "; + std::clog << static_cast(vertex) << " "; } - std::cout << std::endl; + std::clog << std::endl; } #endif // DEBUG_TRACES return 0; @@ -154,11 +154,11 @@ void program_options(int argc, char* argv[], std::string& off_file_points, Filtr po::notify(vm); if (vm.count("help") || !vm.count("input-file")) { - std::cout << std::endl; - std::cout << "Construct a Cech complex defined on a set of input points.\n \n"; + std::clog << std::endl; + std::clog << "Construct a Cech complex defined on a set of input points.\n \n"; - std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; - std::cout << visible << std::endl; + std::clog << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; + std::clog << visible << std::endl; exit(-1); } } diff --git a/src/Simplex_tree/example/example_alpha_shapes_3_simplex_tree_from_off_file.cpp b/src/Simplex_tree/example/example_alpha_shapes_3_simplex_tree_from_off_file.cpp index e455c426..8ee7ab74 100644 --- a/src/Simplex_tree/example/example_alpha_shapes_3_simplex_tree_from_off_file.cpp +++ b/src/Simplex_tree/example/example_alpha_shapes_3_simplex_tree_from_off_file.cpp @@ -63,7 +63,7 @@ Vertex_list from(const Cell_handle& ch) { Vertex_list the_list; for (auto i = 0; i < 4; i++) { #ifdef DEBUG_TRACES - std::cout << "from cell[" << i << "]=" << ch->vertex(i)->point() << std::endl; + std::clog << "from cell[" << i << "]=" << ch->vertex(i)->point() << std::endl; #endif // DEBUG_TRACES the_list.push_back(ch->vertex(i)); } @@ -75,7 +75,7 @@ Vertex_list from(const Facet& fct) { for (auto i = 0; i < 4; i++) { if (fct.second != i) { #ifdef DEBUG_TRACES - std::cout << "from facet=[" << i << "]" << fct.first->vertex(i)->point() << std::endl; + std::clog << "from facet=[" << i << "]" << fct.first->vertex(i)->point() << std::endl; #endif // DEBUG_TRACES the_list.push_back(fct.first->vertex(i)); } @@ -88,7 +88,7 @@ Vertex_list from(const Edge& edg) { for (auto i = 0; i < 4; i++) { if ((edg.second == i) || (edg.third == i)) { #ifdef DEBUG_TRACES - std::cout << "from edge[" << i << "]=" << edg.first->vertex(i)->point() << std::endl; + std::clog << "from edge[" << i << "]=" << edg.first->vertex(i)->point() << std::endl; #endif // DEBUG_TRACES the_list.push_back(edg.first->vertex(i)); } @@ -99,7 +99,7 @@ Vertex_list from(const Edge& edg) { Vertex_list from(const Alpha_shape_3::Vertex_handle& vh) { Vertex_list the_list; #ifdef DEBUG_TRACES - std::cout << "from vertex=" << vh->point() << std::endl; + std::clog << "from vertex=" << vh->point() << std::endl; #endif // DEBUG_TRACES the_list.push_back(vh); return the_list; @@ -128,7 +128,7 @@ int main(int argc, char * const argv[]) { // alpha shape construction from points. CGAL has a strange behavior in REGULARIZED mode. Alpha_shape_3 as(lp.begin(), lp.end(), 0, Alpha_shape_3::GENERAL); #ifdef DEBUG_TRACES - std::cout << "Alpha shape computed in GENERAL mode" << std::endl; + std::clog << "Alpha shape computed in GENERAL mode" << std::endl; #endif // DEBUG_TRACES // filtration with alpha values from alpha shape @@ -140,7 +140,7 @@ int main(int argc, char * const argv[]) { as.filtration_with_alpha_values(disp); #ifdef DEBUG_TRACES - std::cout << "filtration_with_alpha_values returns : " << the_objects.size() << " objects" << std::endl; + std::clog << "filtration_with_alpha_values returns : " << the_objects.size() << " objects" << std::endl; #endif // DEBUG_TRACES Alpha_shape_3::size_type count_vertices = 0; @@ -177,7 +177,7 @@ int main(int argc, char * const argv[]) { // alpha shape not found Simplex_tree_vertex vertex = map_cgal_simplex_tree.size(); #ifdef DEBUG_TRACES - std::cout << "vertex [" << the_alpha_shape_vertex->point() << "] not found - insert_simplex " << vertex << "\n"; + std::clog << "vertex [" << the_alpha_shape_vertex->point() << "] not found - insert_simplex " << vertex << "\n"; #endif // DEBUG_TRACES the_simplex_tree.push_back(vertex); map_cgal_simplex_tree.insert(Alpha_shape_simplex_tree_pair(the_alpha_shape_vertex, vertex)); @@ -185,14 +185,14 @@ int main(int argc, char * const argv[]) { // alpha shape found Simplex_tree_vertex vertex = the_map_iterator->second; #ifdef DEBUG_TRACES - std::cout << "vertex [" << the_alpha_shape_vertex->point() << "] found in " << vertex << std::endl; + std::clog << "vertex [" << the_alpha_shape_vertex->point() << "] found in " << vertex << std::endl; #endif // DEBUG_TRACES the_simplex_tree.push_back(vertex); } } // Construction of the simplex_tree #ifdef DEBUG_TRACES - std::cout << "filtration = " << *the_alpha_value_iterator << std::endl; + std::clog << "filtration = " << *the_alpha_value_iterator << std::endl; #endif // DEBUG_TRACES simplex_tree.insert_simplex(the_simplex_tree, std::sqrt(*the_alpha_value_iterator)); if (the_alpha_value_iterator != the_alpha_values.end()) @@ -201,61 +201,61 @@ int main(int argc, char * const argv[]) { std::cerr << "This shall not happen" << std::endl; } #ifdef DEBUG_TRACES - std::cout << "vertices \t\t" << count_vertices << std::endl; - std::cout << "edges \t\t" << count_edges << std::endl; - std::cout << "facets \t\t" << count_facets << std::endl; - std::cout << "cells \t\t" << count_cells << std::endl; + std::clog << "vertices \t\t" << count_vertices << std::endl; + std::clog << "edges \t\t" << count_edges << std::endl; + std::clog << "facets \t\t" << count_facets << std::endl; + std::clog << "cells \t\t" << count_cells << std::endl; - std::cout << "Information of the Simplex Tree:\n"; - std::cout << " Number of vertices = " << simplex_tree.num_vertices() << " "; - std::cout << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl; + std::clog << "Information of the Simplex Tree:\n"; + std::clog << " Number of vertices = " << simplex_tree.num_vertices() << " "; + std::clog << " Number of simplices = " << simplex_tree.num_simplices() << std::endl << std::endl; #endif // DEBUG_TRACES #ifdef DEBUG_TRACES - std::cout << "Iterator on vertices: \n"; + std::clog << "Iterator on vertices: \n"; for (auto vertex : simplex_tree.complex_vertex_range()) { - std::cout << vertex << " "; + std::clog << vertex << " "; } #endif // DEBUG_TRACES - std::cout << simplex_tree << std::endl; + std::clog << simplex_tree << std::endl; #ifdef DEBUG_TRACES - std::cout << std::endl << std::endl << "Iterator on simplices:\n"; + std::clog << std::endl << std::endl << "Iterator on simplices:\n"; for (auto simplex : simplex_tree.complex_simplex_range()) { - std::cout << " "; + std::clog << " "; for (auto vertex : simplex_tree.simplex_vertex_range(simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } #endif // DEBUG_TRACES #ifdef DEBUG_TRACES - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { - std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } #endif // DEBUG_TRACES #ifdef DEBUG_TRACES - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, and their boundary simplices:\n"; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, and their boundary simplices:\n"; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { - std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; for (auto b_simplex : simplex_tree.boundary_simplex_range(f_simplex)) { - std::cout << " " << "[" << simplex_tree.filtration(b_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(b_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(b_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } } #endif // DEBUG_TRACES diff --git a/src/Simplex_tree/example/graph_expansion_with_blocker.cpp b/src/Simplex_tree/example/graph_expansion_with_blocker.cpp index 494f8b1d..df52bf43 100644 --- a/src/Simplex_tree/example/graph_expansion_with_blocker.cpp +++ b/src/Simplex_tree/example/graph_expansion_with_blocker.cpp @@ -34,31 +34,31 @@ int main(int argc, char* const argv[]) { stree.expansion_with_blockers(3, [&](Simplex_handle sh) { bool result = false; - std::cout << "Blocker on ["; + std::clog << "Blocker on ["; // User can loop on the vertices from the given simplex_handle i.e. for (auto vertex : stree.simplex_vertex_range(sh)) { // We block the expansion, if the vertex '6' is in the given list of vertices if (vertex == 6) result = true; - std::cout << vertex << ", "; + std::clog << vertex << ", "; } - std::cout << "] ( " << stree.filtration(sh); + std::clog << "] ( " << stree.filtration(sh); // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries) stree.assign_filtration(sh, stree.filtration(sh) + 1.); - std::cout << " + 1. ) = " << result << std::endl; + std::clog << " + 1. ) = " << result << std::endl; return result; }); - std::cout << "********************************************************************\n"; - std::cout << "* The complex contains " << stree.num_simplices() << " simplices"; - std::cout << " - dimension " << stree.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "********************************************************************\n"; + std::clog << "* The complex contains " << stree.num_simplices() << " simplices"; + std::clog << " - dimension " << stree.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : stree.filtration_simplex_range()) { - std::cout << " " + std::clog << " " << "[" << stree.filtration(f_simplex) << "] "; - for (auto vertex : stree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")"; - std::cout << std::endl; + for (auto vertex : stree.simplex_vertex_range(f_simplex)) std::clog << "(" << vertex << ")"; + std::clog << std::endl; } return 0; diff --git a/src/Simplex_tree/example/mini_simplex_tree.cpp b/src/Simplex_tree/example/mini_simplex_tree.cpp index bbc582c7..4043bffd 100644 --- a/src/Simplex_tree/example/mini_simplex_tree.cpp +++ b/src/Simplex_tree/example/mini_simplex_tree.cpp @@ -48,7 +48,7 @@ int main() { for (ST::Simplex_handle t : st.cofaces_simplex_range(e, 1)) { // Only coface is 012 for (ST::Vertex_handle v : st.simplex_vertex_range(t)) // v in { 0, 1, 2 } - std::cout << v; - std::cout << '\n'; + std::clog << v; + std::clog << '\n'; } } diff --git a/src/Simplex_tree/example/simple_simplex_tree.cpp b/src/Simplex_tree/example/simple_simplex_tree.cpp index 4353939f..ca39df5b 100644 --- a/src/Simplex_tree/example/simple_simplex_tree.cpp +++ b/src/Simplex_tree/example/simple_simplex_tree.cpp @@ -28,8 +28,8 @@ int main(int argc, char* const argv[]) { const Filtration_value FOURTH_FILTRATION_VALUE = 0.4; // TEST OF INSERTION - std::cout << "********************************************************************" << std::endl; - std::cout << "EXAMPLE OF SIMPLE INSERTION" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "EXAMPLE OF SIMPLE INSERTION" << std::endl; // Construct the Simplex Tree Simplex_tree simplexTree; @@ -41,140 +41,140 @@ int main(int argc, char* const argv[]) { /* 2 0 3 */ // ++ FIRST - std::cout << " * INSERT 0" << std::endl; + std::clog << " * INSERT 0" << std::endl; typeVectorVertex firstSimplexVector = {0}; typePairSimplexBool returnValue = simplexTree.insert_simplex(firstSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + 0 INSERTED" << std::endl; + std::clog << " + 0 INSERTED" << std::endl; } else { - std::cout << " - 0 NOT INSERTED" << std::endl; + std::clog << " - 0 NOT INSERTED" << std::endl; } // ++ SECOND - std::cout << " * INSERT 1" << std::endl; + std::clog << " * INSERT 1" << std::endl; typeVectorVertex secondSimplexVector = {1}; returnValue = simplexTree.insert_simplex(secondSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + 1 INSERTED" << std::endl; + std::clog << " + 1 INSERTED" << std::endl; } else { - std::cout << " - 1 NOT INSERTED" << std::endl; + std::clog << " - 1 NOT INSERTED" << std::endl; } // ++ THIRD - std::cout << " * INSERT (0,1)" << std::endl; + std::clog << " * INSERT (0,1)" << std::endl; typeVectorVertex thirdSimplexVector = {0, 1}; returnValue = simplexTree.insert_simplex(thirdSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + (0,1) INSERTED" << std::endl; + std::clog << " + (0,1) INSERTED" << std::endl; } else { - std::cout << " - (0,1) NOT INSERTED" << std::endl; + std::clog << " - (0,1) NOT INSERTED" << std::endl; } // ++ FOURTH - std::cout << " * INSERT 2" << std::endl; + std::clog << " * INSERT 2" << std::endl; typeVectorVertex fourthSimplexVector = {2}; returnValue = simplexTree.insert_simplex(fourthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + 2 INSERTED" << std::endl; + std::clog << " + 2 INSERTED" << std::endl; } else { - std::cout << " - 2 NOT INSERTED" << std::endl; + std::clog << " - 2 NOT INSERTED" << std::endl; } // ++ FIFTH - std::cout << " * INSERT (2,0)" << std::endl; + std::clog << " * INSERT (2,0)" << std::endl; typeVectorVertex fifthSimplexVector = {2, 0}; returnValue = simplexTree.insert_simplex(fifthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + (2,0) INSERTED" << std::endl; + std::clog << " + (2,0) INSERTED" << std::endl; } else { - std::cout << " - (2,0) NOT INSERTED" << std::endl; + std::clog << " - (2,0) NOT INSERTED" << std::endl; } // ++ SIXTH - std::cout << " * INSERT (2,1)" << std::endl; + std::clog << " * INSERT (2,1)" << std::endl; typeVectorVertex sixthSimplexVector = {2, 1}; returnValue = simplexTree.insert_simplex(sixthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + (2,1) INSERTED" << std::endl; + std::clog << " + (2,1) INSERTED" << std::endl; } else { - std::cout << " - (2,1) NOT INSERTED" << std::endl; + std::clog << " - (2,1) NOT INSERTED" << std::endl; } // ++ SEVENTH - std::cout << " * INSERT (2,1,0)" << std::endl; + std::clog << " * INSERT (2,1,0)" << std::endl; typeVectorVertex seventhSimplexVector = {2, 1, 0}; returnValue = simplexTree.insert_simplex(seventhSimplexVector, Filtration_value(THIRD_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + (2,1,0) INSERTED" << std::endl; + std::clog << " + (2,1,0) INSERTED" << std::endl; } else { - std::cout << " - (2,1,0) NOT INSERTED" << std::endl; + std::clog << " - (2,1,0) NOT INSERTED" << std::endl; } // ++ EIGHTH - std::cout << " * INSERT 3" << std::endl; + std::clog << " * INSERT 3" << std::endl; typeVectorVertex eighthSimplexVector = {3}; returnValue = simplexTree.insert_simplex(eighthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + 3 INSERTED" << std::endl; + std::clog << " + 3 INSERTED" << std::endl; } else { - std::cout << " - 3 NOT INSERTED" << std::endl; + std::clog << " - 3 NOT INSERTED" << std::endl; } // ++ NINETH - std::cout << " * INSERT (3,0)" << std::endl; + std::clog << " * INSERT (3,0)" << std::endl; typeVectorVertex ninethSimplexVector = {3, 0}; returnValue = simplexTree.insert_simplex(ninethSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + (3,0) INSERTED" << std::endl; + std::clog << " + (3,0) INSERTED" << std::endl; } else { - std::cout << " - (3,0) NOT INSERTED" << std::endl; + std::clog << " - (3,0) NOT INSERTED" << std::endl; } // ++ TENTH - std::cout << " * INSERT 0 (already inserted)" << std::endl; + std::clog << " * INSERT 0 (already inserted)" << std::endl; typeVectorVertex tenthSimplexVector = {0}; // With a different filtration value returnValue = simplexTree.insert_simplex(tenthSimplexVector, Filtration_value(FOURTH_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + 0 INSERTED" << std::endl; + std::clog << " + 0 INSERTED" << std::endl; } else { - std::cout << " - 0 NOT INSERTED" << std::endl; + std::clog << " - 0 NOT INSERTED" << std::endl; } // ++ ELEVENTH - std::cout << " * INSERT (2,1,0) (already inserted)" << std::endl; + std::clog << " * INSERT (2,1,0) (already inserted)" << std::endl; typeVectorVertex eleventhSimplexVector = {2, 1, 0}; returnValue = simplexTree.insert_simplex(eleventhSimplexVector, Filtration_value(FOURTH_FILTRATION_VALUE)); if (returnValue.second == true) { - std::cout << " + (2,1,0) INSERTED" << std::endl; + std::clog << " + (2,1,0) INSERTED" << std::endl; } else { - std::cout << " - (2,1,0) NOT INSERTED" << std::endl; + std::clog << " - (2,1,0) NOT INSERTED" << std::endl; } // ++ GENERAL VARIABLE SET - std::cout << "********************************************************************\n"; + std::clog << "********************************************************************\n"; // Display the Simplex_tree - Can not be done in the middle of 2 inserts - std::cout << "* The complex contains " << simplexTree.num_simplices() << " simplices\n"; - std::cout << " - dimension " << simplexTree.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "* The complex contains " << simplexTree.num_simplices() << " simplices\n"; + std::clog << " - dimension " << simplexTree.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : simplexTree.filtration_simplex_range()) { - std::cout << " " + std::clog << " " << "[" << simplexTree.filtration(f_simplex) << "] "; - for (auto vertex : simplexTree.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")"; - std::cout << std::endl; + for (auto vertex : simplexTree.simplex_vertex_range(f_simplex)) std::clog << "(" << vertex << ")"; + std::clog << std::endl; } // [0.1] 0 // [0.1] 1 @@ -190,66 +190,66 @@ int main(int argc, char* const argv[]) { // Find in the simplex_tree // ------------------------------------------------------------------------------------------------------------------ Simplex_tree::Simplex_handle simplexFound = simplexTree.find(secondSimplexVector); - std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n"; if (simplexFound != simplexTree.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; typeVectorVertex unknownSimplexVector = {15}; simplexFound = simplexTree.find(unknownSimplexVector); - std::cout << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n"; if (simplexFound != simplexTree.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; simplexFound = simplexTree.find(fifthSimplexVector); - std::cout << "**************IS THE SIMPLEX {2,0} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {2,0} IN THE SIMPLEX TREE ?\n"; if (simplexFound != simplexTree.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; typeVectorVertex otherSimplexVector = {1, 15}; simplexFound = simplexTree.find(otherSimplexVector); - std::cout << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n"; if (simplexFound != simplexTree.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; typeVectorVertex invSimplexVector = {1, 2, 0}; simplexFound = simplexTree.find(invSimplexVector); - std::cout << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n"; if (simplexFound != simplexTree.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; simplexFound = simplexTree.find({0, 1}); - std::cout << "**************IS THE SIMPLEX {0,1} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {0,1} IN THE SIMPLEX TREE ?\n"; if (simplexFound != simplexTree.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; - std::cout << "**************COFACES OF {0,1} IN CODIMENSION 1 ARE\n"; + std::clog << "**************COFACES OF {0,1} IN CODIMENSION 1 ARE\n"; for (auto& simplex : simplexTree.cofaces_simplex_range(simplexTree.find({0, 1}), 1)) { - for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::cout << "(" << vertex << ")"; - std::cout << std::endl; + for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::clog << "(" << vertex << ")"; + std::clog << std::endl; } - std::cout << "**************STARS OF {0,1} ARE\n"; + std::clog << "**************STARS OF {0,1} ARE\n"; for (auto& simplex : simplexTree.star_simplex_range(simplexTree.find({0, 1}))) { - for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::cout << "(" << vertex << ")"; - std::cout << std::endl; + for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::clog << "(" << vertex << ")"; + std::clog << std::endl; } - std::cout << "**************BOUNDARIES OF {0,1,2} ARE\n"; + std::clog << "**************BOUNDARIES OF {0,1,2} ARE\n"; for (auto& simplex : simplexTree.boundary_simplex_range(simplexTree.find({0, 1, 2}))) { - for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::cout << "(" << vertex << ")"; - std::cout << std::endl; + for (auto vertex : simplexTree.simplex_vertex_range(simplex)) std::clog << "(" << vertex << ")"; + std::clog << std::endl; } return 0; diff --git a/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp b/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp index f6dfa53c..6278efa7 100644 --- a/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp +++ b/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp @@ -42,67 +42,67 @@ int main(int argc, char * const argv[]) { // insert the graph in the simplex tree as 1-skeleton st.insert_graph(g); end = clock(); - std::cout << "Insert the 1-skeleton in the simplex tree in " + std::clog << "Insert the 1-skeleton in the simplex tree in " << static_cast(end - start) / CLOCKS_PER_SEC << " s. \n"; start = clock(); // expand the 1-skeleton until dimension max_dim st.expansion(max_dim); end = clock(); - std::cout << "max_dim = " << max_dim << "\n"; - std::cout << "Expand the simplex tree in " + std::clog << "max_dim = " << max_dim << "\n"; + std::clog << "Expand the simplex tree in " << static_cast(end - start) / CLOCKS_PER_SEC << " s. \n"; - std::cout << "Information of the Simplex Tree: " << std::endl; - std::cout << " Number of vertices = " << st.num_vertices() << " "; - std::cout << " Number of simplices = " << st.num_simplices() << std::endl; - std::cout << std::endl << std::endl; + std::clog << "Information of the Simplex Tree: " << std::endl; + std::clog << " Number of vertices = " << st.num_vertices() << " "; + std::clog << " Number of simplices = " << st.num_simplices() << std::endl; + std::clog << std::endl << std::endl; - std::cout << "Iterator on vertices: "; + std::clog << "Iterator on vertices: "; for (auto vertex : st.complex_vertex_range()) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; - std::cout << std::endl << std::endl; + std::clog << std::endl << std::endl; - std::cout << "Iterator on simplices: " << std::endl; + std::clog << "Iterator on simplices: " << std::endl; for (auto simplex : st.complex_simplex_range()) { - std::cout << " "; + std::clog << " "; for (auto vertex : st.simplex_vertex_range(simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } - std::cout << std::endl << std::endl; + std::clog << std::endl << std::endl; - std::cout << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } - std::cout << std::endl << std::endl; + std::clog << std::endl << std::endl; - std::cout << "Iterator on Simplices in the filtration, and their boundary simplices:" << std::endl; + std::clog << "Iterator on Simplices in the filtration, and their boundary simplices:" << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; for (auto b_simplex : st.boundary_simplex_range(f_simplex)) { - std::cout << " " << "[" << st.filtration(b_simplex) << "] "; + std::clog << " " << "[" << st.filtration(b_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(b_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } } return 0; diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 76608008..6e80b77f 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -286,7 +286,7 @@ class Simplex_tree { /** \brief User-defined copy constructor reproduces the whole tree structure. */ Simplex_tree(const Simplex_tree& complex_source) { #ifdef DEBUG_TRACES - std::cout << "Simplex_tree copy constructor" << std::endl; + std::clog << "Simplex_tree copy constructor" << std::endl; #endif // DEBUG_TRACES copy_from(complex_source); } @@ -296,7 +296,7 @@ class Simplex_tree { */ Simplex_tree(Simplex_tree && complex_source) { #ifdef DEBUG_TRACES - std::cout << "Simplex_tree move constructor" << std::endl; + std::clog << "Simplex_tree move constructor" << std::endl; #endif // DEBUG_TRACES move_from(complex_source); @@ -313,7 +313,7 @@ class Simplex_tree { /** \brief User-defined copy assignment reproduces the whole tree structure. */ Simplex_tree& operator= (const Simplex_tree& complex_source) { #ifdef DEBUG_TRACES - std::cout << "Simplex_tree copy assignment" << std::endl; + std::clog << "Simplex_tree copy assignment" << std::endl; #endif // DEBUG_TRACES // Self-assignment detection if (&complex_source != this) { @@ -330,7 +330,7 @@ class Simplex_tree { */ Simplex_tree& operator=(Simplex_tree&& complex_source) { #ifdef DEBUG_TRACES - std::cout << "Simplex_tree move assignment" << std::endl; + std::clog << "Simplex_tree move assignment" << std::endl; #endif // DEBUG_TRACES // Self-assignment detection if (&complex_source != this) { @@ -1418,9 +1418,9 @@ class Simplex_tree { for (Simplex_handle sh : complex_simplex_range()) { #ifdef DEBUG_TRACES for (auto vertex : simplex_vertex_range(sh)) { - std::cout << " " << vertex; + std::clog << " " << vertex; } - std::cout << std::endl; + std::clog << std::endl; #endif // DEBUG_TRACES int sh_dimension = dimension(sh); diff --git a/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp index c0615b12..229ae46f 100644 --- a/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_ctor_and_move_unit_test.cpp @@ -30,16 +30,16 @@ void print_simplex_filtration(Simplex_tree& st, const std::string& msg) { // Required before browsing through filtration values st.initialize_filtration(); - std::cout << "********************************************************************\n"; - std::cout << "* " << msg << "\n"; - std::cout << "* The complex contains " << st.num_simplices() << " simplices"; - std::cout << " - dimension " << st.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "********************************************************************\n"; + std::clog << "* " << msg << "\n"; + std::clog << "* The complex contains " << st.num_simplices() << " simplices"; + std::clog << " - dimension " << st.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; - for (auto vertex : st.simplex_vertex_range(f_simplex)) std::cout << "(" << vertex << ")"; - std::cout << std::endl; + for (auto vertex : st.simplex_vertex_range(f_simplex)) std::clog << "(" << vertex << ")"; + std::clog << std::endl; } } @@ -70,8 +70,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te print_simplex_filtration(st, "Default Simplex_tree is initialized"); - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF COPY CONSTRUCTOR" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF COPY CONSTRUCTOR" << std::endl; Simplex_tree st1(st); Simplex_tree st2(st); @@ -82,8 +82,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te BOOST_CHECK(st == st2); BOOST_CHECK(st1 == st); - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF COPY ASSIGNMENT" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF COPY ASSIGNMENT" << std::endl; Simplex_tree st3; // To check there is no memory leak st3.insert_simplex_and_subfaces({9, 10, 11}, 200.0); @@ -103,8 +103,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te BOOST_CHECK(st3 == st); - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF MOVE CONSTRUCTOR" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF MOVE CONSTRUCTOR" << std::endl; Simplex_tree st5(std::move(st1)); print_simplex_filtration(st5, "First move constructor from the default Simplex_tree"); print_simplex_filtration(st1, "First moved Simplex_tree shall be empty"); @@ -122,8 +122,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_copy_constructor, Simplex_tree, list_of_te BOOST_CHECK(empty_st == st2); BOOST_CHECK(st1 == empty_st); - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF MOVE ASSIGNMENT" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF MOVE ASSIGNMENT" << std::endl; Simplex_tree st7; // To check there is no memory leak diff --git a/src/Simplex_tree/test/simplex_tree_graph_expansion_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_graph_expansion_unit_test.cpp index fab25eb8..881a06ae 100644 --- a/src/Simplex_tree/test/simplex_tree_graph_expansion_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_graph_expansion_unit_test.cpp @@ -55,34 +55,34 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_expansion_with_blockers_3, typeST, li simplex_tree.expansion_with_blockers(3, [&](Simplex_handle sh){ bool result = false; - std::cout << "Blocker on ["; + std::clog << "Blocker on ["; // User can loop on the vertices from the given simplex_handle i.e. for (auto vertex : simplex_tree.simplex_vertex_range(sh)) { // We block the expansion, if the vertex '6' is in the given list of vertices if (vertex == 6) result = true; - std::cout << vertex << ", "; + std::clog << vertex << ", "; } - std::cout << "] ( " << simplex_tree.filtration(sh); + std::clog << "] ( " << simplex_tree.filtration(sh); // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries) simplex_tree.assign_filtration(sh, simplex_tree.filtration(sh) + 1.); - std::cout << " + 1. ) = " << result << std::endl; + std::clog << " + 1. ) = " << result << std::endl; return result; }); - std::cout << "********************************************************************\n"; - std::cout << "simplex_tree_expansion_with_blockers_3\n"; - std::cout << "********************************************************************\n"; - std::cout << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; - std::cout << " - dimension " << simplex_tree.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "********************************************************************\n"; + std::clog << "simplex_tree_expansion_with_blockers_3\n"; + std::clog << "********************************************************************\n"; + std::clog << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; + std::clog << " - dimension " << simplex_tree.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { - std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) - std::cout << "(" << vertex << ")"; - std::cout << std::endl; + std::clog << "(" << vertex << ")"; + std::clog << std::endl; } BOOST_CHECK(simplex_tree.num_simplices() == 23); @@ -117,34 +117,34 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_expansion_with_blockers_2, typeST, li simplex_tree.expansion_with_blockers(2, [&](Simplex_handle sh){ bool result = false; - std::cout << "Blocker on ["; + std::clog << "Blocker on ["; // User can loop on the vertices from the given simplex_handle i.e. for (auto vertex : simplex_tree.simplex_vertex_range(sh)) { // We block the expansion, if the vertex '6' is in the given list of vertices if (vertex == 6) result = true; - std::cout << vertex << ", "; + std::clog << vertex << ", "; } - std::cout << "] ( " << simplex_tree.filtration(sh); + std::clog << "] ( " << simplex_tree.filtration(sh); // User can re-assign a new filtration value directly in the blocker (default is the maximal value of boudaries) simplex_tree.assign_filtration(sh, simplex_tree.filtration(sh) + 1.); - std::cout << " + 1. ) = " << result << std::endl; + std::clog << " + 1. ) = " << result << std::endl; return result; }); - std::cout << "********************************************************************\n"; - std::cout << "simplex_tree_expansion_with_blockers_2\n"; - std::cout << "********************************************************************\n"; - std::cout << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; - std::cout << " - dimension " << simplex_tree.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "********************************************************************\n"; + std::clog << "simplex_tree_expansion_with_blockers_2\n"; + std::clog << "********************************************************************\n"; + std::clog << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; + std::clog << " - dimension " << simplex_tree.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { - std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) - std::cout << "(" << vertex << ")"; - std::cout << std::endl; + std::clog << "(" << vertex << ")"; + std::clog << std::endl; } BOOST_CHECK(simplex_tree.num_simplices() == 22); @@ -176,17 +176,17 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_expansion, typeST, list_of_tested_var simplex_tree.insert_simplex({6}, 10.); simplex_tree.expansion(3); - std::cout << "********************************************************************\n"; - std::cout << "simplex_tree_expansion_3\n"; - std::cout << "********************************************************************\n"; - std::cout << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; - std::cout << " - dimension " << simplex_tree.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "********************************************************************\n"; + std::clog << "simplex_tree_expansion_3\n"; + std::clog << "********************************************************************\n"; + std::clog << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; + std::clog << " - dimension " << simplex_tree.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { - std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) - std::cout << "(" << vertex << ")"; - std::cout << std::endl; + std::clog << "(" << vertex << ")"; + std::clog << std::endl; } BOOST_CHECK(simplex_tree.num_simplices() == 24); @@ -220,17 +220,17 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_expansion_2, typeST, list_of_tested_v simplex_tree.expansion(2); - std::cout << "********************************************************************\n"; - std::cout << "simplex_tree_expansion_2\n"; - std::cout << "********************************************************************\n"; - std::cout << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; - std::cout << " - dimension " << simplex_tree.dimension() << "\n"; - std::cout << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; + std::clog << "********************************************************************\n"; + std::clog << "simplex_tree_expansion_2\n"; + std::clog << "********************************************************************\n"; + std::clog << "* The complex contains " << simplex_tree.num_simplices() << " simplices"; + std::clog << " - dimension " << simplex_tree.dimension() << "\n"; + std::clog << "* Iterator on Simplices in the filtration, with [filtration value]:\n"; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { - std::cout << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << " " << "[" << simplex_tree.filtration(f_simplex) << "] "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) - std::cout << "(" << vertex << ")"; - std::cout << std::endl; + std::clog << "(" << vertex << ")"; + std::clog << std::endl; } BOOST_CHECK(simplex_tree.num_simplices() == 23); diff --git a/src/Simplex_tree/test/simplex_tree_iostream_operator_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_iostream_operator_unit_test.cpp index 28c29489..20007488 100644 --- a/src/Simplex_tree/test/simplex_tree_iostream_operator_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_iostream_operator_unit_test.cpp @@ -34,8 +34,8 @@ typedef boost::mpl::list, > list_of_tested_variants; BOOST_AUTO_TEST_CASE_TEMPLATE(iostream_operator, Stree_type, list_of_tested_variants) { - std::cout << "********************************************************************" << std::endl; - std::cout << "SIMPLEX TREE IOSTREAM OPERATOR" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "SIMPLEX TREE IOSTREAM OPERATOR" << std::endl; Stree_type st; @@ -46,15 +46,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(iostream_operator, Stree_type, list_of_tested_vari st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The ORIGINAL complex contains " << st.num_simplices() << " simplices - dimension = " + std::clog << "The ORIGINAL complex contains " << st.num_simplices() << " simplices - dimension = " << st.dimension() << std::endl; - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } // st: @@ -75,15 +75,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(iostream_operator, Stree_type, list_of_tested_vari simplex_tree_istream >> read_st; // Display the Simplex_tree - std::cout << "The READ complex contains " << read_st.num_simplices() << " simplices - dimension = " + std::clog << "The READ complex contains " << read_st.num_simplices() << " simplices - dimension = " << read_st.dimension() << std::endl; - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : read_st.filtration_simplex_range()) { - std::cout << " " << "[" << read_st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << read_st.filtration(f_simplex) << "] "; for (auto vertex : read_st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } BOOST_CHECK(st == read_st); @@ -91,8 +91,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(iostream_operator, Stree_type, list_of_tested_vari BOOST_AUTO_TEST_CASE(mini_iostream_operator) { - std::cout << "********************************************************************" << std::endl; - std::cout << "MINI SIMPLEX TREE IOSTREAM OPERATOR" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "MINI SIMPLEX TREE IOSTREAM OPERATOR" << std::endl; Simplex_tree st; @@ -103,14 +103,14 @@ BOOST_AUTO_TEST_CASE(mini_iostream_operator) { st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The ORIGINAL complex contains " << st.num_simplices() << " simplices - dimension = " + std::clog << "The ORIGINAL complex contains " << st.num_simplices() << " simplices - dimension = " << st.dimension() << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } // st: @@ -131,15 +131,15 @@ BOOST_AUTO_TEST_CASE(mini_iostream_operator) { simplex_tree_istream >> read_st; // Display the Simplex_tree - std::cout << "The READ complex contains " << read_st.num_simplices() << " simplices - dimension = " + std::clog << "The READ complex contains " << read_st.num_simplices() << " simplices - dimension = " << read_st.dimension() << std::endl; - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : read_st.filtration_simplex_range()) { - std::cout << " " << "[" << read_st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << read_st.filtration(f_simplex) << "] "; for (auto vertex : read_st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } BOOST_CHECK(st == read_st); diff --git a/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp index 97347992..36b8b3c6 100644 --- a/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp @@ -32,8 +32,8 @@ using Mini_stree = Simplex_tree; using Stree = Simplex_tree<>; BOOST_AUTO_TEST_CASE(remove_maximal_simplex) { - std::cout << "********************************************************************" << std::endl; - std::cout << "REMOVE MAXIMAL SIMPLEX" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "REMOVE MAXIMAL SIMPLEX" << std::endl; Mini_stree st; @@ -66,21 +66,21 @@ BOOST_AUTO_TEST_CASE(remove_maximal_simplex) { // 5 #ifdef GUDHI_DEBUG - std::cout << "Check exception throw in debug mode" << std::endl; + std::clog << "Check exception throw in debug mode" << std::endl; // throw excpt because sh has children BOOST_CHECK_THROW (st.remove_maximal_simplex(st.find({0, 1, 6})), std::invalid_argument); BOOST_CHECK_THROW (st.remove_maximal_simplex(st.find({3})), std::invalid_argument); BOOST_CHECK(st == st_complete); #endif - std::cout << "st.remove_maximal_simplex({0, 2})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 2})" << std::endl; st.remove_maximal_simplex(st.find({0, 2})); - std::cout << "st.remove_maximal_simplex({0, 1, 2})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 1, 2})" << std::endl; st.remove_maximal_simplex(st.find({0, 1, 2})); - std::cout << "st.remove_maximal_simplex({1, 2})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 2})" << std::endl; st.remove_maximal_simplex(st.find({1, 2})); - std::cout << "st.remove_maximal_simplex({2})" << std::endl; + std::clog << "st.remove_maximal_simplex({2})" << std::endl; st.remove_maximal_simplex(st.find({2})); - std::cout << "st.remove_maximal_simplex({3})" << std::endl; + std::clog << "st.remove_maximal_simplex({3})" << std::endl; st.remove_maximal_simplex(st.find({0, 3})); BOOST_CHECK(st == st_pruned); @@ -102,39 +102,39 @@ BOOST_AUTO_TEST_CASE(remove_maximal_simplex) { // 5 // Remove all 7 to test the both remove_maximal_simplex cases (when _members is empty or not) - std::cout << "st.remove_maximal_simplex({0, 1, 6, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 1, 6, 7})" << std::endl; st.remove_maximal_simplex(st.find({0, 1, 6, 7})); - std::cout << "st.remove_maximal_simplex({0, 1, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 1, 7})" << std::endl; st.remove_maximal_simplex(st.find({0, 1, 7})); - std::cout << "st.remove_maximal_simplex({0, 6, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 6, 7})" << std::endl; st.remove_maximal_simplex(st.find({0, 6, 7})); - std::cout << "st.remove_maximal_simplex({0, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 7})" << std::endl; st.remove_maximal_simplex(st.find({0, 7})); - std::cout << "st.remove_maximal_simplex({1, 6, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 6, 7})" << std::endl; st.remove_maximal_simplex(st.find({1, 6, 7})); - std::cout << "st.remove_maximal_simplex({1, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 7})" << std::endl; st.remove_maximal_simplex(st.find({1, 7})); - std::cout << "st.remove_maximal_simplex({6, 7})" << std::endl; + std::clog << "st.remove_maximal_simplex({6, 7})" << std::endl; st.remove_maximal_simplex(st.find({6, 7})); - std::cout << "st.remove_maximal_simplex({7})" << std::endl; + std::clog << "st.remove_maximal_simplex({7})" << std::endl; st.remove_maximal_simplex(st.find({7})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); // Check dimension calls lower_upper_bound_dimension to recompute dimension BOOST_CHECK(st.dimension() == 2); BOOST_CHECK(st.upper_bound_dimension() == 2); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << " | st_wo_seven.upper_bound_dimension()=" << st_wo_seven.upper_bound_dimension() << std::endl; - std::cout << "st.dimension()=" << st.dimension() << " | st_wo_seven.dimension()=" << st_wo_seven.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << " | st_wo_seven.dimension()=" << st_wo_seven.dimension() << std::endl; BOOST_CHECK(st == st_wo_seven); } BOOST_AUTO_TEST_CASE(auto_dimension_set) { - std::cout << "********************************************************************" << std::endl; - std::cout << "DIMENSION ON REMOVE MAXIMAL SIMPLEX" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "DIMENSION ON REMOVE MAXIMAL SIMPLEX" << std::endl; Mini_stree st; @@ -148,80 +148,80 @@ BOOST_AUTO_TEST_CASE(auto_dimension_set) { BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({6, 7, 8, 10})" << std::endl; + std::clog << "st.remove_maximal_simplex({6, 7, 8, 10})" << std::endl; st.remove_maximal_simplex(st.find({6, 7, 8, 10})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({6, 7, 8, 9})" << std::endl; + std::clog << "st.remove_maximal_simplex({6, 7, 8, 9})" << std::endl; st.remove_maximal_simplex(st.find({6, 7, 8, 9})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl; st.remove_maximal_simplex(st.find({1, 2, 3, 4})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl; st.remove_maximal_simplex(st.find({1, 2, 3, 5})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 2); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; - std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl; + std::clog << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl; st.insert_simplex_and_subfaces({1, 2, 3, 5}); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl; + std::clog << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl; st.insert_simplex_and_subfaces({1, 2, 3, 4}); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl; st.remove_maximal_simplex(st.find({1, 2, 3, 5})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl; + std::clog << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl; st.remove_maximal_simplex(st.find({1, 2, 3, 4})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 2); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; - std::cout << "st.insert_simplex_and_subfaces({0, 1, 3, 4})" << std::endl; + std::clog << "st.insert_simplex_and_subfaces({0, 1, 3, 4})" << std::endl; st.insert_simplex_and_subfaces({0, 1, 3, 4}); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.remove_maximal_simplex({0, 1, 3, 4})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 1, 3, 4})" << std::endl; st.remove_maximal_simplex(st.find({0, 1, 3, 4})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 2); - std::cout << "st.dimension()=" << st.dimension() << std::endl; + std::clog << "st.dimension()=" << st.dimension() << std::endl; - std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl; + std::clog << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl; st.insert_simplex_and_subfaces({1, 2, 3, 5}); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl; + std::clog << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl; st.insert_simplex_and_subfaces({1, 2, 3, 4}); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); @@ -229,7 +229,7 @@ BOOST_AUTO_TEST_CASE(auto_dimension_set) { // Check you can override the dimension // This is a limit test case - shall not happen st.set_dimension(1); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 1); // check dimension() and lower_upper_bound_dimension() is not giving the right answer because dimension is too low BOOST_CHECK(st.dimension() == 1); @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(auto_dimension_set) { // Check you can override the dimension // This is a limit test case - shall not happen st.set_dimension(6); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 6); // check dimension() do not launch lower_upper_bound_dimension() BOOST_CHECK(st.dimension() == 6); @@ -246,27 +246,27 @@ BOOST_AUTO_TEST_CASE(auto_dimension_set) { // Reset with the correct value st.set_dimension(3); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == 3); - std::cout << "st.insert_simplex_and_subfaces({0, 1, 2, 3, 4, 5, 6})" << std::endl; + std::clog << "st.insert_simplex_and_subfaces({0, 1, 2, 3, 4, 5, 6})" << std::endl; st.insert_simplex_and_subfaces({0, 1, 2, 3, 4, 5, 6}); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 6); BOOST_CHECK(st.dimension() == 6); - std::cout << "st.remove_maximal_simplex({0, 1, 2, 3, 4, 5, 6})" << std::endl; + std::clog << "st.remove_maximal_simplex({0, 1, 2, 3, 4, 5, 6})" << std::endl; st.remove_maximal_simplex(st.find({0, 1, 2, 3, 4, 5, 6})); - std::cout << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; + std::clog << "st.upper_bound_dimension()=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 6); BOOST_CHECK(st.dimension() == 5); } BOOST_AUTO_TEST_CASE(prune_above_filtration) { - std::cout << "********************************************************************" << std::endl; - std::cout << "PRUNE ABOVE FILTRATION" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "PRUNE ABOVE FILTRATION" << std::endl; Stree st; @@ -321,15 +321,15 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { BOOST_CHECK(!simplex_is_changed); // Display the Simplex_tree - std::cout << "The complex contains " << st.num_simplices() << " simplices"; - std::cout << " - dimension " << st.dimension() << std::endl; - std::cout << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << "The complex contains " << st.num_simplices() << " simplices"; + std::clog << " - dimension " << st.dimension() << std::endl; + std::clog << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } // Check the pruned cases @@ -340,15 +340,15 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { BOOST_CHECK(simplex_is_changed); // Display the Simplex_tree - std::cout << "The complex pruned at 2.5 contains " << st.num_simplices() << " simplices"; - std::cout << " - dimension " << st.dimension() << std::endl; + std::clog << "The complex pruned at 2.5 contains " << st.num_simplices() << " simplices"; + std::clog << " - dimension " << st.dimension() << std::endl; simplex_is_changed = st.prune_above_filtration(2.0); if (simplex_is_changed) st.initialize_filtration(); - std::cout << "The complex pruned at 2.0 contains " << st.num_simplices() << " simplices"; - std::cout << " - dimension " << st.dimension() << std::endl; + std::clog << "The complex pruned at 2.0 contains " << st.num_simplices() << " simplices"; + std::clog << " - dimension " << st.dimension() << std::endl; BOOST_CHECK(st == st_pruned); BOOST_CHECK(!simplex_is_changed); @@ -360,12 +360,12 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The complex pruned at 0.0 contains " << st.num_simplices() << " simplices"; - std::cout << " - upper_bound_dimension " << st.upper_bound_dimension() << std::endl; + std::clog << "The complex pruned at 0.0 contains " << st.num_simplices() << " simplices"; + std::clog << " - upper_bound_dimension " << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == 3); BOOST_CHECK(st.dimension() == -1); - std::cout << "upper_bound_dimension=" << st.upper_bound_dimension() << std::endl; + std::clog << "upper_bound_dimension=" << st.upper_bound_dimension() << std::endl; BOOST_CHECK(st.upper_bound_dimension() == -1); BOOST_CHECK(st == st_empty); @@ -380,8 +380,8 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { } BOOST_AUTO_TEST_CASE(mini_prune_above_filtration) { - std::cout << "********************************************************************" << std::endl; - std::cout << "MINI PRUNE ABOVE FILTRATION" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "MINI PRUNE ABOVE FILTRATION" << std::endl; Mini_stree st; @@ -402,7 +402,7 @@ BOOST_AUTO_TEST_CASE(mini_prune_above_filtration) { st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << "The complex contains " << st.num_simplices() << " simplices" << std::endl; BOOST_CHECK(st.num_simplices() == 27); // Test case to the limit - With these options, there is no filtration, which means filtration is 0 @@ -410,7 +410,7 @@ BOOST_AUTO_TEST_CASE(mini_prune_above_filtration) { if (simplex_is_changed) st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The complex pruned at 1.0 contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << "The complex pruned at 1.0 contains " << st.num_simplices() << " simplices" << std::endl; BOOST_CHECK(!simplex_is_changed); BOOST_CHECK(st.num_simplices() == 27); @@ -418,7 +418,7 @@ BOOST_AUTO_TEST_CASE(mini_prune_above_filtration) { if (simplex_is_changed) st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The complex pruned at 0.0 contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << "The complex pruned at 0.0 contains " << st.num_simplices() << " simplices" << std::endl; BOOST_CHECK(!simplex_is_changed); BOOST_CHECK(st.num_simplices() == 27); @@ -427,11 +427,11 @@ BOOST_AUTO_TEST_CASE(mini_prune_above_filtration) { if (simplex_is_changed) st.initialize_filtration(); // Display the Simplex_tree - std::cout << "The complex pruned at -1.0 contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << "The complex pruned at -1.0 contains " << st.num_simplices() << " simplices" << std::endl; BOOST_CHECK(simplex_is_changed); BOOST_CHECK(st.num_simplices() == 0); // Display the Simplex_tree - std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << "The complex contains " << st.num_simplices() << " simplices" << std::endl; } diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index 58bfa8db..7746fa2a 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -48,22 +48,22 @@ void test_empty_simplex_tree(typeST& tst) { template void test_iterators_on_empty_simplex_tree(typeST& tst) { - std::cout << "Iterator on vertices: " << std::endl; + std::clog << "Iterator on vertices: " << std::endl; for (auto vertex : tst.complex_vertex_range()) { - std::cout << "vertice:" << vertex << std::endl; + std::clog << "vertice:" << vertex << std::endl; BOOST_CHECK(false); // shall be empty } - std::cout << "Iterator on simplices: " << std::endl; + std::clog << "Iterator on simplices: " << std::endl; for (auto simplex : tst.complex_simplex_range()) { BOOST_CHECK(simplex != simplex); // shall be empty - to remove warning of non-used simplex } - std::cout + std::clog << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : tst.filtration_simplex_range()) { BOOST_CHECK(false); // shall be empty - std::cout << "test_iterators_on_empty_simplex_tree - filtration=" + std::clog << "test_iterators_on_empty_simplex_tree - filtration=" << tst.filtration(f_simplex) << std::endl; } } @@ -72,15 +72,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_when_empty, typeST, list_of_tested_va typedef std::pair typePairSimplexBool; typedef std::vector typeVectorVertex; - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF DEFAULT CONSTRUCTOR" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF DEFAULT CONSTRUCTOR" << std::endl; typeST st; test_empty_simplex_tree(st); test_iterators_on_empty_simplex_tree(st); // TEST OF EMPTY INSERTION - std::cout << "TEST OF EMPTY INSERTION" << std::endl; + std::clog << "TEST OF EMPTY INSERTION" << std::endl; typeVectorVertex simplexVectorEmpty; BOOST_CHECK(simplexVectorEmpty.empty() == true); typePairSimplexBool returnEmptyValue = st.insert_simplex(simplexVectorEmpty, 0.0); @@ -98,8 +98,8 @@ bool AreAlmostTheSame(float a, float b) { BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_from_file, typeST, list_of_tested_variants) { // TEST OF INSERTION - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF SIMPLEX TREE FROM A FILE" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF SIMPLEX TREE FROM A FILE" << std::endl; typeST st; std::string inputFile("simplex_tree_for_unit_test.txt"); @@ -107,8 +107,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_from_file, typeST, list_of_tested_var simplex_tree_stream >> st; // Display the Simplex_tree - std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; - std::cout << " - dimension " << st.dimension() << std::endl; + std::clog << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << " - dimension " << st.dimension() << std::endl; // Check BOOST_CHECK(st.num_simplices() == 143353); @@ -134,13 +134,13 @@ template void test_simplex_tree_contains(typeST& simplexTree, typeSimplex& simplex, int pos) { auto f_simplex = simplexTree.filtration_simplex_range().begin() + pos; - std::cout << "test_simplex_tree_contains - filtration=" << simplexTree.filtration(*f_simplex) << "||" << simplex.second << std::endl; + std::clog << "test_simplex_tree_contains - filtration=" << simplexTree.filtration(*f_simplex) << "||" << simplex.second << std::endl; BOOST_CHECK(AreAlmostTheSame(simplexTree.filtration(*f_simplex), simplex.second)); int simplexIndex = simplex.first.size() - 1; std::sort(simplex.first.begin(), simplex.first.end()); // if the simplex wasn't sorted, the next test could fail for (auto vertex : simplexTree.simplex_vertex_range(*f_simplex)) { - std::cout << "test_simplex_tree_contains - vertex=" << vertex << "||" << simplex.first.at(simplexIndex) << std::endl; + std::clog << "test_simplex_tree_contains - vertex=" << vertex << "||" << simplex.first.at(simplexIndex) << std::endl; BOOST_CHECK(vertex == simplex.first.at(simplexIndex)); BOOST_CHECK(simplexIndex >= 0); simplexIndex--; @@ -163,7 +163,7 @@ void set_and_test_simplex_tree_dim_fil(typeST& simplexTree, int vectorSize, cons if (vectorSize > dim_max + 1) { dim_max = vectorSize - 1; simplexTree.set_dimension(dim_max); - std::cout << " set_and_test_simplex_tree_dim_fil - dim_max=" << dim_max + std::clog << " set_and_test_simplex_tree_dim_fil - dim_max=" << dim_max << std::endl; } @@ -193,12 +193,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var dim_max = -1; // TEST OF INSERTION - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF INSERTION" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF INSERTION" << std::endl; typeST st; // ++ FIRST - std::cout << " - INSERT 0" << std::endl; + std::clog << " - INSERT 0" << std::endl; typeVectorVertex firstSimplexVector{0}; BOOST_CHECK(firstSimplexVector.size() == 1); typeSimplex firstSimplex = std::make_pair(firstSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); @@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 1); // ++ SECOND - std::cout << " - INSERT 1" << std::endl; + std::clog << " - INSERT 1" << std::endl; typeVectorVertex secondSimplexVector{1}; BOOST_CHECK(secondSimplexVector.size() == 1); typeSimplex secondSimplex = std::make_pair(secondSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); @@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 2); // ++ THIRD - std::cout << " - INSERT (0,1)" << std::endl; + std::clog << " - INSERT (0,1)" << std::endl; typeVectorVertex thirdSimplexVector{0, 1}; BOOST_CHECK(thirdSimplexVector.size() == 2); typeSimplex thirdSimplex = std::make_pair(thirdSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 2); // Not incremented !! // ++ FOURTH - std::cout << " - INSERT 2" << std::endl; + std::clog << " - INSERT 2" << std::endl; typeVectorVertex fourthSimplexVector{2}; BOOST_CHECK(fourthSimplexVector.size() == 1); typeSimplex fourthSimplex = std::make_pair(fourthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); @@ -242,7 +242,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 3); // ++ FIFTH - std::cout << " - INSERT (2,0)" << std::endl; + std::clog << " - INSERT (2,0)" << std::endl; typeVectorVertex fifthSimplexVector{2, 0}; BOOST_CHECK(fifthSimplexVector.size() == 2); typeSimplex fifthSimplex = std::make_pair(fifthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); @@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 3); // Not incremented !! // ++ SIXTH - std::cout << " - INSERT (2,1)" << std::endl; + std::clog << " - INSERT (2,1)" << std::endl; typeVectorVertex sixthSimplexVector{2, 1}; BOOST_CHECK(sixthSimplexVector.size() == 2); typeSimplex sixthSimplex = std::make_pair(sixthSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); @@ -264,7 +264,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 3); // Not incremented !! // ++ SEVENTH - std::cout << " - INSERT (2,1,0)" << std::endl; + std::clog << " - INSERT (2,1,0)" << std::endl; typeVectorVertex seventhSimplexVector{2, 1, 0}; BOOST_CHECK(seventhSimplexVector.size() == 3); typeSimplex seventhSimplex = std::make_pair(seventhSimplexVector, Filtration_value(THIRD_FILTRATION_VALUE)); @@ -275,7 +275,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 3); // Not incremented !! // ++ EIGHTH - std::cout << " - INSERT 3" << std::endl; + std::clog << " - INSERT 3" << std::endl; typeVectorVertex eighthSimplexVector{3}; BOOST_CHECK(eighthSimplexVector.size() == 1); typeSimplex eighthSimplex = std::make_pair(eighthSimplexVector, Filtration_value(FIRST_FILTRATION_VALUE)); @@ -286,7 +286,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 4); // ++ NINETH - std::cout << " - INSERT (3,0)" << std::endl; + std::clog << " - INSERT (3,0)" << std::endl; typeVectorVertex ninethSimplexVector{3, 0}; BOOST_CHECK(ninethSimplexVector.size() == 2); typeSimplex ninethSimplex = std::make_pair(ninethSimplexVector, Filtration_value(SECOND_FILTRATION_VALUE)); @@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var BOOST_CHECK(st.num_vertices() == (size_t) 4); // Not incremented !! // ++ TENTH - std::cout << " - INSERT 0 (already inserted)" << std::endl; + std::clog << " - INSERT 0 (already inserted)" << std::endl; typeVectorVertex tenthSimplexVector{0}; BOOST_CHECK(tenthSimplexVector.size() == 1); // With a different filtration value @@ -308,12 +308,12 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var // Simplex_handle = boost::container::flat_map< typeST::Vertex_handle, Node >::iterator typename typeST::Simplex_handle shReturned = returnValue.first; BOOST_CHECK(shReturned == typename typeST::Simplex_handle(nullptr)); - std::cout << "st.num_vertices()=" << st.num_vertices() << std::endl; + std::clog << "st.num_vertices()=" << st.num_vertices() << std::endl; BOOST_CHECK(st.num_vertices() == (size_t) 4); // Not incremented !! BOOST_CHECK(st.dimension() == dim_max); // ++ ELEVENTH - std::cout << " - INSERT (2,1,0) (already inserted)" << std::endl; + std::clog << " - INSERT (2,1,0) (already inserted)" << std::endl; typeVectorVertex eleventhSimplexVector{2, 1, 0}; BOOST_CHECK(eleventhSimplexVector.size() == 3); typeSimplex eleventhSimplex = std::make_pair(eleventhSimplexVector, Filtration_value(FOURTH_FILTRATION_VALUE)); @@ -343,35 +343,35 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insertion, typeST, list_of_tested_var // [0.2] 3 0 // [0.3] 2 1 0 // !! Be careful, simplex are sorted by filtration value on insertion !! - std::cout << "simplex_tree_insertion - first - 0" << std::endl; + std::clog << "simplex_tree_insertion - first - 0" << std::endl; test_simplex_tree_contains(st, firstSimplex, 0); // (0) -> 0 - std::cout << "simplex_tree_insertion - second - 1" << std::endl; + std::clog << "simplex_tree_insertion - second - 1" << std::endl; test_simplex_tree_contains(st, secondSimplex, 1); // (1) -> 1 - std::cout << "simplex_tree_insertion - third - 4" << std::endl; + std::clog << "simplex_tree_insertion - third - 4" << std::endl; test_simplex_tree_contains(st, thirdSimplex, 4); // (0,1) -> 4 - std::cout << "simplex_tree_insertion - fourth - 2" << std::endl; + std::clog << "simplex_tree_insertion - fourth - 2" << std::endl; test_simplex_tree_contains(st, fourthSimplex, 2); // (2) -> 2 - std::cout << "simplex_tree_insertion - fifth - 5" << std::endl; + std::clog << "simplex_tree_insertion - fifth - 5" << std::endl; test_simplex_tree_contains(st, fifthSimplex, 5); // (2,0) -> 5 - std::cout << "simplex_tree_insertion - sixth - 6" << std::endl; + std::clog << "simplex_tree_insertion - sixth - 6" << std::endl; test_simplex_tree_contains(st, sixthSimplex, 6); //(2,1) -> 6 - std::cout << "simplex_tree_insertion - seventh - 8" << std::endl; + std::clog << "simplex_tree_insertion - seventh - 8" << std::endl; test_simplex_tree_contains(st, seventhSimplex, 8); // (2,1,0) -> 8 - std::cout << "simplex_tree_insertion - eighth - 3" << std::endl; + std::clog << "simplex_tree_insertion - eighth - 3" << std::endl; test_simplex_tree_contains(st, eighthSimplex, 3); // (3) -> 3 - std::cout << "simplex_tree_insertion - nineth - 7" << std::endl; + std::clog << "simplex_tree_insertion - nineth - 7" << std::endl; test_simplex_tree_contains(st, ninethSimplex, 7); // (3,0) -> 7 // Display the Simplex_tree - Can not be done in the middle of 2 inserts - std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; - std::cout << " - dimension " << st.dimension() << std::endl; - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << " - dimension " << st.dimension() << std::endl; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } } @@ -380,14 +380,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o typedef std::pair typePairSimplexBool; typedef std::vector typeVectorVertex; typedef std::pair typeSimplex; - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST OF RECURSIVE INSERTION" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST OF RECURSIVE INSERTION" << std::endl; typeST st; typePairSimplexBool returnValue; int position = 0; // ++ FIRST - std::cout << " - INSERT (2,1,0)" << std::endl; + std::clog << " - INSERT (2,1,0)" << std::endl; typeVectorVertex SimplexVector1{2, 1, 0}; BOOST_CHECK(SimplexVector1.size() == 3); returnValue = st.insert_simplex_and_subfaces(SimplexVector1); @@ -400,13 +400,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o std::sort(SimplexVector1.begin(), SimplexVector1.end(), std::greater()); for (auto vertex : st.simplex_vertex_range(returnValue.first)) { // Check returned Simplex_handle - std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector1[position] << std::endl; + std::clog << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector1[position] << std::endl; BOOST_CHECK(vertex == SimplexVector1[position]); position++; } // ++ SECOND - std::cout << " - INSERT 3" << std::endl; + std::clog << " - INSERT 3" << std::endl; typeVectorVertex SimplexVector2{3}; BOOST_CHECK(SimplexVector2.size() == 1); returnValue = st.insert_simplex_and_subfaces(SimplexVector2); @@ -419,13 +419,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o std::sort(SimplexVector2.begin(), SimplexVector2.end(), std::greater()); for (auto vertex : st.simplex_vertex_range(returnValue.first)) { // Check returned Simplex_handle - std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector2[position] << std::endl; + std::clog << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector2[position] << std::endl; BOOST_CHECK(vertex == SimplexVector2[position]); position++; } // ++ THIRD - std::cout << " - INSERT (0,3)" << std::endl; + std::clog << " - INSERT (0,3)" << std::endl; typeVectorVertex SimplexVector3{3, 0}; BOOST_CHECK(SimplexVector3.size() == 2); returnValue = st.insert_simplex_and_subfaces(SimplexVector3); @@ -438,13 +438,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o std::sort(SimplexVector3.begin(), SimplexVector3.end(), std::greater()); for (auto vertex : st.simplex_vertex_range(returnValue.first)) { // Check returned Simplex_handle - std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector3[position] << std::endl; + std::clog << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector3[position] << std::endl; BOOST_CHECK(vertex == SimplexVector3[position]); position++; } // ++ FOURTH - std::cout << " - INSERT (1,0) (already inserted)" << std::endl; + std::clog << " - INSERT (1,0) (already inserted)" << std::endl; typeVectorVertex SimplexVector4{1, 0}; BOOST_CHECK(SimplexVector4.size() == 2); returnValue = st.insert_simplex_and_subfaces(SimplexVector4); @@ -455,7 +455,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o BOOST_CHECK(false == returnValue.second); // ++ FIFTH - std::cout << " - INSERT (3,4,5)" << std::endl; + std::clog << " - INSERT (3,4,5)" << std::endl; typeVectorVertex SimplexVector5{3, 4, 5}; BOOST_CHECK(SimplexVector5.size() == 3); returnValue = st.insert_simplex_and_subfaces(SimplexVector5); @@ -468,13 +468,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o std::sort(SimplexVector5.begin(), SimplexVector5.end(), std::greater()); for (auto vertex : st.simplex_vertex_range(returnValue.first)) { // Check returned Simplex_handle - std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector5[position] << std::endl; + std::clog << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector5[position] << std::endl; BOOST_CHECK(vertex == SimplexVector5[position]); position++; } // ++ SIXTH - std::cout << " - INSERT (0,1,6,7)" << std::endl; + std::clog << " - INSERT (0,1,6,7)" << std::endl; typeVectorVertex SimplexVector6{0, 1, 6, 7}; BOOST_CHECK(SimplexVector6.size() == 4); returnValue = st.insert_simplex_and_subfaces(SimplexVector6); @@ -487,7 +487,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o std::sort(SimplexVector6.begin(), SimplexVector6.end(), std::greater()); for (auto vertex : st.simplex_vertex_range(returnValue.first)) { // Check returned Simplex_handle - std::cout << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector6[position] << std::endl; + std::clog << "vertex = " << vertex << " | vector[" << position << "] = " << SimplexVector6[position] << std::endl; BOOST_CHECK(vertex == SimplexVector6[position]); position++; } @@ -525,63 +525,63 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(NSimplexAndSubfaces_tree_insertion, typeST, list_o // ------------------------------------------------------------------------------------------------------------------ typeVectorVertex simpleSimplexVector{1}; typename typeST::Simplex_handle simplexFound = st.find(simpleSimplexVector); - std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n"; if (simplexFound != st.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; // Check it is found BOOST_CHECK(simplexFound != st.null_simplex()); typeVectorVertex unknownSimplexVector{15}; simplexFound = st.find(unknownSimplexVector); - std::cout << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n"; if (simplexFound != st.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; // Check it is NOT found BOOST_CHECK(simplexFound == st.null_simplex()); simplexFound = st.find(SimplexVector6); - std::cout << "**************IS THE SIMPLEX {0,1,6,7} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {0,1,6,7} IN THE SIMPLEX TREE ?\n"; if (simplexFound != st.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; // Check it is found BOOST_CHECK(simplexFound != st.null_simplex()); typeVectorVertex otherSimplexVector{1, 15}; simplexFound = st.find(otherSimplexVector); - std::cout << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n"; if (simplexFound != st.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; // Check it is NOT found BOOST_CHECK(simplexFound == st.null_simplex()); typeVectorVertex invSimplexVector{1, 2, 0}; simplexFound = st.find(invSimplexVector); - std::cout << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n"; + std::clog << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n"; if (simplexFound != st.null_simplex()) - std::cout << "***+ YES IT IS!\n"; + std::clog << "***+ YES IT IS!\n"; else - std::cout << "***- NO IT ISN'T\n"; + std::clog << "***- NO IT ISN'T\n"; // Check it is found BOOST_CHECK(simplexFound != st.null_simplex()); // Display the Simplex_tree - Can not be done in the middle of 2 inserts - std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; - std::cout << " - dimension " << st.dimension() << std::endl; - std::cout << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; + std::clog << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + std::clog << " - dimension " << st.dimension() << std::endl; + std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:" << std::endl; for (auto f_simplex : st.filtration_simplex_range()) { - std::cout << " " << "[" << st.filtration(f_simplex) << "] "; + std::clog << " " << "[" << st.filtration(f_simplex) << "] "; for (auto vertex : st.simplex_vertex_range(f_simplex)) { - std::cout << (int) vertex << " "; + std::clog << (int) vertex << " "; } - std::cout << std::endl; + std::clog << std::endl; } } @@ -595,17 +595,17 @@ void test_cofaces(typeST& st, const std::vector& expected, int di for (auto simplex = cofaces.begin(); simplex != cofaces.end(); ++simplex) { typename typeST::Simplex_vertex_range rg = st.simplex_vertex_range(*simplex); for (auto vertex = rg.begin(); vertex != rg.end(); ++vertex) { - std::cout << "(" << *vertex << ")"; + std::clog << "(" << *vertex << ")"; } - std::cout << std::endl; + std::clog << std::endl; BOOST_CHECK(std::find(res.begin(), res.end(), *simplex) != res.end()); } } BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_variants) { typedef std::vector typeVectorVertex; - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST COFACE ALGORITHM" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST COFACE ALGORITHM" << std::endl; typeST st; typeVectorVertex SimplexVector{2, 1, 0}; @@ -631,7 +631,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_var std::vector simplex_result; std::vector result; - std::cout << "First test - Star of (3):" << std::endl; + std::clog << "First test - Star of (3):" << std::endl; simplex_result = {3}; result.push_back(st.find(simplex_result)); @@ -656,7 +656,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_var vertex.push_back(1); vertex.push_back(7); - std::cout << "Second test - Star of (1,7): " << std::endl; + std::clog << "Second test - Star of (1,7): " << std::endl; simplex_result = {7, 1}; result.push_back(st.find(simplex_result)); @@ -673,7 +673,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_var test_cofaces(st, vertex, 0, result); result.clear(); - std::cout << "Third test - 2-dimension Cofaces of simplex(1,7) : " << std::endl; + std::clog << "Third test - 2-dimension Cofaces of simplex(1,7) : " << std::endl; simplex_result = {7, 1, 0}; result.push_back(st.find(simplex_result)); @@ -684,15 +684,15 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_var test_cofaces(st, vertex, 1, result); result.clear(); - std::cout << "Cofaces with a codimension too high (codimension + vetices > tree.dimension) :" << std::endl; + std::clog << "Cofaces with a codimension too high (codimension + vetices > tree.dimension) :" << std::endl; test_cofaces(st, vertex, 5, result); - //std::cout << "Cofaces with an empty codimension" << std::endl; + //std::clog << "Cofaces with an empty codimension" << std::endl; //test_cofaces(st, vertex, -1, result); - // std::cout << "Cofaces in an empty simplex tree" << std::endl; + // std::clog << "Cofaces in an empty simplex tree" << std::endl; // typeST empty_tree; // test_cofaces(empty_tree, vertex, 1, result); - //std::cout << "Cofaces of an empty simplex" << std::endl; + //std::clog << "Cofaces of an empty simplex" << std::endl; //vertex.clear(); // test_cofaces(st, vertex, 1, result); @@ -700,8 +700,8 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(coface_on_simplex_tree, typeST, list_of_tested_var BOOST_AUTO_TEST_CASE_TEMPLATE(copy_move_on_simplex_tree, typeST, list_of_tested_variants) { typedef std::vector typeVectorVertex; - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST COPY MOVE CONSTRUCTORS" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST COPY MOVE CONSTRUCTORS" << std::endl; typeST st; typeVectorVertex SimplexVector{2, 1, 0}; @@ -725,11 +725,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(copy_move_on_simplex_tree, typeST, list_of_tested_ /* o */ /* 5 */ - std::cout << "Printing st - address = " << &st << std::endl; + std::clog << "Printing st - address = " << &st << std::endl; // Copy constructor typeST st_copy = st; - std::cout << "Printing a copy of st - address = " << &st_copy << std::endl; + std::clog << "Printing a copy of st - address = " << &st_copy << std::endl; // Check the data are the same BOOST_CHECK(st == st_copy); @@ -738,7 +738,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(copy_move_on_simplex_tree, typeST, list_of_tested_ // Move constructor typeST st_move = std::move(st); - std::cout << "Printing a move of st - address = " << &st_move << std::endl; + std::clog << "Printing a move of st - address = " << &st_move << std::endl; // Check the data are the same BOOST_CHECK(st_move == st_copy); @@ -753,7 +753,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(copy_move_on_simplex_tree, typeST, list_of_tested_ BOOST_CHECK(st.num_simplices() == 0); BOOST_CHECK(st.num_vertices() == (size_t)0); - std::cout << "Printing st once again- address = " << &st << std::endl; + std::clog << "Printing st once again- address = " << &st << std::endl; } template @@ -768,22 +768,22 @@ void test_simplex_is_vertex(typeST& st, typename typeST::Simplex_handle sh, type BOOST_AUTO_TEST_CASE(non_contiguous) { typedef Simplex_tree<> typeST; typedef typeST::Simplex_handle Simplex_handle; - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST NON-CONTIGUOUS VERTICES" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST NON-CONTIGUOUS VERTICES" << std::endl; typeST st; typeST::Vertex_handle e[] = {3,-7}; - std::cout << "Insert" << std::endl; + std::clog << "Insert" << std::endl; st.insert_simplex_and_subfaces(e); BOOST_CHECK(st.num_vertices() == 2); BOOST_CHECK(st.num_simplices() == 3); - std::cout << "Find" << std::endl; + std::clog << "Find" << std::endl; Simplex_handle sh = st.find(e); BOOST_CHECK(sh != st.null_simplex()); - std::cout << "Endpoints" << std::endl; + std::clog << "Endpoints" << std::endl; auto p = st.endpoints(sh); test_simplex_is_vertex(st, p.first, 3); test_simplex_is_vertex(st, p.second, -7); - std::cout << "Boundary" << std::endl; + std::clog << "Boundary" << std::endl; auto&& b = st.boundary_simplex_range(sh); auto i = std::begin(b); test_simplex_is_vertex(st, *i, -7); @@ -792,8 +792,8 @@ BOOST_AUTO_TEST_CASE(non_contiguous) { } BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) { - std::cout << "********************************************************************" << std::endl; - std::cout << "MAKE FILTRATION NON DECREASING" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "MAKE FILTRATION NON DECREASING" << std::endl; typedef Simplex_tree<> typeST; typeST st; @@ -810,7 +810,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) { /* o */ /* 5 */ - std::cout << "Check default insertion ensures the filtration values are non decreasing" << std::endl; + std::clog << "Check default insertion ensures the filtration values are non decreasing" << std::endl; BOOST_CHECK(!st.make_filtration_non_decreasing()); // Because of non decreasing property of simplex tree, { 0 } , { 1 } and { 0, 1 } are going to be set from value 2.0 @@ -826,7 +826,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) { // o // 5 - std::cout << "Check default second insertion ensures the filtration values are non decreasing" << std::endl; + std::clog << "Check default second insertion ensures the filtration values are non decreasing" << std::endl; BOOST_CHECK(!st.make_filtration_non_decreasing()); // Copy original simplex tree @@ -840,7 +840,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) { st.assign_filtration(st.find({3,4}), 1.1); st.assign_filtration(st.find({4,5}), 1.99); - std::cout << "Check the simplex_tree is rolled back in case of decreasing filtration values" << std::endl; + std::clog << "Check the simplex_tree is rolled back in case of decreasing filtration values" << std::endl; BOOST_CHECK(st.make_filtration_non_decreasing()); BOOST_CHECK(st == st_copy); @@ -856,7 +856,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) { // By modifying just the simplex {2} // {0,1,2}, {1,2} and {0,2} will be modified - std::cout << "Check the simplex_tree is repaired in case of decreasing filtration values" << std::endl; + std::clog << "Check the simplex_tree is repaired in case of decreasing filtration values" << std::endl; BOOST_CHECK(st.make_filtration_non_decreasing()); BOOST_CHECK(st == st_other); @@ -869,7 +869,7 @@ BOOST_AUTO_TEST_CASE(make_filtration_non_decreasing) { // Other copy simplex tree typeST st_other_copy = st; - std::cout << "Check the simplex_tree is not modified in case of non-decreasing filtration values" << std::endl; + std::clog << "Check the simplex_tree is not modified in case of non-decreasing filtration values" << std::endl; BOOST_CHECK(!st.make_filtration_non_decreasing()); BOOST_CHECK(st == st_other_copy); @@ -896,8 +896,8 @@ typedef boost::mpl::list>> list_of_graph_variants; BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insert_graph, Graph, list_of_graph_variants) { - std::cout << "********************************************************************" << std::endl; - std::cout << "INSERT GRAPH" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "INSERT GRAPH" << std::endl; Graph g(3); // filtration value 0 everywhere @@ -924,18 +924,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_insert_graph, Graph, list_of_graph_va st2.insert_graph(g); BOOST_CHECK(st2.num_simplices() == 6); - std::cout << "st1 is" << std::endl; - std::cout << st1 << std::endl; + std::clog << "st1 is" << std::endl; + std::clog << st1 << std::endl; - std::cout << "st2 is" << std::endl; - std::cout << st2 << std::endl; + std::clog << "st2 is" << std::endl; + std::clog << st2 << std::endl; BOOST_CHECK(st1 == st2); } BOOST_AUTO_TEST_CASE_TEMPLATE(insert_duplicated_vertices, typeST, list_of_tested_variants) { - std::cout << "********************************************************************" << std::endl; - std::cout << "TEST INSERT DUPLICATED VERTICES" << std::endl; + std::clog << "********************************************************************" << std::endl; + std::clog << "TEST INSERT DUPLICATED VERTICES" << std::endl; typeST st; typename typeST::Simplex_handle sh; @@ -943,25 +943,25 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(insert_duplicated_vertices, typeST, list_of_tested std::tie(sh, success) = st.insert_simplex_and_subfaces({1}); BOOST_CHECK(success); BOOST_CHECK(sh != st.null_simplex()); - std::cout << "st.dimension(sh)= " << st.dimension(sh) << std::endl; + std::clog << "st.dimension(sh)= " << st.dimension(sh) << std::endl; BOOST_CHECK(st.dimension(sh) == 0); std::tie(sh, success) = st.insert_simplex_and_subfaces({2, 2}); BOOST_CHECK(success); BOOST_CHECK(sh != st.null_simplex()); - std::cout << "st.dimension(sh)= " << st.dimension(sh) << std::endl; + std::clog << "st.dimension(sh)= " << st.dimension(sh) << std::endl; BOOST_CHECK(st.dimension(sh) == 0); std::tie(sh, success) = st.insert_simplex_and_subfaces({3, 3, 3}); BOOST_CHECK(success); BOOST_CHECK(sh != st.null_simplex()); - std::cout << "st.dimension(sh)= " << st.dimension(sh) << std::endl; + std::clog << "st.dimension(sh)= " << st.dimension(sh) << std::endl; BOOST_CHECK(st.dimension(sh) == 0); std::tie(sh, success) = st.insert_simplex_and_subfaces({4, 4, 4, 4}); BOOST_CHECK(success); BOOST_CHECK(sh != st.null_simplex()); - std::cout << "st.dimension(sh)= " << st.dimension(sh) << std::endl; + std::clog << "st.dimension(sh)= " << st.dimension(sh) << std::endl; BOOST_CHECK(st.dimension(sh) == 0); - std::cout << "dimension =" << st.dimension() << " - num_vertices = " << st.num_vertices() + std::clog << "dimension =" << st.dimension() << " - num_vertices = " << st.num_vertices() << " - num_simplices = " << st.num_simplices() << std::endl; BOOST_CHECK(st.dimension() == 0); BOOST_CHECK(st.num_simplices() == st.num_vertices()); @@ -969,10 +969,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(insert_duplicated_vertices, typeST, list_of_tested std::tie(sh, success) = st.insert_simplex_and_subfaces({2, 1, 1, 2}); BOOST_CHECK(success); BOOST_CHECK(sh != st.null_simplex()); - std::cout << "st.dimension(sh)= " << st.dimension(sh) << std::endl; + std::clog << "st.dimension(sh)= " << st.dimension(sh) << std::endl; BOOST_CHECK(st.dimension(sh) == 1); - std::cout << "dimension =" << st.dimension() << " - num_vertices = " << st.num_vertices() + std::clog << "dimension =" << st.dimension() << " - num_vertices = " << st.num_vertices() << " - num_simplices = " << st.num_simplices() << std::endl; BOOST_CHECK(st.dimension() == 1); BOOST_CHECK(st.num_simplices() == st.num_vertices() + 1); @@ -982,7 +982,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(insert_duplicated_vertices, typeST, list_of_tested BOOST_CHECK(!success); BOOST_CHECK(sh == st.null_simplex()); - std::cout << "dimension =" << st.dimension() << " - num_vertices = " << st.num_vertices() + std::clog << "dimension =" << st.dimension() << " - num_vertices = " << st.num_vertices() << " - num_simplices = " << st.num_simplices() << std::endl; BOOST_CHECK(st.dimension() == 1); BOOST_CHECK(st.num_simplices() == st.num_vertices() + 1); -- cgit v1.2.3