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 --- .../benchmark/Alpha_complex_3d_benchmark.cpp | 50 +++++++-------- .../example/Alpha_complex_3d_from_points.cpp | 12 ++-- .../example/Alpha_complex_from_off.cpp | 2 +- .../example/Alpha_complex_from_points.cpp | 12 ++-- .../example/Fast_alpha_complex_from_off.cpp | 2 +- .../Weighted_alpha_complex_3d_from_points.cpp | 12 ++-- src/Alpha_complex/include/gudhi/Alpha_complex.h | 32 +++++----- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 24 +++---- .../test/Alpha_complex_3d_unit_test.cpp | 34 +++++----- src/Alpha_complex/test/Alpha_complex_unit_test.cpp | 74 +++++++++++----------- .../test/Periodic_alpha_complex_3d_unit_test.cpp | 16 ++--- .../test/Weighted_alpha_complex_3d_unit_test.cpp | 20 +++--- ...eighted_periodic_alpha_complex_3d_unit_test.cpp | 20 +++--- .../utilities/alpha_complex_3d_persistence.cpp | 28 ++++---- .../utilities/alpha_complex_persistence.cpp | 30 ++++----- 15 files changed, 184 insertions(+), 184 deletions(-) (limited to 'src/Alpha_complex') diff --git a/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp b/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp index 99ad94b9..e7d85686 100644 --- a/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp +++ b/src/Alpha_complex/benchmark/Alpha_complex_3d_benchmark.cpp @@ -19,7 +19,7 @@ std::ofstream results_csv("results.csv"); template void benchmark_points_on_torus_dD(const std::string& msg) { - std::cout << "+ " << msg << std::endl; + std::clog << "+ " << msg << std::endl; results_csv << "\"" << msg << "\";" << std::endl; results_csv << "\"nb_points\";" @@ -29,7 +29,7 @@ void benchmark_points_on_torus_dD(const std::string& msg) { using K = CGAL::Epick_d>; for (int nb_points = 1000; nb_points <= 125000; nb_points *= 5) { - std::cout << " Alpha complex dD on torus with " << nb_points << " points." << std::endl; + std::clog << " Alpha complex dD on torus with " << nb_points << " points." << std::endl; std::vector points_on_torus = Gudhi::generate_points_on_torus_3D(nb_points, 1.0, 0.5); std::vector points; @@ -41,26 +41,26 @@ void benchmark_points_on_torus_dD(const std::string& msg) { ac_create_clock.begin(); Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); ac_create_clock.end(); - std::cout << ac_create_clock; + std::clog << ac_create_clock; Gudhi::Simplex_tree<> complex; Gudhi::Clock st_create_clock(" benchmark_points_on_torus_dD - complex creation"); st_create_clock.begin(); alpha_complex_from_points.create_complex(complex); st_create_clock.end(); - std::cout << st_create_clock; + std::clog << st_create_clock; results_csv << nb_points << ";" << complex.num_simplices() << ";" << ac_create_clock.num_seconds() << ";" << st_create_clock.num_seconds() << ";" << std::endl; - std::cout << " benchmark_points_on_torus_dD - nb simplices = " << complex.num_simplices() << std::endl; + std::clog << " benchmark_points_on_torus_dD - nb simplices = " << complex.num_simplices() << std::endl; } } template void benchmark_points_on_torus_3D(const std::string& msg) { using K = CGAL::Epick_d>; - std::cout << "+ " << msg << std::endl; + std::clog << "+ " << msg << std::endl; results_csv << "\"" << msg << "\";" << std::endl; results_csv << "\"nb_points\";" @@ -69,7 +69,7 @@ void benchmark_points_on_torus_3D(const std::string& msg) { << "\"complex_creation_time(sec.)\";" << std::endl; for (int nb_points = 1000; nb_points <= 125000; nb_points *= 5) { - std::cout << " Alpha complex 3d on torus with " << nb_points << " points." << std::endl; + std::clog << " Alpha complex 3d on torus with " << nb_points << " points." << std::endl; std::vector points_on_torus = Gudhi::generate_points_on_torus_3D(nb_points, 1.0, 0.5); std::vector points; @@ -81,19 +81,19 @@ void benchmark_points_on_torus_3D(const std::string& msg) { ac_create_clock.begin(); Alpha_complex_3d alpha_complex_from_points(points); ac_create_clock.end(); - std::cout << ac_create_clock; + std::clog << ac_create_clock; Gudhi::Simplex_tree<> complex; Gudhi::Clock st_create_clock(" benchmark_points_on_torus_3D - complex creation"); st_create_clock.begin(); alpha_complex_from_points.create_complex(complex); st_create_clock.end(); - std::cout << st_create_clock; + std::clog << st_create_clock; results_csv << nb_points << ";" << complex.num_simplices() << ";" << ac_create_clock.num_seconds() << ";" << st_create_clock.num_seconds() << ";" << std::endl; - std::cout << " benchmark_points_on_torus_3D - nb simplices = " << complex.num_simplices() << std::endl; + std::clog << " benchmark_points_on_torus_3D - nb simplices = " << complex.num_simplices() << std::endl; } } @@ -101,7 +101,7 @@ template void benchmark_weighted_points_on_torus_3D(const std::string& msg) { using K = CGAL::Epick_d>; - std::cout << "+ " << msg << std::endl; + std::clog << "+ " << msg << std::endl; results_csv << "\"" << msg << "\";" << std::endl; results_csv << "\"nb_points\";" @@ -112,7 +112,7 @@ void benchmark_weighted_points_on_torus_3D(const std::string& msg) { CGAL::Random random(8); for (int nb_points = 1000; nb_points <= 125000; nb_points *= 5) { - std::cout << " Alpha complex 3d on torus with " << nb_points << " points." << std::endl; + std::clog << " Alpha complex 3d on torus with " << nb_points << " points." << std::endl; std::vector points_on_torus = Gudhi::generate_points_on_torus_3D(nb_points, 1.0, 0.5); using Point = typename Weighted_alpha_complex_3d::Bare_point_3; @@ -128,25 +128,25 @@ void benchmark_weighted_points_on_torus_3D(const std::string& msg) { ac_create_clock.begin(); Weighted_alpha_complex_3d alpha_complex_from_points(points); ac_create_clock.end(); - std::cout << ac_create_clock; + std::clog << ac_create_clock; Gudhi::Simplex_tree<> complex; Gudhi::Clock st_create_clock(" benchmark_weighted_points_on_torus_3D - complex creation"); st_create_clock.begin(); alpha_complex_from_points.create_complex(complex); st_create_clock.end(); - std::cout << st_create_clock; + std::clog << st_create_clock; results_csv << nb_points << ";" << complex.num_simplices() << ";" << ac_create_clock.num_seconds() << ";" << st_create_clock.num_seconds() << ";" << std::endl; - std::cout << " benchmark_weighted_points_on_torus_3D - nb simplices = " << complex.num_simplices() << std::endl; + std::clog << " benchmark_weighted_points_on_torus_3D - nb simplices = " << complex.num_simplices() << std::endl; } } template void benchmark_periodic_points(const std::string& msg) { - std::cout << "+ " << msg << std::endl; + std::clog << "+ " << msg << std::endl; results_csv << "\"" << msg << "\";" << std::endl; results_csv << "\"nb_points\";" @@ -157,7 +157,7 @@ void benchmark_periodic_points(const std::string& msg) { CGAL::Random random(8); for (double nb_points = 10.; nb_points <= 40.; nb_points += 10.) { - std::cout << " Periodic alpha complex 3d with " << nb_points * nb_points * nb_points << " points." << std::endl; + std::clog << " Periodic alpha complex 3d with " << nb_points * nb_points * nb_points << " points." << std::endl; using Point = typename Periodic_alpha_complex_3d::Point_3; std::vector points; @@ -174,25 +174,25 @@ void benchmark_periodic_points(const std::string& msg) { ac_create_clock.begin(); Periodic_alpha_complex_3d alpha_complex_from_points(points, 0., 0., 0., nb_points, nb_points, nb_points); ac_create_clock.end(); - std::cout << ac_create_clock; + std::clog << ac_create_clock; Gudhi::Simplex_tree<> complex; Gudhi::Clock st_create_clock(" benchmark_periodic_points - complex creation"); st_create_clock.begin(); alpha_complex_from_points.create_complex(complex); st_create_clock.end(); - std::cout << st_create_clock; + std::clog << st_create_clock; results_csv << nb_points * nb_points * nb_points << ";" << complex.num_simplices() << ";" << ac_create_clock.num_seconds() << ";" << st_create_clock.num_seconds() << ";" << std::endl; - std::cout << " benchmark_periodic_points - nb simplices = " << complex.num_simplices() << std::endl; + std::clog << " benchmark_periodic_points - nb simplices = " << complex.num_simplices() << std::endl; } } template void benchmark_weighted_periodic_points(const std::string& msg) { - std::cout << "+ " << msg << std::endl; + std::clog << "+ " << msg << std::endl; results_csv << "\"" << msg << "\";" << std::endl; results_csv << "\"nb_points\";" @@ -203,7 +203,7 @@ void benchmark_weighted_periodic_points(const std::string& msg) { CGAL::Random random(8); for (double nb_points = 10.; nb_points <= 40.; nb_points += 10.) { - std::cout << " Weighted periodic alpha complex 3d with " << nb_points * nb_points * nb_points << " points." + std::clog << " Weighted periodic alpha complex 3d with " << nb_points * nb_points * nb_points << " points." << std::endl; using Point = typename Weighted_periodic_alpha_complex_3d::Bare_point_3; @@ -224,19 +224,19 @@ void benchmark_weighted_periodic_points(const std::string& msg) { ac_create_clock.begin(); Weighted_periodic_alpha_complex_3d alpha_complex_from_points(points, 0., 0., 0., nb_points, nb_points, nb_points); ac_create_clock.end(); - std::cout << ac_create_clock; + std::clog << ac_create_clock; Gudhi::Simplex_tree<> complex; Gudhi::Clock st_create_clock(" benchmark_weighted_periodic_points - complex creation"); st_create_clock.begin(); alpha_complex_from_points.create_complex(complex); st_create_clock.end(); - std::cout << st_create_clock; + std::clog << st_create_clock; results_csv << nb_points * nb_points * nb_points << ";" << complex.num_simplices() << ";" << ac_create_clock.num_seconds() << ";" << st_create_clock.num_seconds() << ";" << std::endl; - std::cout << " benchmark_weighted_periodic_points - nb simplices = " << complex.num_simplices() << std::endl; + std::clog << " benchmark_weighted_periodic_points - nb simplices = " << complex.num_simplices() << std::endl; } } diff --git a/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp index 0e359a27..a2c85138 100644 --- a/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Alpha_complex_3d_from_points.cpp @@ -38,18 +38,18 @@ int main(int argc, char **argv) { // ---------------------------------------------------------------------------- // Display information about the alpha complex // ---------------------------------------------------------------------------- - std::cout << "Alpha complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() + std::clog << "Alpha complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() << " simplices - " << simplex.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : simplex.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : simplex.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " + std::clog << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << std::endl; } } return 0; diff --git a/src/Alpha_complex/example/Alpha_complex_from_off.cpp b/src/Alpha_complex/example/Alpha_complex_from_off.cpp index 220a66de..dba1710e 100644 --- a/src/Alpha_complex/example/Alpha_complex_from_off.cpp +++ b/src/Alpha_complex/example/Alpha_complex_from_off.cpp @@ -30,7 +30,7 @@ int main(int argc, char **argv) { ouput_file_stream.open(std::string(argv[3])); streambuffer = ouput_file_stream.rdbuf(); } else { - streambuffer = std::cout.rdbuf(); + streambuffer = std::clog.rdbuf(); } Gudhi::Simplex_tree<> simplex; diff --git a/src/Alpha_complex/example/Alpha_complex_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_from_points.cpp index 6526ca3a..c79535bf 100644 --- a/src/Alpha_complex/example/Alpha_complex_from_points.cpp +++ b/src/Alpha_complex/example/Alpha_complex_from_points.cpp @@ -35,18 +35,18 @@ int main() { // ---------------------------------------------------------------------------- // Display information about the alpha complex // ---------------------------------------------------------------------------- - std::cout << "Alpha complex is of dimension " << simplex.dimension() << + std::clog << "Alpha complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() << " simplices - " << simplex.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : simplex.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : simplex.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; + std::clog << std::endl; } } return 0; diff --git a/src/Alpha_complex/example/Fast_alpha_complex_from_off.cpp b/src/Alpha_complex/example/Fast_alpha_complex_from_off.cpp index f181005a..64728470 100644 --- a/src/Alpha_complex/example/Fast_alpha_complex_from_off.cpp +++ b/src/Alpha_complex/example/Fast_alpha_complex_from_off.cpp @@ -35,7 +35,7 @@ int main(int argc, char **argv) { ouput_file_stream.open(std::string(argv[3])); streambuffer = ouput_file_stream.rdbuf(); } else { - streambuffer = std::cout.rdbuf(); + streambuffer = std::clog.rdbuf(); } Gudhi::Simplex_tree<> simplex; diff --git a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp index fcf80802..c044194e 100644 --- a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp +++ b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp @@ -34,18 +34,18 @@ int main(int argc, char **argv) { // ---------------------------------------------------------------------------- // Display information about the alpha complex // ---------------------------------------------------------------------------- - std::cout << "Alpha complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() + std::clog << "Alpha complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() << " simplices - " << simplex.num_vertices() << " vertices." << std::endl; - std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; for (auto f_simplex : simplex.filtration_simplex_range()) { - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : simplex.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " + std::clog << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << std::endl; } } return 0; diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex.h b/src/Alpha_complex/include/gudhi/Alpha_complex.h index f2a05e95..0839ae6c 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex.h @@ -237,7 +237,7 @@ class Alpha_complex { for (CGAL_vertex_iterator vit = triangulation_->vertices_begin(); vit != triangulation_->vertices_end(); ++vit) { if (!triangulation_->is_infinite(*vit)) { #ifdef DEBUG_TRACES - std::cout << "Vertex insertion - " << vit->data() << " -> " << vit->point() << std::endl; + std::clog << "Vertex insertion - " << vit->data() << " -> " << vit->point() << std::endl; #endif // DEBUG_TRACES vertex_handle_to_iterator_[vit->data()] = vit; } @@ -296,19 +296,19 @@ class Alpha_complex { ++cit) { Vector_vertex vertexVector; #ifdef DEBUG_TRACES - std::cout << "Simplex_tree insertion "; + std::clog << "Simplex_tree insertion "; #endif // DEBUG_TRACES for (auto vit = cit->vertices_begin(); vit != cit->vertices_end(); ++vit) { if (*vit != nullptr) { #ifdef DEBUG_TRACES - std::cout << " " << (*vit)->data(); + std::clog << " " << (*vit)->data(); #endif // DEBUG_TRACES // Vector of vertex construction for simplex_tree structure vertexVector.push_back((*vit)->data()); } } #ifdef DEBUG_TRACES - std::cout << std::endl; + std::clog << std::endl; #endif // DEBUG_TRACES // Insert each simplex and its subfaces in the simplex tree - filtration is NaN complex.insert_simplex_and_subfaces(vertexVector, std::numeric_limits::quiet_NaN()); @@ -327,16 +327,16 @@ class Alpha_complex { if (decr_dim == f_simplex_dim) { pointVector.clear(); #ifdef DEBUG_TRACES - std::cout << "Sigma of dim " << decr_dim << " is"; + std::clog << "Sigma of dim " << decr_dim << " is"; #endif // DEBUG_TRACES for (auto vertex : complex.simplex_vertex_range(f_simplex)) { pointVector.push_back(get_point(vertex)); #ifdef DEBUG_TRACES - std::cout << " " << vertex; + std::clog << " " << vertex; #endif // DEBUG_TRACES } #ifdef DEBUG_TRACES - std::cout << std::endl; + std::clog << std::endl; #endif // DEBUG_TRACES // ### If filt(Sigma) is NaN : filt(Sigma) = alpha(Sigma) if (std::isnan(complex.filtration(f_simplex))) { @@ -355,7 +355,7 @@ class Alpha_complex { } complex.assign_filtration(f_simplex, alpha_complex_filtration); #ifdef DEBUG_TRACES - std::cout << "filt(Sigma) is NaN : filt(Sigma) =" << complex.filtration(f_simplex) << std::endl; + std::clog << "filt(Sigma) is NaN : filt(Sigma) =" << complex.filtration(f_simplex) << std::endl; #endif // DEBUG_TRACES } // No need to propagate further, unweighted points all have value 0 @@ -387,13 +387,13 @@ class Alpha_complex { // ### Foreach Tau face of Sigma for (auto f_boundary : complex.boundary_simplex_range(f_simplex)) { #ifdef DEBUG_TRACES - std::cout << " | --------------------------------------------------\n"; - std::cout << " | Tau "; + std::clog << " | --------------------------------------------------\n"; + std::clog << " | Tau "; for (auto vertex : complex.simplex_vertex_range(f_boundary)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << "is a face of Sigma\n"; - std::cout << " | isnan(complex.filtration(Tau)=" << std::isnan(complex.filtration(f_boundary)) << std::endl; + std::clog << "is a face of Sigma\n"; + std::clog << " | isnan(complex.filtration(Tau)=" << std::isnan(complex.filtration(f_boundary)) << std::endl; #endif // DEBUG_TRACES // ### If filt(Tau) is not NaN if (!std::isnan(complex.filtration(f_boundary))) { @@ -402,7 +402,7 @@ class Alpha_complex { complex.filtration(f_simplex)); complex.assign_filtration(f_boundary, alpha_complex_filtration); #ifdef DEBUG_TRACES - std::cout << " | filt(Tau) = fmin(filt(Tau), filt(Sigma)) = " << complex.filtration(f_boundary) << std::endl; + std::clog << " | filt(Tau) = fmin(filt(Tau), filt(Sigma)) = " << complex.filtration(f_boundary) << std::endl; #endif // DEBUG_TRACES // ### Else } else { @@ -432,7 +432,7 @@ class Alpha_complex { bool is_gab = is_gabriel(pointVector.begin(), pointVector.end(), point_for_gabriel) != CGAL::ON_BOUNDED_SIDE; #ifdef DEBUG_TRACES - std::cout << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl; + std::clog << " | Tau is_gabriel(Sigma)=" << is_gab << " - vertexForGabriel=" << vertexForGabriel << std::endl; #endif // DEBUG_TRACES // ### If Tau is not Gabriel of Sigma if (false == is_gab) { @@ -440,7 +440,7 @@ class Alpha_complex { Filtration_value alpha_complex_filtration = complex.filtration(f_simplex); complex.assign_filtration(f_boundary, alpha_complex_filtration); #ifdef DEBUG_TRACES - std::cout << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl; + std::clog << " | filt(Tau) = filt(Sigma) = " << complex.filtration(f_boundary) << std::endl; #endif // DEBUG_TRACES } } diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 7f96c94c..c40beba0 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -472,7 +472,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ alpha_shape_3_ptr_->filtration_with_alpha_values(dispatcher); #ifdef DEBUG_TRACES - std::cout << "filtration_with_alpha_values returns : " << objects.size() << " objects" << std::endl; + std::clog << "filtration_with_alpha_values returns : " << objects.size() << " objects" << std::endl; #endif // DEBUG_TRACES using Alpha_value_iterator = typename std::vector::const_iterator; @@ -484,7 +484,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ if (const Cell_handle* cell = CGAL::object_cast(&object_iterator)) { for (auto i = 0; i < 4; i++) { #ifdef DEBUG_TRACES - std::cout << "from cell[" << i << "] - Point coordinates (" << (*cell)->vertex(i)->point() << ")" + std::clog << "from cell[" << i << "] - Point coordinates (" << (*cell)->vertex(i)->point() << ")" << std::endl; #endif // DEBUG_TRACES vertex_list.push_back((*cell)->vertex(i)); @@ -496,7 +496,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ for (auto i = 0; i < 4; i++) { if ((*facet).second != i) { #ifdef DEBUG_TRACES - std::cout << "from facet=[" << i << "] - Point coordinates (" << (*facet).first->vertex(i)->point() << ")" + std::clog << "from facet=[" << i << "] - Point coordinates (" << (*facet).first->vertex(i)->point() << ")" << std::endl; #endif // DEBUG_TRACES vertex_list.push_back((*facet).first->vertex(i)); @@ -508,7 +508,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ } else if (const Edge* edge = CGAL::object_cast(&object_iterator)) { for (auto i : {(*edge).second, (*edge).third}) { #ifdef DEBUG_TRACES - std::cout << "from edge[" << i << "] - Point coordinates (" << (*edge).first->vertex(i)->point() << ")" + std::clog << "from edge[" << i << "] - Point coordinates (" << (*edge).first->vertex(i)->point() << ")" << std::endl; #endif // DEBUG_TRACES vertex_list.push_back((*edge).first->vertex(i)); @@ -519,7 +519,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ } else if (const Alpha_vertex_handle* vertex = CGAL::object_cast(&object_iterator)) { #ifdef DEBUG_TRACES count_vertices++; - std::cout << "from vertex - Point coordinates (" << (*vertex)->point() << ")" << std::endl; + std::clog << "from vertex - Point coordinates (" << (*vertex)->point() << ")" << std::endl; #endif // DEBUG_TRACES vertex_list.push_back((*vertex)); } @@ -531,7 +531,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ // alpha shape not found Complex_vertex_handle vertex = map_cgal_simplex_tree.size(); #ifdef DEBUG_TRACES - std::cout << "Point (" << the_alpha_shape_vertex->point() << ") not found - insert new vertex id " << vertex + std::clog << "Point (" << the_alpha_shape_vertex->point() << ") not found - insert new vertex id " << vertex << std::endl; #endif // DEBUG_TRACES the_simplex.push_back(vertex); @@ -540,7 +540,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ // alpha shape found Complex_vertex_handle vertex = the_map_iterator->second; #ifdef DEBUG_TRACES - std::cout << "Point (" << the_alpha_shape_vertex->point() << ") found as vertex id " << vertex << std::endl; + std::clog << "Point (" << the_alpha_shape_vertex->point() << ") found as vertex id " << vertex << std::endl; #endif // DEBUG_TRACES the_simplex.push_back(vertex); } @@ -549,7 +549,7 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ Filtration_value filtr = Value_from_iterator::perform(alpha_value_iterator); #ifdef DEBUG_TRACES - std::cout << "filtration = " << filtr << std::endl; + std::clog << "filtration = " << filtr << std::endl; #endif // DEBUG_TRACES complex.insert_simplex(the_simplex, static_cast(filtr)); GUDHI_CHECK(alpha_value_iterator != alpha_values.end(), "CGAL provided more simplices than values"); @@ -557,10 +557,10 @@ Weighted_alpha_complex_3d::Weighted_point_3 wp0(Weighted_alpha_complex_3d::Bare_ } #ifdef DEBUG_TRACES - std::cout << "vertices \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" << 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; #endif // DEBUG_TRACES // -------------------------------------------------------------------------------------------- // As Alpha value is an approximation, we have to make filtration non decreasing while increasing the dimension diff --git a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp index cd698a27..a4ecb6ad 100644 --- a/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_complex_3d_unit_test.cpp @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- // Fast version // ----------------- - std::cout << "Fast alpha complex 3d" << std::endl; + std::clog << "Fast alpha complex 3d" << std::endl; std::vector points = get_points(); Fast_alpha_complex_3d alpha_complex(points); @@ -79,7 +79,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- // Exact version // ----------------- - std::cout << "Exact alpha complex 3d" << std::endl; + std::clog << "Exact alpha complex 3d" << std::endl; std::vector exact_points = get_points(); Exact_alpha_complex_3d exact_alpha_complex(exact_points); @@ -105,13 +105,13 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // --------------------- // Compare both versions // --------------------- - std::cout << "Exact Alpha complex 3d is of dimension " << exact_stree.dimension() << " - Fast is " + std::clog << "Exact Alpha complex 3d is of dimension " << exact_stree.dimension() << " - Fast is " << stree.dimension() << std::endl; BOOST_CHECK(exact_stree.dimension() == stree.dimension()); - std::cout << "Exact Alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Fast is " + std::clog << "Exact Alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Fast is " << stree.num_simplices() << std::endl; BOOST_CHECK(exact_stree.num_simplices() == stree.num_simplices()); - std::cout << "Exact Alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Fast is " + std::clog << "Exact Alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Fast is " << stree.num_vertices() << std::endl; BOOST_CHECK(exact_stree.num_vertices() == stree.num_vertices()); @@ -119,18 +119,18 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { while (sh != stree.filtration_simplex_range().end()) { std::vector simplex; std::vector exact_simplex; - std::cout << "Fast ( "; + std::clog << "Fast ( "; for (auto vertex : stree.simplex_vertex_range(*sh)) { simplex.push_back(vertex); - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> [" << stree.filtration(*sh) << "] "; + std::clog << ") -> [" << stree.filtration(*sh) << "] "; // Find it in the exact structure auto sh_exact = exact_stree.find(simplex); BOOST_CHECK(sh_exact != exact_stree.null_simplex()); - std::cout << " versus [" << exact_stree.filtration(sh_exact) << "] " << std::endl; + std::clog << " versus [" << exact_stree.filtration(sh_exact) << "] " << std::endl; // Exact and non-exact version is not exactly the same due to float comparison GUDHI_TEST_FLOAT_EQUALITY_CHECK(exact_stree.filtration(sh_exact), stree.filtration(*sh)); @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // ----------------- // Safe version // ----------------- - std::cout << "Safe alpha complex 3d" << std::endl; + std::clog << "Safe alpha complex 3d" << std::endl; std::vector safe_points = get_points(); Safe_alpha_complex_3d safe_alpha_complex(safe_points); @@ -165,13 +165,13 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { // --------------------- // Compare both versions // --------------------- - std::cout << "Safe Alpha complex 3d is of dimension " << safe_stree.dimension() << " - Fast is " + std::clog << "Safe Alpha complex 3d is of dimension " << safe_stree.dimension() << " - Fast is " << stree.dimension() << std::endl; BOOST_CHECK(safe_stree.dimension() == stree.dimension()); - std::cout << "Safe Alpha complex 3d num_simplices " << safe_stree.num_simplices() << " - Fast is " + std::clog << "Safe Alpha complex 3d num_simplices " << safe_stree.num_simplices() << " - Fast is " << stree.num_simplices() << std::endl; BOOST_CHECK(safe_stree.num_simplices() == stree.num_simplices()); - std::cout << "Safe Alpha complex 3d num_vertices " << safe_stree.num_vertices() << " - Fast is " + std::clog << "Safe Alpha complex 3d num_vertices " << safe_stree.num_vertices() << " - Fast is " << stree.num_vertices() << std::endl; BOOST_CHECK(safe_stree.num_vertices() == stree.num_vertices()); @@ -179,18 +179,18 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_3d_from_points) { while (safe_sh != stree.filtration_simplex_range().end()) { std::vector simplex; std::vector exact_simplex; - std::cout << "Fast ( "; + std::clog << "Fast ( "; for (auto vertex : stree.simplex_vertex_range(*safe_sh)) { simplex.push_back(vertex); - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> [" << stree.filtration(*safe_sh) << "] "; + std::clog << ") -> [" << stree.filtration(*safe_sh) << "] "; // Find it in the exact structure auto sh_exact = safe_stree.find(simplex); BOOST_CHECK(sh_exact != safe_stree.null_simplex()); - std::cout << " versus [" << safe_stree.filtration(sh_exact) << "] " << std::endl; + std::clog << " versus [" << safe_stree.filtration(sh_exact) << "] " << std::endl; // Exact and non-exact version is not exactly the same due to float comparison GUDHI_TEST_FLOAT_EQUALITY_CHECK(safe_stree.filtration(sh_exact), stree.filtration(*safe_sh), 1e-15); diff --git a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp index 27b671dd..da1d8004 100644 --- a/src/Alpha_complex/test/Alpha_complex_unit_test.cpp +++ b/src/Alpha_complex/test/Alpha_complex_unit_test.cpp @@ -48,7 +48,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_from_OFF_file, TestedKernel, list_of // ---------------------------------------------------------------------------- std::string off_file_name("alphacomplexdoc.off"); double max_alpha_square_value = 60.0; - std::cout << "========== OFF FILE NAME = " << off_file_name << " - alpha²=" << + std::clog << "========== OFF FILE NAME = " << off_file_name << " - alpha²=" << max_alpha_square_value << "==========" << std::endl; Gudhi::alpha_complex::Alpha_complex alpha_complex_from_file(off_file_name); @@ -56,29 +56,29 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_from_OFF_file, TestedKernel, list_of Gudhi::Simplex_tree<> simplex_tree_60; BOOST_CHECK(alpha_complex_from_file.create_complex(simplex_tree_60, max_alpha_square_value)); - std::cout << "simplex_tree_60.dimension()=" << simplex_tree_60.dimension() << std::endl; + std::clog << "simplex_tree_60.dimension()=" << simplex_tree_60.dimension() << std::endl; BOOST_CHECK(simplex_tree_60.dimension() == 2); - std::cout << "simplex_tree_60.num_vertices()=" << simplex_tree_60.num_vertices() << std::endl; + std::clog << "simplex_tree_60.num_vertices()=" << simplex_tree_60.num_vertices() << std::endl; BOOST_CHECK(simplex_tree_60.num_vertices() == 7); - std::cout << "simplex_tree_60.num_simplices()=" << simplex_tree_60.num_simplices() << std::endl; + std::clog << "simplex_tree_60.num_simplices()=" << simplex_tree_60.num_simplices() << std::endl; BOOST_CHECK(simplex_tree_60.num_simplices() == 25); max_alpha_square_value = 59.0; - std::cout << "========== OFF FILE NAME = " << off_file_name << " - alpha²=" << + std::clog << "========== OFF FILE NAME = " << off_file_name << " - alpha²=" << max_alpha_square_value << "==========" << std::endl; Gudhi::Simplex_tree<> simplex_tree_59; BOOST_CHECK(alpha_complex_from_file.create_complex(simplex_tree_59, max_alpha_square_value)); - std::cout << "simplex_tree_59.dimension()=" << simplex_tree_59.dimension() << std::endl; + std::clog << "simplex_tree_59.dimension()=" << simplex_tree_59.dimension() << std::endl; BOOST_CHECK(simplex_tree_59.dimension() == 2); - std::cout << "simplex_tree_59.num_vertices()=" << simplex_tree_59.num_vertices() << std::endl; + std::clog << "simplex_tree_59.num_vertices()=" << simplex_tree_59.num_vertices() << std::endl; BOOST_CHECK(simplex_tree_59.num_vertices() == 7); - std::cout << "simplex_tree_59.num_simplices()=" << simplex_tree_59.num_simplices() << std::endl; + std::clog << "simplex_tree_59.num_simplices()=" << simplex_tree_59.num_simplices() << std::endl; BOOST_CHECK(simplex_tree_59.num_simplices() == 23); } @@ -115,30 +115,30 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) { // ---------------------------------------------------------------------------- Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); - std::cout << "========== Alpha_complex_from_points ==========" << std::endl; + std::clog << "========== Alpha_complex_from_points ==========" << std::endl; Gudhi::Simplex_tree<> simplex_tree; BOOST_CHECK(alpha_complex_from_points.create_complex(simplex_tree)); // Another way to check num_simplices - std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; int num_simplices = 0; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { num_simplices++; - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << simplex_tree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << std::endl; } BOOST_CHECK(num_simplices == 15); - std::cout << "simplex_tree.num_simplices()=" << simplex_tree.num_simplices() << std::endl; + std::clog << "simplex_tree.num_simplices()=" << simplex_tree.num_simplices() << std::endl; BOOST_CHECK(simplex_tree.num_simplices() == 15); - std::cout << "simplex_tree.dimension()=" << simplex_tree.dimension() << std::endl; + std::clog << "simplex_tree.dimension()=" << simplex_tree.dimension() << std::endl; BOOST_CHECK(simplex_tree.dimension() == 3); - std::cout << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; + std::clog << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; BOOST_CHECK(simplex_tree.num_vertices() == points.size()); for (auto f_simplex : simplex_tree.filtration_simplex_range()) { @@ -162,22 +162,22 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) { } Point_4 p0 = alpha_complex_from_points.get_point(0); - std::cout << "alpha_complex_from_points.get_point(0)=" << p0 << std::endl; + std::clog << "alpha_complex_from_points.get_point(0)=" << p0 << std::endl; BOOST_CHECK(4 == p0.dimension()); BOOST_CHECK(is_point_in_list(points, p0)); Point_4 p1 = alpha_complex_from_points.get_point(1); - std::cout << "alpha_complex_from_points.get_point(1)=" << p1 << std::endl; + std::clog << "alpha_complex_from_points.get_point(1)=" << p1 << std::endl; BOOST_CHECK(4 == p1.dimension()); BOOST_CHECK(is_point_in_list(points, p1)); Point_4 p2 = alpha_complex_from_points.get_point(2); - std::cout << "alpha_complex_from_points.get_point(2)=" << p2 << std::endl; + std::clog << "alpha_complex_from_points.get_point(2)=" << p2 << std::endl; BOOST_CHECK(4 == p2.dimension()); BOOST_CHECK(is_point_in_list(points, p2)); Point_4 p3 = alpha_complex_from_points.get_point(3); - std::cout << "alpha_complex_from_points.get_point(3)=" << p3 << std::endl; + std::clog << "alpha_complex_from_points.get_point(3)=" << p3 << std::endl; BOOST_CHECK(4 == p3.dimension()); BOOST_CHECK(is_point_in_list(points, p3)); @@ -194,24 +194,24 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) { BOOST_CHECK(modified); // Another way to check num_simplices - std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + std::clog << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; num_simplices = 0; for (auto f_simplex : simplex_tree.filtration_simplex_range()) { num_simplices++; - std::cout << " ( "; + std::clog << " ( "; for (auto vertex : simplex_tree.simplex_vertex_range(f_simplex)) { - std::cout << vertex << " "; + std::clog << vertex << " "; } - std::cout << ") -> " << "[" << simplex_tree.filtration(f_simplex) << "] "; - std::cout << std::endl; + std::clog << ") -> " << "[" << simplex_tree.filtration(f_simplex) << "] "; + std::clog << std::endl; } BOOST_CHECK(num_simplices == 10); - std::cout << "simplex_tree.num_simplices()=" << simplex_tree.num_simplices() << std::endl; + std::clog << "simplex_tree.num_simplices()=" << simplex_tree.num_simplices() << std::endl; BOOST_CHECK(simplex_tree.num_simplices() == 10); - std::cout << "simplex_tree.dimension()=" << simplex_tree.dimension() << std::endl; + std::clog << "simplex_tree.dimension()=" << simplex_tree.dimension() << std::endl; BOOST_CHECK(simplex_tree.dimension() == 1); - std::cout << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; + std::clog << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; BOOST_CHECK(simplex_tree.num_vertices() == 4); for (auto f_simplex : simplex_tree.filtration_simplex_range()) { @@ -231,7 +231,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_from_points) { } BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_from_empty_points, TestedKernel, list_of_kernel_variants) { - std::cout << "========== Alpha_complex_from_empty_points ==========" << std::endl; + std::clog << "========== Alpha_complex_from_empty_points ==========" << std::endl; // ---------------------------------------------------------------------------- // Init of an empty list of points @@ -249,13 +249,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_from_empty_points, TestedKernel, lis Gudhi::Simplex_tree<> simplex_tree; BOOST_CHECK(!alpha_complex_from_points.create_complex(simplex_tree)); - std::cout << "simplex_tree.num_simplices()=" << simplex_tree.num_simplices() << std::endl; + std::clog << "simplex_tree.num_simplices()=" << simplex_tree.num_simplices() << std::endl; BOOST_CHECK(simplex_tree.num_simplices() == 0); - std::cout << "simplex_tree.dimension()=" << simplex_tree.dimension() << std::endl; + std::clog << "simplex_tree.dimension()=" << simplex_tree.dimension() << std::endl; BOOST_CHECK(simplex_tree.dimension() == -1); - std::cout << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; + std::clog << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; BOOST_CHECK(simplex_tree.num_vertices() == points.size()); } @@ -264,7 +264,7 @@ using Exact_kernel_2 = CGAL::Epeck_d< CGAL::Dimension_tag<2> >; using list_of_kernel_2_variants = boost::mpl::list; BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_with_duplicated_points, TestedKernel, list_of_kernel_2_variants) { - std::cout << "========== Alpha_complex_with_duplicated_points ==========" << std::endl; + std::clog << "========== Alpha_complex_with_duplicated_points ==========" << std::endl; using Point = typename TestedKernel::Point_d; using Vector_of_points = std::vector; @@ -287,14 +287,14 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_with_duplicated_points, TestedKernel // ---------------------------------------------------------------------------- // Init of an alpha complex from the list of points // ---------------------------------------------------------------------------- - std::cout << "Init" << std::endl; + std::clog << "Init" << std::endl; Gudhi::alpha_complex::Alpha_complex alpha_complex_from_points(points); Gudhi::Simplex_tree<> simplex_tree; - std::cout << "create_complex" << std::endl; + std::clog << "create_complex" << std::endl; BOOST_CHECK(alpha_complex_from_points.create_complex(simplex_tree)); - std::cout << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() + std::clog << "simplex_tree.num_vertices()=" << simplex_tree.num_vertices() << std::endl; BOOST_CHECK(simplex_tree.num_vertices() < points.size()); } diff --git a/src/Alpha_complex/test/Periodic_alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Periodic_alpha_complex_3d_unit_test.cpp index 731763fa..9eef920b 100644 --- a/src/Alpha_complex/test/Periodic_alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Periodic_alpha_complex_3d_unit_test.cpp @@ -43,14 +43,14 @@ typedef boost::mpl::list p_points; // Not important, this is not what we want to check p_points.push_back(Bare_point_3(0.0, 0.0, 0.0)); - std::cout << "Check exception throw in debug mode" << std::endl; + std::clog << "Check exception throw in debug mode" << std::endl; // Check it throws an exception when the cuboid is not iso BOOST_CHECK_THROW(Periodic_alpha_complex_3d periodic_alpha_complex(p_points, 0., 0., 0., 0.9, 1., 1.), std::invalid_argument); @@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_periodic) { // --------------------- // Fast periodic version // --------------------- - std::cout << "Fast periodic alpha complex 3d" << std::endl; + std::clog << "Fast periodic alpha complex 3d" << std::endl; using Creator = CGAL::Creator_uniform_3; CGAL::Random random(7); @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_periodic) { // ---------------------- // Exact periodic version // ---------------------- - std::cout << "Exact periodic alpha complex 3d" << std::endl; + std::clog << "Exact periodic alpha complex 3d" << std::endl; std::vector e_p_points; @@ -122,13 +122,13 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_periodic) { // --------------------- // Compare both versions // --------------------- - std::cout << "Exact periodic alpha complex 3d is of dimension " << exact_stree.dimension() << " - Non exact is " + std::clog << "Exact periodic alpha complex 3d is of dimension " << exact_stree.dimension() << " - Non exact is " << stree.dimension() << std::endl; BOOST_CHECK(exact_stree.dimension() == stree.dimension()); - std::cout << "Exact periodic alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Non exact is " + std::clog << "Exact periodic alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Non exact is " << stree.num_simplices() << std::endl; BOOST_CHECK(exact_stree.num_simplices() == stree.num_simplices()); - std::cout << "Exact periodic alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Non exact is " + std::clog << "Exact periodic alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Non exact is " << stree.num_vertices() << std::endl; BOOST_CHECK(exact_stree.num_vertices() == stree.num_vertices()); @@ -155,7 +155,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_periodic) { // ---------------------- // Safe periodic version // ---------------------- - std::cout << "Safe periodic alpha complex 3d" << std::endl; + std::clog << "Safe periodic alpha complex 3d" << std::endl; std::vector s_p_points; diff --git a/src/Alpha_complex/test/Weighted_alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Weighted_alpha_complex_3d_unit_test.cpp index 8035f6e8..6b31bea6 100644 --- a/src/Alpha_complex/test/Weighted_alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_alpha_complex_3d_unit_test.cpp @@ -55,13 +55,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_throw, Weighted_alpha_compl // weights size is different from w_points size to make weighted Alpha_complex_3d throw in debug mode std::vector weights = {0.01, 0.005, 0.006, 0.01, 0.009, 0.001}; - std::cout << "Check exception throw in debug mode" << std::endl; + std::clog << "Check exception throw in debug mode" << std::endl; BOOST_CHECK_THROW(Weighted_alpha_complex_3d wac(w_points, weights), std::invalid_argument); } #endif BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted, Weighted_alpha_complex_3d, weighted_variants_type_list) { - std::cout << "Weighted alpha complex 3d from points and weights" << std::endl; + std::clog << "Weighted alpha complex 3d from points and weights" << std::endl; using Bare_point_3 = typename Weighted_alpha_complex_3d::Bare_point_3; std::vector w_points; w_points.push_back(Bare_point_3(0.0, 0.0, 0.0)); @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted, Weighted_alpha_complex_3d, Gudhi::Simplex_tree<> stree; alpha_complex_p_a_w.create_complex(stree); - std::cout << "Weighted alpha complex 3d from weighted points" << std::endl; + std::clog << "Weighted alpha complex 3d from weighted points" << std::endl; using Weighted_point_3 = typename Weighted_alpha_complex_3d::Weighted_point_3; std::vector weighted_points; @@ -112,13 +112,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted, Weighted_alpha_complex_3d, // --------------------- // Compare both versions // --------------------- - std::cout << "Weighted alpha complex 3d is of dimension " << stree_bis.dimension() << " - versus " + std::clog << "Weighted alpha complex 3d is of dimension " << stree_bis.dimension() << " - versus " << stree.dimension() << std::endl; BOOST_CHECK(stree_bis.dimension() == stree.dimension()); - std::cout << "Weighted alpha complex 3d num_simplices " << stree_bis.num_simplices() << " - versus " + std::clog << "Weighted alpha complex 3d num_simplices " << stree_bis.num_simplices() << " - versus " << stree.num_simplices() << std::endl; BOOST_CHECK(stree_bis.num_simplices() == stree.num_simplices()); - std::cout << "Weighted alpha complex 3d num_vertices " << stree_bis.num_vertices() << " - versus " + std::clog << "Weighted alpha complex 3d num_vertices " << stree_bis.num_vertices() << " - versus " << stree.num_vertices() << std::endl; BOOST_CHECK(stree_bis.num_vertices() == stree.num_vertices()); @@ -127,18 +127,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted, Weighted_alpha_complex_3d, std::vector simplex; std::vector exact_simplex; #ifdef DEBUG_TRACES - std::cout << " ( "; + std::clog << " ( "; #endif for (auto vertex : stree.simplex_vertex_range(*sh)) { simplex.push_back(vertex); #ifdef DEBUG_TRACES - std::cout << vertex << " "; + std::clog << vertex << " "; #endif } #ifdef DEBUG_TRACES - std::cout << ") -> " + std::clog << ") -> " << "[" << stree.filtration(*sh) << "] "; - std::cout << std::endl; + std::clog << std::endl; #endif // Find it in the exact structure diff --git a/src/Alpha_complex/test/Weighted_periodic_alpha_complex_3d_unit_test.cpp b/src/Alpha_complex/test/Weighted_periodic_alpha_complex_3d_unit_test.cpp index b09e92d5..610b9f3d 100644 --- a/src/Alpha_complex/test/Weighted_periodic_alpha_complex_3d_unit_test.cpp +++ b/src/Alpha_complex/test/Weighted_periodic_alpha_complex_3d_unit_test.cpp @@ -45,7 +45,7 @@ typedef boost::mpl::list; CGAL::Random random(7); @@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_pe p_weights.push_back(random.get_double(0., 0.01)); } - std::cout << "Cuboid is not iso exception" << std::endl; + std::clog << "Cuboid is not iso exception" << std::endl; // Check it throws an exception when the cuboid is not iso BOOST_CHECK_THROW( Weighted_periodic_alpha_complex_3d wp_alpha_complex(wp_points, p_weights, -1., -1., -1., 0.9, 1., 1.), @@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_pe Weighted_periodic_alpha_complex_3d wp_alpha_complex(wp_points, p_weights, -1., -1., -1., 1., 1., 1.1), std::invalid_argument); - std::cout << "0 <= point.weight() < 1/64 * domain_size * domain_size exception" << std::endl; + std::clog << "0 <= point.weight() < 1/64 * domain_size * domain_size exception" << std::endl; // Weights must be in range ]0, 1/64 = 0.015625[ double temp = p_weights[25]; p_weights[25] = 1.0; @@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(Alpha_complex_weighted_periodic_throw, Weighted_pe std::invalid_argument); p_weights[14] = temp; - std::cout << "wp_points and p_weights size exception" << std::endl; + std::clog << "wp_points and p_weights size exception" << std::endl; // Weights and points must have the same size // + 1 p_weights.push_back(1e-10); @@ -115,7 +115,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted_periodic) { // --------------------- // Fast weighted periodic version // --------------------- - std::cout << "Fast weighted periodic alpha complex 3d" << std::endl; + std::clog << "Fast weighted periodic alpha complex 3d" << std::endl; using Creator = CGAL::Creator_uniform_3; CGAL::Random random(7); @@ -140,7 +140,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted_periodic) { // ---------------------- // Exact weighted periodic version // ---------------------- - std::cout << "Exact weighted periodic alpha complex 3d" << std::endl; + std::clog << "Exact weighted periodic alpha complex 3d" << std::endl; std::vector e_p_points; @@ -156,13 +156,13 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted_periodic) { // --------------------- // Compare both versions // --------------------- - std::cout << "Exact weighted periodic alpha complex 3d is of dimension " << exact_stree.dimension() + std::clog << "Exact weighted periodic alpha complex 3d is of dimension " << exact_stree.dimension() << " - Non exact is " << stree.dimension() << std::endl; BOOST_CHECK(exact_stree.dimension() == stree.dimension()); - std::cout << "Exact weighted periodic alpha complex 3d num_simplices " << exact_stree.num_simplices() + std::clog << "Exact weighted periodic alpha complex 3d num_simplices " << exact_stree.num_simplices() << " - Non exact is " << stree.num_simplices() << std::endl; BOOST_CHECK(exact_stree.num_simplices() == stree.num_simplices()); - std::cout << "Exact weighted periodic alpha complex 3d num_vertices " << exact_stree.num_vertices() + std::clog << "Exact weighted periodic alpha complex 3d num_vertices " << exact_stree.num_vertices() << " - Non exact is " << stree.num_vertices() << std::endl; BOOST_CHECK(exact_stree.num_vertices() == stree.num_vertices()); @@ -189,7 +189,7 @@ BOOST_AUTO_TEST_CASE(Alpha_complex_weighted_periodic) { // ---------------------- // Safe weighted periodic version // ---------------------- - std::cout << "Safe weighted periodic alpha complex 3d" << std::endl; + std::clog << "Safe weighted periodic alpha complex 3d" << std::endl; std::vector s_p_points; diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp index 929fc2e8..e93c412e 100644 --- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp @@ -225,7 +225,7 @@ int main(int argc, char **argv) { // Sort the simplices in the order of the filtration simplex_tree.initialize_filtration(); - std::cout << "Simplex_tree dim: " << simplex_tree.dimension() << std::endl; + std::clog << "Simplex_tree dim: " << simplex_tree.dimension() << std::endl; // Compute the persistence diagram of the complex Persistent_cohomology pcoh(simplex_tree, true); // initializes the coefficient field for homology @@ -237,7 +237,7 @@ int main(int argc, char **argv) { if (output_file_diag.empty()) { pcoh.output_diagram(); } else { - std::cout << "Result in file: " << output_file_diag << std::endl; + std::clog << "Result in file: " << output_file_diag << std::endl; std::ofstream out(output_file_diag); pcoh.output_diagram(out); out.close(); @@ -266,7 +266,7 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool "cuboid-file,c", po::value(&cuboid_file), "Name of file describing the periodic domain. Format is:\n min_hx min_hy min_hz\n max_hx max_hy max_hz")( "output-file,o", po::value(&output_file_diag)->default_value(std::string()), - "Name of file in which the persistence diagram is written. Default print in std::cout")( + "Name of file in which the persistence diagram is written. Default print in std::clog")( "max-alpha-square-value,r", po::value(&alpha_square_max_value) ->default_value(std::numeric_limits::infinity()), @@ -288,18 +288,18 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool po::notify(vm); if (vm.count("help") || !vm.count("input-file") || !vm.count("weight-file")) { - std::cout << std::endl; - std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; - std::cout << "of a 3D Alpha complex defined on a set of input points.\n"; - std::cout << "3D Alpha complex can be safe (by default) exact or fast, weighted and/or periodic\n\n"; - std::cout << "The output diagram contains one bar per line, written with the convention: \n"; - std::cout << " p dim b d \n"; - std::cout << "where dim is the dimension of the homological feature,\n"; - std::cout << "b and d are respectively the birth and death of the feature and \n"; - std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients.\n\n"; + std::clog << std::endl; + std::clog << "Compute the persistent homology with coefficient field Z/pZ \n"; + std::clog << "of a 3D Alpha complex defined on a set of input points.\n"; + std::clog << "3D Alpha complex can be safe (by default) exact or fast, weighted and/or periodic\n\n"; + std::clog << "The output diagram contains one bar per line, written with the convention: \n"; + std::clog << " p dim b d \n"; + std::clog << "where dim is the dimension of the homological feature,\n"; + std::clog << "b and d are respectively the birth and death of the feature and \n"; + std::clog << "p is the characteristic of the field Z/pZ used for homology coefficients.\n\n"; - std::cout << "Usage: " << argv[0] << " [options] input-file weight-file\n\n"; - std::cout << visible << std::endl; + std::clog << "Usage: " << argv[0] << " [options] input-file weight-file\n\n"; + std::clog << visible << std::endl; exit(-1); } } diff --git a/src/Alpha_complex/utilities/alpha_complex_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_persistence.cpp index 486347cc..be60ff78 100644 --- a/src/Alpha_complex/utilities/alpha_complex_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_persistence.cpp @@ -72,13 +72,13 @@ int main(int argc, char **argv) { // ---------------------------------------------------------------------------- // Display information about the alpha complex // ---------------------------------------------------------------------------- - std::cout << "Simplicial complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() + std::clog << "Simplicial complex is of dimension " << simplex.dimension() << " - " << simplex.num_simplices() << " simplices - " << simplex.num_vertices() << " vertices." << std::endl; // Sort the simplices in the order of the filtration simplex.initialize_filtration(); - std::cout << "Simplex_tree dim: " << simplex.dimension() << std::endl; + std::clog << "Simplex_tree dim: " << simplex.dimension() << std::endl; // Compute the persistence diagram of the complex Gudhi::persistent_cohomology::Persistent_cohomology pcoh( simplex); @@ -91,7 +91,7 @@ int main(int argc, char **argv) { if (output_file_diag.empty()) { pcoh.output_diagram(); } else { - std::cout << "Result in file: " << output_file_diag << std::endl; + std::clog << "Result in file: " << output_file_diag << std::endl; std::ofstream out(output_file_diag); pcoh.output_diagram(out); out.close(); @@ -114,7 +114,7 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool "fast,f", po::bool_switch(&fast), "To activate fast version of Alpha complex (default is false, not available if exact is set)")( "output-file,o", po::value(&output_file_diag)->default_value(std::string()), - "Name of file in which the persistence diagram is written. Default print in std::cout")( + "Name of file in which the persistence diagram is written. Default print in std::clog")( "max-alpha-square-value,r", po::value(&alpha_square_max_value) ->default_value(std::numeric_limits::infinity()), "Maximal alpha square value for the Alpha complex construction.")( @@ -135,17 +135,17 @@ void program_options(int argc, char *argv[], std::string &off_file_points, bool po::notify(vm); if (vm.count("help") || !vm.count("input-file")) { - std::cout << std::endl; - std::cout << "Compute the persistent homology with coefficient field Z/pZ \n"; - std::cout << "of an Alpha complex defined on a set of input points.\n \n"; - std::cout << "The output diagram contains one bar per line, written with the convention: \n"; - std::cout << " p dim b d \n"; - std::cout << "where dim is the dimension of the homological feature,\n"; - std::cout << "b and d are respectively the birth and death of the feature and \n"; - std::cout << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << std::endl; - - std::cout << "Usage: " << argv[0] << " [options] input-file" << std::endl << std::endl; - std::cout << visible << std::endl; + std::clog << std::endl; + std::clog << "Compute the persistent homology with coefficient field Z/pZ \n"; + std::clog << "of an Alpha complex defined on a set of input points.\n \n"; + std::clog << "The output diagram contains one bar per line, written with the convention: \n"; + std::clog << " p dim b d \n"; + std::clog << "where dim is the dimension of the homological feature,\n"; + std::clog << "b and d are respectively the birth and death of the feature and \n"; + std::clog << "p is the characteristic of the field Z/pZ used for homology coefficients." << std::endl << 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 From e1dbf6da118615e20d2b642df98b7d3df7cfd8c7 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Thu, 5 Mar 2020 10:16:51 +0100 Subject: Remove travis and use appveyor for OSx. Fix parallel test by setting tests dependencies --- .github/build-requirements.txt | 5 ++ .github/test-requirements.txt | 8 +++ .travis.yml | 78 ---------------------- Dockerfile_for_circleci_image | 22 ++---- azure-pipelines.yml | 44 ++++++++++++ src/Alpha_complex/example/CMakeLists.txt | 6 +- src/Alpha_complex/utilities/CMakeLists.txt | 12 +++- .../utilities/CMakeLists.txt | 10 ++- .../utilities/persistence_heat_maps/CMakeLists.txt | 19 ++++-- .../utilities/persistence_intervals/CMakeLists.txt | 7 +- .../persistence_landscapes/CMakeLists.txt | 8 +-- .../persistence_landscapes_on_grid/CMakeLists.txt | 8 +-- .../utilities/persistence_vectors/CMakeLists.txt | 8 +-- src/Rips_complex/example/CMakeLists.txt | 8 +++ src/common/example/CMakeLists.txt | 1 + src/python/CMakeLists.txt | 2 +- 16 files changed, 128 insertions(+), 118 deletions(-) create mode 100644 .github/build-requirements.txt create mode 100644 .github/test-requirements.txt delete mode 100644 .travis.yml create mode 100644 azure-pipelines.yml (limited to 'src/Alpha_complex') diff --git a/.github/build-requirements.txt b/.github/build-requirements.txt new file mode 100644 index 00000000..7de60d23 --- /dev/null +++ b/.github/build-requirements.txt @@ -0,0 +1,5 @@ +setuptools +wheel +numpy +Cython +pybind11 \ No newline at end of file diff --git a/.github/test-requirements.txt b/.github/test-requirements.txt new file mode 100644 index 00000000..bd03f98e --- /dev/null +++ b/.github/test-requirements.txt @@ -0,0 +1,8 @@ +pytest +sphinx +sphinxcontrib-bibtex +sphinx-paramlinks +matplotlib +scipy +scikit-learn +POT \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8980be10..00000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -language: cpp - -sudo: required - -git: - depth: 3 - -os: osx -osx_image: xcode10.2 -compiler: clang - -matrix: - include: - - env: - # 1. Only examples and associated tests - - CMAKE_EXAMPLE='ON' CMAKE_TEST='OFF' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='OFF' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure' - - env: - # 2. Only unitary tests - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='ON' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='OFF' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure' - - env: - # 3. Only utilities and associated tests - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='OFF' CMAKE_UTILITIES='ON' CMAKE_PYTHON='OFF' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure' - - env: - # 4. Only doxygen documentation - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='OFF' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='OFF' MAKE_TARGET='doxygen' CTEST_COMMAND='echo No tests for doxygen target' - - env: - # 5. Only Python, associated tests and sphinx documentation - # $ which python3 => /usr/local/bin/python3 - # cmake => -- Found PythonInterp: /usr/local/bin/python3 (found version "3.7.5") - # In python3-sphinx-build.py, print(sys.executable) => /usr/local/opt/python/bin/python3.7 ??? - # should be : MAKE_TARGET='all sphinx' CTEST_COMMAND='ctest --output-on-failure' - - CMAKE_EXAMPLE='OFF' CMAKE_TEST='OFF' CMAKE_UTILITIES='OFF' CMAKE_PYTHON='ON' MAKE_TARGET='all' CTEST_COMMAND='ctest --output-on-failure -E sphinx' - -cache: - directories: - - $HOME/.cache/pip - - $HOME/Library/Caches/Homebrew - -before_install: - - brew update && brew unlink python@2 && brew upgrade python - -addons: - homebrew: - packages: - - python3 - - cmake - - graphviz - - doxygen - - boost - - eigen - - gmp - - mpfr - - tbb - - cgal - -before_cache: - - rm -f $HOME/.cache/pip/log/debug.log - - brew cleanup - -# When installing through libcgal-dev apt, CMake Error at CGAL Exports.cmake The imported target "CGAL::CGAL Qt5" references the file -install: - - python3 -m pip install --upgrade pip setuptools wheel - - python3 -m pip install --user pytest Cython sphinx sphinxcontrib-bibtex sphinx-paramlinks matplotlib numpy scipy scikit-learn - - python3 -m pip install --user POT pybind11 - -script: - - rm -rf build - - mkdir -p build - - cd build - - cmake -DCMAKE_BUILD_TYPE=Release -DWITH_GUDHI_EXAMPLE=${CMAKE_EXAMPLE} -DWITH_GUDHI_TEST=${CMAKE_TEST} -DWITH_GUDHI_UTILITIES=${CMAKE_UTILITIES} -DWITH_GUDHI_PYTHON=${CMAKE_PYTHON} -DUSER_VERSION_DIR=version -DPython_ADDITIONAL_VERSIONS=3 .. - - make ${MAKE_TARGET} - - ${CTEST_COMMAND} - - cd .. - -notifications: - email: - on_success: change # default: always - on_failure: always # default: always diff --git a/Dockerfile_for_circleci_image b/Dockerfile_for_circleci_image index ebd2f366..cca93f0c 100644 --- a/Dockerfile_for_circleci_image +++ b/Dockerfile_for_circleci_image @@ -42,24 +42,16 @@ RUN apt-get install -y make \ locales \ python3 \ python3-pip \ - python3-pytest \ python3-tk \ - python3-pybind11 \ libfreetype6-dev \ - pkg-config + pkg-config \ + curl -RUN pip3 install \ - setuptools \ - numpy \ - matplotlib \ - scipy \ - Cython \ - POT \ - scikit-learn \ - sphinx \ - sphinx-paramlinks \ - sphinxcontrib-bibtex \ - tensorflow +ADD .github/build-requirements.txt / +ADD .github/test-requirements.txt / + +RUN pip3 install -r build-requirements.txt +RUN pip3 install -r test-requirements.txt # apt clean up RUN apt autoremove && rm -rf /var/lib/apt/lists/* diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 00000000..77e0ac88 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,44 @@ +trigger: + batch: true + branches: + include: + - '*' # All branches + +jobs: + + - job: 'Test' + displayName: "Build and test" + timeoutInMinutes: 0 + cancelTimeoutInMinutes: 60 + + strategy: + matrix: + macOSrelease: + imageName: 'macos-10.14' + CMakeBuildType: Release + customInstallation: 'brew update && brew install graphviz doxygen boost eigen gmp mpfr tbb cgal' + + pool: + vmImage: $(imageName) + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.7' + architecture: 'x64' + + - script: | + $(customInstallation) + git submodule update --init + python -m pip install --upgrade pip + python -m pip install --user -r .github/build-requirements.txt + python -m pip install --user -r .github/test-requirements.txt + displayName: 'Install build dependencies' + - script: | + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE:STRING=$(CMakeBuildType) -DWITH_GUDHI_TEST=ON -DWITH_GUDHI_UTILITIES=ON -DWITH_GUDHI_PYTHON=ON -DPython_ADDITIONAL_VERSIONS=3 .. + make + make doxygen + ctest -j 8 --output-on-failure -E sphinx # remove sphinx build as it fails + displayName: 'Build, test and documentation generation' diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index b0337934..2eecd50c 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -32,14 +32,18 @@ if (DIFF_PATH) add_test(Alpha_complex_example_from_off_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt) + set_tests_properties(Alpha_complex_example_from_off_60_diff_files PROPERTIES DEPENDS Alpha_complex_example_from_off_60) add_test(Alpha_complex_example_from_off_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) + set_tests_properties(Alpha_complex_example_from_off_32_diff_files PROPERTIES DEPENDS Alpha_complex_example_from_off_32) add_test(Alpha_complex_example_fast_from_off_60_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_60.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_60.txt) + set_tests_properties(Alpha_complex_example_fast_from_off_60_diff_files PROPERTIES DEPENDS Alpha_complex_example_fast_from_off_60) add_test(Alpha_complex_example_fast_from_off_32_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/fastalphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) - endif() + set_tests_properties(Alpha_complex_example_fast_from_off_32_diff_files PROPERTIES DEPENDS Alpha_complex_example_fast_from_off_32) +endif() add_executable ( Alpha_complex_example_weighted_3d_from_points Weighted_alpha_complex_3d_from_points.cpp ) target_link_libraries(Alpha_complex_example_weighted_3d_from_points ${CGAL_LIBRARY}) diff --git a/src/Alpha_complex/utilities/CMakeLists.txt b/src/Alpha_complex/utilities/CMakeLists.txt index a3b0cc24..2ffbdde0 100644 --- a/src/Alpha_complex/utilities/CMakeLists.txt +++ b/src/Alpha_complex/utilities/CMakeLists.txt @@ -16,8 +16,14 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) if (DIFF_PATH) add_test(Alpha_complex_utilities_diff_exact_alpha_complex ${DIFF_PATH} "exact.pers" "safe.pers") + set_tests_properties(Alpha_complex_utilities_diff_exact_alpha_complex PROPERTIES DEPENDS + "Alpha_complex_utilities_exact_alpha_complex_persistence;Alpha_complex_utilities_safe_alpha_complex_persistence") + add_test(Alpha_complex_utilities_diff_fast_alpha_complex ${DIFF_PATH} "fast.pers" "safe.pers") + set_tests_properties(Alpha_complex_utilities_diff_fast_alpha_complex PROPERTIES DEPENDS + "Alpha_complex_utilities_fast_alpha_complex_persistence;Alpha_complex_utilities_safe_alpha_complex_persistence") + endif() install(TARGETS alpha_complex_persistence DESTINATION bin) @@ -36,15 +42,19 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "-p" "2" "-m" "0.45" "-o" "exact_3d.pers" "-e") - add_test(NAME Alpha_complex_utilities_safe_alpha_complex_3d COMMAND $ + add_test(NAME Alpha_complex_utilities_fast_alpha_complex_3d COMMAND $ "${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off" "-p" "2" "-m" "0.45" "-o" "fast_3d.pers" "-f") if (DIFF_PATH) add_test(Alpha_complex_utilities_diff_exact_alpha_complex_3d ${DIFF_PATH} "exact_3d.pers" "safe_3d.pers") + set_tests_properties(Alpha_complex_utilities_diff_exact_alpha_complex_3d PROPERTIES DEPENDS + "Alpha_complex_utilities_exact_alpha_complex_3d;Alpha_complex_utilities_alpha_complex_3d") add_test(Alpha_complex_utilities_diff_fast_alpha_complex_3d ${DIFF_PATH} "fast_3d.pers" "safe_3d.pers") + set_tests_properties(Alpha_complex_utilities_diff_fast_alpha_complex_3d PROPERTIES DEPENDS + "Alpha_complex_utilities_fast_alpha_complex_3d;Alpha_complex_utilities_alpha_complex_3d") endif() add_test(NAME Alpha_complex_utilities_periodic_alpha_complex_3d_persistence COMMAND $ diff --git a/src/Persistence_representations/utilities/CMakeLists.txt b/src/Persistence_representations/utilities/CMakeLists.txt index fc51b1d6..85633b7b 100644 --- a/src/Persistence_representations/utilities/CMakeLists.txt +++ b/src/Persistence_representations/utilities/CMakeLists.txt @@ -14,7 +14,7 @@ function(add_persistence_representation_creation_utility creation_utility) install(TARGETS ${creation_utility} DESTINATION bin) endfunction(add_persistence_representation_creation_utility) -function(add_persistence_representation_plot_utility plot_utility tool_extension) +function(add_persistence_representation_plot_utility creation_utility plot_utility tool_extension) add_executable ( ${plot_utility} ${plot_utility}.cpp ) # as the function is called in a subdirectory level, need to '../' to find persistence heat maps files @@ -22,17 +22,21 @@ function(add_persistence_representation_plot_utility plot_utility tool_extension "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}") #add_test(NAME Persistence_representation_utilities_${plot_utility}_second COMMAND $ # "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") + set_tests_properties(Persistence_representation_utilities_${plot_utility}_first PROPERTIES DEPENDS + Persistence_representation_utilities_${creation_utility}) if(GNUPLOT_PATH) add_test(NAME Persistence_representation_utilities_${plot_utility}_first_gnuplot COMMAND ${GNUPLOT_PATH} "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}_GnuplotScript'") #add_test(NAME Persistence_representation_utilities_${plot_utility}_second_gnuplot COMMAND ${GNUPLOT_PATH} # "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}_GnuplotScript'") + set_tests_properties(Persistence_representation_utilities_${plot_utility}_first_gnuplot PROPERTIES DEPENDS + Persistence_representation_utilities_${plot_utility}_first) endif() install(TARGETS ${plot_utility} DESTINATION bin) endfunction(add_persistence_representation_plot_utility) -function(add_persistence_representation_function_utility function_utility tool_extension) +function(add_persistence_representation_function_utility creation_utility function_utility tool_extension) add_executable ( ${function_utility} ${function_utility}.cpp ) # ARGV2 is an optional argument @@ -48,6 +52,8 @@ function(add_persistence_representation_function_utility function_utility tool_e "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}" "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") endif() + set_tests_properties(Persistence_representation_utilities_${function_utility} PROPERTIES DEPENDS + Persistence_representation_utilities_${creation_utility}) install(TARGETS ${function_utility} DESTINATION bin) endfunction(add_persistence_representation_function_utility) diff --git a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt index 89ef232f..e4c471c2 100644 --- a/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_heat_maps/CMakeLists.txt @@ -2,13 +2,24 @@ project(Persistence_representations_heat_maps_utilities) add_persistence_representation_creation_utility(create_pssk "10" "-1" "-1" "4" "-1") add_persistence_representation_creation_utility(create_p_h_m_weighted_by_arctan_of_their_persistence "10" "-1" "-1" "4" "-1") + add_persistence_representation_creation_utility(create_p_h_m_weighted_by_distance_from_diagonal "10" "-1" "-1" "4" "-1") +# Tests output the same file +set_tests_properties(Persistence_representation_utilities_create_p_h_m_weighted_by_distance_from_diagonal PROPERTIES DEPENDS + Persistence_representation_utilities_create_p_h_m_weighted_by_arctan_of_their_persistence) + add_persistence_representation_creation_utility(create_p_h_m_weighted_by_squared_diag_distance "10" "-1" "-1" "4" "-1") +# Tests output the same file +set_tests_properties(Persistence_representation_utilities_create_p_h_m_weighted_by_squared_diag_distance PROPERTIES DEPENDS + Persistence_representation_utilities_create_p_h_m_weighted_by_distance_from_diagonal) + # Need to set grid min and max for further average, distance and scalar_product add_persistence_representation_creation_utility(create_persistence_heat_maps "10" "0" "35" "10" "-1") +set_tests_properties(Persistence_representation_utilities_create_persistence_heat_maps PROPERTIES DEPENDS + Persistence_representation_utilities_create_p_h_m_weighted_by_squared_diag_distance) -add_persistence_representation_plot_utility(plot_persistence_heat_map ".mps") +add_persistence_representation_plot_utility(create_persistence_heat_maps plot_persistence_heat_map ".mps") -add_persistence_representation_function_utility(average_persistence_heat_maps ".mps") -add_persistence_representation_function_utility(compute_distance_of_persistence_heat_maps ".mps" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_persistence_heat_maps ".mps") +add_persistence_representation_function_utility(create_persistence_heat_maps average_persistence_heat_maps ".mps") +add_persistence_representation_function_utility(create_persistence_heat_maps compute_distance_of_persistence_heat_maps ".mps" "1") +add_persistence_representation_function_utility(create_persistence_heat_maps compute_scalar_product_of_persistence_heat_maps ".mps") diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt index a025183e..118c1e9b 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt @@ -3,17 +3,16 @@ project(Persistence_representations_intervals_utilities) add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals_lengths.cpp ) -add_test(NAME plot_histogram_of_intervals_lengths COMMAND $ +add_test(NAME Persistence_representation_utilities_plot_histogram_of_intervals_lengths COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" "-1") install(TARGETS plot_histogram_of_intervals_lengths DESTINATION bin) -add_persistence_representation_plot_utility(plot_persistence_intervals "") -add_persistence_representation_plot_utility(plot_persistence_Betti_numbers "") +add_persistence_representation_plot_utility(plot_histogram_of_intervals_lengths plot_persistence_intervals "") +add_persistence_representation_plot_utility(plot_histogram_of_intervals_lengths plot_persistence_Betti_numbers "") add_persistence_representation_creation_utility(compute_birth_death_range_in_persistence_diagram "-1") - add_executable ( compute_number_of_dominant_intervals compute_number_of_dominant_intervals.cpp ) add_test(NAME Persistence_representation_utilities_compute_number_of_dominant_intervals COMMAND $ diff --git a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt index 6b24d032..4df84d36 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes/CMakeLists.txt @@ -2,8 +2,8 @@ project(Persistence_representations_landscapes_utilities) add_persistence_representation_creation_utility(create_landscapes "-1") -add_persistence_representation_plot_utility(plot_landscapes ".land") +add_persistence_representation_plot_utility(create_landscapes plot_landscapes ".land") -add_persistence_representation_function_utility(average_landscapes ".land") -add_persistence_representation_function_utility(compute_distance_of_landscapes ".land" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_landscapes ".land") +add_persistence_representation_function_utility(create_landscapes average_landscapes ".land") +add_persistence_representation_function_utility(create_landscapes compute_distance_of_landscapes ".land" "1") +add_persistence_representation_function_utility(create_landscapes compute_scalar_product_of_landscapes ".land") diff --git a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt index 36f3196b..8cd965f1 100644 --- a/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_landscapes_on_grid/CMakeLists.txt @@ -3,8 +3,8 @@ project(Persistence_representations_lanscapes_on_grid_utilities) # Need to set grid min and max for further average, distance and scalar_product add_persistence_representation_creation_utility(create_landscapes_on_grid "100" "0" "35" "-1") -add_persistence_representation_plot_utility(plot_landscapes_on_grid ".g_land") +add_persistence_representation_plot_utility(create_landscapes_on_grid plot_landscapes_on_grid ".g_land") -add_persistence_representation_function_utility(average_landscapes_on_grid ".g_land") -add_persistence_representation_function_utility(compute_distance_of_landscapes_on_grid ".g_land" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_landscapes_on_grid ".g_land") +add_persistence_representation_function_utility(create_landscapes_on_grid average_landscapes_on_grid ".g_land") +add_persistence_representation_function_utility(create_landscapes_on_grid compute_distance_of_landscapes_on_grid ".g_land" "1") +add_persistence_representation_function_utility(create_landscapes_on_grid compute_scalar_product_of_landscapes_on_grid ".g_land") diff --git a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt index bc982094..5b22ca84 100644 --- a/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_vectors/CMakeLists.txt @@ -2,8 +2,8 @@ project(Persistence_vectors_utilities) add_persistence_representation_creation_utility(create_persistence_vectors "-1") -add_persistence_representation_plot_utility(plot_persistence_vectors ".vect") +add_persistence_representation_plot_utility(create_persistence_vectors plot_persistence_vectors ".vect") -add_persistence_representation_function_utility(average_persistence_vectors ".vect") -add_persistence_representation_function_utility(compute_distance_of_persistence_vectors ".vect" "1") -add_persistence_representation_function_utility(compute_scalar_product_of_persistence_vectors ".vect") +add_persistence_representation_function_utility(create_persistence_vectors average_persistence_vectors ".vect") +add_persistence_representation_function_utility(create_persistence_vectors compute_distance_of_persistence_vectors ".vect" "1") +add_persistence_representation_function_utility(create_persistence_vectors compute_scalar_product_of_persistence_vectors ".vect") diff --git a/src/Rips_complex/example/CMakeLists.txt b/src/Rips_complex/example/CMakeLists.txt index e7772bdb..244a93ec 100644 --- a/src/Rips_complex/example/CMakeLists.txt +++ b/src/Rips_complex/example/CMakeLists.txt @@ -53,15 +53,23 @@ if (DIFF_PATH) add_test(Rips_complex_example_from_off_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_off_doc_12_1_diff_files PROPERTIES DEPENDS Rips_complex_example_from_off_doc_12_1) + add_test(Rips_complex_example_from_off_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripsoffreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_off_doc_12_3_diff_files PROPERTIES DEPENDS Rips_complex_example_from_off_doc_12_3) + add_test(Rips_complex_example_from_csv_distance_matrix_doc_12_1_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_1.txt ${CMAKE_CURRENT_BINARY_DIR}/one_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_csv_distance_matrix_doc_12_1_diff_files PROPERTIES DEPENDS Rips_complex_example_from_csv_distance_matrix_doc_12_1) + add_test(Rips_complex_example_from_csv_distance_matrix_doc_12_3_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/ripscsvreader_result_12_3.txt ${CMAKE_CURRENT_BINARY_DIR}/full_skeleton_rips_for_doc.txt) + set_tests_properties(Rips_complex_example_from_csv_distance_matrix_doc_12_3_diff_files PROPERTIES DEPENDS Rips_complex_example_from_csv_distance_matrix_doc_12_3) + endif() install(TARGETS Rips_complex_example_from_off DESTINATION bin) diff --git a/src/common/example/CMakeLists.txt b/src/common/example/CMakeLists.txt index 583a0027..fa8eb98c 100644 --- a/src/common/example/CMakeLists.txt +++ b/src/common/example/CMakeLists.txt @@ -12,6 +12,7 @@ if (DIFF_PATH) add_test(Common_example_vector_double_off_reader_diff_files ${DIFF_PATH} ${CMAKE_CURRENT_BINARY_DIR}/vectordoubleoffreader_result.txt ${CMAKE_CURRENT_BINARY_DIR}/alphacomplexdoc.off.txt) + set_tests_properties(Common_example_vector_double_off_reader_diff_files PROPERTIES DEPENDS Common_example_vector_double_off_reader) endif() if(NOT CGAL_VERSION VERSION_LESS 4.11.0) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 090a7446..20e72a5f 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -181,7 +181,7 @@ if(PYTHONINTERP_FOUND) set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${MPFR_LIBRARIES_DIR}', ") message("** Add mpfr ${MPFR_LIBRARIES}") endif(MPFR_FOUND) -endif(CGAL_FOUND) + endif(CGAL_FOUND) # Specific for Mac if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -- cgit v1.2.3 From b262406b0a75e39276c11f70ef1174981aa31b51 Mon Sep 17 00:00:00 2001 From: ROUVREAU Vincent Date: Tue, 17 Mar 2020 17:57:17 +0100 Subject: Remove thread_local workaround --- src/Alpha_complex/include/gudhi/Alpha_complex_3d.h | 5 +-- src/Nerve_GIC/include/gudhi/GIC.h | 14 +------- .../include/gudhi/Persistent_cohomology.h | 5 +-- src/Simplex_tree/include/gudhi/Simplex_tree.h | 12 ++----- src/cmake/modules/GUDHI_compilation_flags.cmake | 37 ---------------------- src/python/CMakeLists.txt | 10 ------ 6 files changed, 5 insertions(+), 78 deletions(-) (limited to 'src/Alpha_complex') diff --git a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h index 7f96c94c..1486cefd 100644 --- a/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h +++ b/src/Alpha_complex/include/gudhi/Alpha_complex_3d.h @@ -61,10 +61,7 @@ namespace Gudhi { namespace alpha_complex { -#ifdef GUDHI_CAN_USE_CXX11_THREAD_LOCAL -thread_local -#endif // GUDHI_CAN_USE_CXX11_THREAD_LOCAL - double RELATIVE_PRECISION_OF_TO_DOUBLE = 0.00001; +thread_local double RELATIVE_PRECISION_OF_TO_DOUBLE = 0.00001; // Value_from_iterator returns the filtration value from an iterator on alpha shapes values // diff --git a/src/Nerve_GIC/include/gudhi/GIC.h b/src/Nerve_GIC/include/gudhi/GIC.h index 2a6d4788..9a4c813d 100644 --- a/src/Nerve_GIC/include/gudhi/GIC.h +++ b/src/Nerve_GIC/include/gudhi/GIC.h @@ -139,19 +139,9 @@ class Cover_complex { for (boost::tie(ei, ei_end) = boost::edges(G); ei != ei_end; ++ei) boost::remove_edge(*ei, G); } - // Thread local is not available on XCode version < V.8 - // If not available, random engine is a class member. -#ifndef GUDHI_CAN_USE_CXX11_THREAD_LOCAL - std::default_random_engine re; -#endif // GUDHI_CAN_USE_CXX11_THREAD_LOCAL - // Find random number in [0,1]. double GetUniform() { - // Thread local is not available on XCode version < V.8 - // If available, random engine is defined for each thread. -#ifdef GUDHI_CAN_USE_CXX11_THREAD_LOCAL thread_local std::default_random_engine re; -#endif // GUDHI_CAN_USE_CXX11_THREAD_LOCAL std::uniform_real_distribution Dist(0, 1); return Dist(re); } @@ -456,9 +446,7 @@ class Cover_complex { if (distances.size() == 0) compute_pairwise_distances(distance); - // This cannot be parallelized if thread_local is not defined - // thread_local is not defined for XCode < v.8 - #if defined(GUDHI_USE_TBB) && defined(GUDHI_CAN_USE_CXX11_THREAD_LOCAL) + #ifdef GUDHI_USE_TBB std::mutex deltamutex; tbb::parallel_for(0, N, [&](int i){ std::vector samples(m); diff --git a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h index b1ded5ae..ca4bc10d 100644 --- a/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h +++ b/src/Persistent_cohomology/include/gudhi/Persistent_cohomology.h @@ -288,10 +288,7 @@ class Persistent_cohomology { // with multiplicity. We used to sum the coefficients directly in // annotations_in_boundary by using a map, we now do it later. typedef std::pair annotation_t; -#ifdef GUDHI_CAN_USE_CXX11_THREAD_LOCAL - thread_local -#endif // GUDHI_CAN_USE_CXX11_THREAD_LOCAL - std::vector annotations_in_boundary; + thread_local std::vector annotations_in_boundary; annotations_in_boundary.clear(); int sign = 1 - 2 * (dim_sigma % 2); // \in {-1,1} provides the sign in the // alternate sum in the boundary. diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index b7fb9002..2adc8354 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -765,12 +765,7 @@ class Simplex_tree { if (first == last) return { null_simplex(), true }; // FIXME: false would make more sense to me. - // Copy before sorting - // Thread local is not available on XCode version < V.8 - It will slow down computation -#ifdef GUDHI_CAN_USE_CXX11_THREAD_LOCAL - thread_local -#endif // GUDHI_CAN_USE_CXX11_THREAD_LOCAL - std::vector copy; + thread_local std::vector copy; copy.clear(); copy.insert(copy.end(), first, last); std::sort(copy.begin(), copy.end()); @@ -1133,10 +1128,7 @@ class Simplex_tree { Dictionary_it next = siblings->members().begin(); ++next; -#ifdef GUDHI_CAN_USE_CXX11_THREAD_LOCAL - thread_local -#endif // GUDHI_CAN_USE_CXX11_THREAD_LOCAL - std::vector > inter; + thread_local std::vector > inter; for (Dictionary_it s_h = siblings->members().begin(); s_h != siblings->members().end(); ++s_h, ++next) { Simplex_handle root_sh = find_vertex(s_h->first); diff --git a/src/cmake/modules/GUDHI_compilation_flags.cmake b/src/cmake/modules/GUDHI_compilation_flags.cmake index 34c2e065..567fbc40 100644 --- a/src/cmake/modules/GUDHI_compilation_flags.cmake +++ b/src/cmake/modules/GUDHI_compilation_flags.cmake @@ -1,7 +1,6 @@ # This files manage compilation flags required by GUDHI include(TestCXXAcceptsFlag) -include(CheckCXXSourceCompiles) # add a compiler flag only if it is accepted macro(add_cxx_compiler_flag _flag) @@ -12,32 +11,6 @@ macro(add_cxx_compiler_flag _flag) endif() endmacro() -function(can_cgal_use_cxx11_thread_local) - # This is because of https://github.com/CGAL/cgal/blob/master/Installation/include/CGAL/tss.h - # CGAL is using boost thread if thread_local is not ready (requires XCode 8 for Mac). - # The test in https://github.com/CGAL/cgal/blob/master/Installation/include/CGAL/config.h - # #if __has_feature(cxx_thread_local) || \ - # ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \ - # ( _MSC_VER >= 1900 ) - # #define CGAL_CAN_USE_CXX11_THREAD_LOCAL - # #endif - set(CGAL_CAN_USE_CXX11_THREAD_LOCAL " - int main() { - #ifndef __has_feature - #define __has_feature(x) 0 // Compatibility with non-clang compilers. - #endif - #if __has_feature(cxx_thread_local) || \ - ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \ - ( _MSC_VER >= 1900 ) - bool has_feature_thread_local = true; - #else - // Explicit error of compilation for CMake test purpose - has_feature_thread_local is not defined - #endif - bool result = has_feature_thread_local; - } ") - check_cxx_source_compiles("${CGAL_CAN_USE_CXX11_THREAD_LOCAL}" CGAL_CAN_USE_CXX11_THREAD_LOCAL_RESULT) -endfunction() - set (CMAKE_CXX_STANDARD 14) enable_testing() @@ -58,16 +31,6 @@ if (DEBUG_TRACES) add_definitions(-DDEBUG_TRACES) endif() -set(GUDHI_CAN_USE_CXX11_THREAD_LOCAL " - int main() { - thread_local int result = 0; - return result; - } ") -check_cxx_source_compiles("${GUDHI_CAN_USE_CXX11_THREAD_LOCAL}" GUDHI_CAN_USE_CXX11_THREAD_LOCAL_RESULT) -if (GUDHI_CAN_USE_CXX11_THREAD_LOCAL_RESULT) - add_definitions(-DGUDHI_CAN_USE_CXX11_THREAD_LOCAL) -endif() - if(CMAKE_BUILD_TYPE MATCHES Debug) message("++ Debug compilation flags are: ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}") else() diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 22af3ec9..f00966a5 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -128,16 +128,6 @@ if(PYTHONINTERP_FOUND) endif () if(CGAL_FOUND) - can_cgal_use_cxx11_thread_local() - if (NOT CGAL_CAN_USE_CXX11_THREAD_LOCAL_RESULT) - if(CMAKE_BUILD_TYPE MATCHES Debug) - add_GUDHI_PYTHON_lib("${Boost_THREAD_LIBRARY_DEBUG}") - else() - add_GUDHI_PYTHON_lib("${Boost_THREAD_LIBRARY_RELEASE}") - endif() - message("** Add Boost ${Boost_LIBRARY_DIRS}") - set(GUDHI_PYTHON_LIBRARY_DIRS "${GUDHI_PYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") - endif() # Add CGAL compilation args if(CGAL_HEADER_ONLY) add_gudhi_debug_info("CGAL header only version ${CGAL_VERSION}") -- cgit v1.2.3