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_example_from_points.cpp | 12 +++++----- .../example/cech_complex_step_by_step.cpp | 28 +++++++++++----------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/Cech_complex/example') diff --git a/src/Cech_complex/example/cech_complex_example_from_points.cpp b/src/Cech_complex/example/cech_complex_example_from_points.cpp index 3cc5a4df..1a1f708c 100644 --- a/src/Cech_complex/example/cech_complex_example_from_points.cpp +++ b/src/Cech_complex/example/cech_complex_example_from_points.cpp @@ -37,18 +37,18 @@ int main() { // ---------------------------------------------------------------------------- // Display information about the one skeleton Cech complex // ---------------------------------------------------------------------------- - std::cout << "Cech complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " + std::clog << "Cech complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() << " simplices - " << stree.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on Cech complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : stree.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : stree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " + std::clog << ") -> " << "[" << stree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << std::endl; } return 0; } diff --git a/src/Cech_complex/example/cech_complex_step_by_step.cpp b/src/Cech_complex/example/cech_complex_step_by_step.cpp index b3d05697..f59f0293 100644 --- a/src/Cech_complex/example/cech_complex_step_by_step.cpp +++ b/src/Cech_complex/example/cech_complex_step_by_step.cpp @@ -51,12 +51,12 @@ class Cech_blocker { for (auto vertex : simplex_tree_.simplex_vertex_range(sh)) { points.push_back(point_cloud_[vertex]); #ifdef DEBUG_TRACES - std::cout << "#(" << vertex << ")#"; + std::clog << "#(" << vertex << ")#"; #endif // DEBUG_TRACES } Filtration_value radius = Gudhi::Minimal_enclosing_ball_radius()(points); #ifdef DEBUG_TRACES - std::cout << "radius = " << radius << " - " << (radius > max_radius_) << std::endl; + std::clog << "radius = " << radius << " - " << (radius > max_radius_) << std::endl; #endif // DEBUG_TRACES simplex_tree_.assign_filtration(sh, radius); return (radius > max_radius_); @@ -96,23 +96,23 @@ int main(int argc, char* argv[]) { // expand the graph until dimension dim_max st.expansion_with_blockers(dim_max, Cech_blocker(st, max_radius, 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::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 << "********************************************************************\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 @@ -144,11 +144,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); } } -- cgit v1.2.3