From a3666887a1ca7273177799a273c36b600bb2762a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 26 Jan 2017 18:27:49 +0100 Subject: [PATCH 1/2] remove dependancy to PSP --- .../Triangulate_hole_polygon_mesh.h | 9 +++++-- .../Hole_filling/Triangulate_hole_polyline.h | 5 ++-- .../internal/fair_impl.h | 17 ++++++++++--- .../internal/refine_impl.h | 25 ++++++++++++++----- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h index ab600221dab..c6379967a5f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polygon_mesh.h @@ -25,8 +25,9 @@ #include +#ifdef CGAL_PMP_HOLE_FILLING_DEBUG #include -#include +#endif #include #include #include @@ -111,7 +112,9 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh, typedef std::map Vertex_map; typedef typename Vertex_map::iterator Vertex_map_it; + #ifdef CGAL_PMP_HOLE_FILLING_DEBUG CGAL::Timer timer; timer.start(); + #endif std::vector P, Q; std::vector P_edges; @@ -186,7 +189,9 @@ triangulate_hole_polygon_mesh(PolygonMesh& pmesh, #endif ; - CGAL_TRACE_STREAM << "Hole filling: " << timer.time() << " sc." << std::endl; timer.reset(); + #ifdef CGAL_PMP_HOLE_FILLING_DEBUG + std:cerr << "Hole filling: " << timer.time() << " sc." << std::endl; timer.reset(); + #endif return std::make_pair(tracer.out, weight); } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 60e797fcd0f..7055c733368 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include @@ -1229,7 +1228,9 @@ triangulate_hole_polyline(const PointRange1& points, typename WeightCalculator::Weight w = use_delaunay_triangulation ? Fill_DT().operator()(P,Q,tracer,WC) : Fill().operator()(P,Q,tracer,WC); - CGAL_TRACE_STREAM << w << std::endl; + #ifdef CGAL_PMP_HOLE_FILLING_DEBUG + std::cerr << w << std::endl; + #endif return w; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h index dab426cb779..1773e96131e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/fair_impl.h @@ -28,8 +28,9 @@ #include #include #include +#ifdef CGAL_PMP_FAIR_DEBUG #include -#include +#endif #include namespace CGAL { @@ -133,7 +134,9 @@ public: boost::end(vertices)); if(interior_vertices.empty()) { return true; } + #ifdef CGAL_PMP_FAIR_DEBUG CGAL::Timer timer; timer.start(); + #endif const std::size_t nb_vertices = interior_vertices.size(); Solver_vector X(nb_vertices), Bx(nb_vertices); Solver_vector Y(nb_vertices), By(nb_vertices); @@ -157,7 +160,9 @@ public: int v_id = static_cast(vertex_id_map[vd]); compute_row(vd, v_id, A, Bx[v_id], By[v_id], Bz[v_id], 1, vertex_id_map, depth); } - CGAL_TRACE_STREAM << "**Timer** System construction: " << timer.time() << std::endl; timer.reset(); + #ifdef CGAL_PMP_FAIR_DEBUG + std:cerr << "**Timer** System construction: " << timer.time() << std::endl; timer.reset(); + #endif // factorize double D; @@ -166,7 +171,9 @@ public: CGAL_warning(!"pre_factor failed!"); return false; } - CGAL_TRACE_STREAM << "**Timer** System factorization: " << timer.time() << std::endl; timer.reset(); + #ifdef CGAL_PMP_FAIR_DEBUG + std::cerr << "**Timer** System factorization: " << timer.time() << std::endl; timer.reset(); + #endif // solve bool is_all_solved = solver.linear_solver(Bx, X) && solver.linear_solver(By, Y) && solver.linear_solver(Bz, Z); @@ -174,7 +181,9 @@ public: CGAL_warning(!"linear_solver failed!"); return false; } - CGAL_TRACE_STREAM << "**Timer** System solver: " << timer.time() << std::endl; timer.reset(); + #ifdef CGAL_PMP_FAIR_DEBUG + std::cerr << "**Timer** System solver: " << timer.time() << std::endl; timer.reset(); + #endif /* This relative error is to large for cases that the results are not good */ diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index b21e9abb350..ffb147f4b7e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -30,8 +30,9 @@ #include #include -#include +#ifdef CGAL_PMP_FAIR_DEBUG #include +#endif #include #include #include @@ -168,7 +169,9 @@ private: collect_interior_edges(faces, border_edges, interior_edges, included_map); collect_interior_edges(new_faces, border_edges, interior_edges, included_map); - CGAL_TRACE_STREAM << "Test " << interior_edges.size() << " edges " << std::endl; + #ifndef CGAL_PMP_REFINE_DEBUG + std::cerr << "Test " << interior_edges.size() << " edges " << std::endl; + #endif //do not just use std::set (included_map) for iteration, the order effects the output (we like to make it deterministic) BOOST_FOREACH(halfedge_descriptor h, interior_edges) { @@ -177,7 +180,9 @@ private: } } - CGAL_TRACE_STREAM << "|flips| = " << flips << std::endl; + #ifndef CGAL_PMP_REFINE_DEBUG + std::cerr << "|flips| = " << flips << std::endl; + #endif return flips > 0; } @@ -312,20 +317,28 @@ public: for(int i = 0; i < 10; ++i) { std::vector new_faces; + #ifdef CGAL_PMP_REFINE_DEBUG CGAL::Timer timer; timer.start(); + #endif bool is_subdivided = subdivide(all_faces, border_edges, scale_attribute, vertex_out, facet_out, new_faces, alpha); - CGAL_TRACE_STREAM << "**Timer** subdivide() :" << timer.time() << std::endl; timer.reset(); + #ifdef CGAL_PMP_REFINE_DEBUG + std::cerr << "**Timer** subdivide() :" << timer.time() << std::endl; timer.reset(); + #endif if(!is_subdivided) break; bool is_relaxed = relax(faces, new_faces, border_edges); - CGAL_TRACE_STREAM << "**Timer** relax() :" << timer.time() << std::endl; + #ifdef CGAL_PMP_REFINE_DEBUG + std::cerr << "**Timer** relax() :" << timer.time() << std::endl; + #endif if(!is_relaxed) break; all_faces.insert(all_faces.end(), new_faces.begin(), new_faces.end()); } - CGAL_TRACE_STREAM << "**Timer** TOTAL: " << total_timer.time() << std::endl; + #ifdef CGAL_PMP_REFINE_DEBUG + std::cerr << "**Timer** TOTAL: " << total_timer.time() << std::endl; + #endif } }; //end class Refine_Polyhedron_3 From 006bfdfec03ff7e6cdb18034524eb951a1bdbca2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 27 Jan 2017 09:21:03 +0100 Subject: [PATCH 2/2] Add #ifdef CGAL_PMP_REFINE_DEBUG for total_timer --- .../include/CGAL/Polygon_mesh_processing/internal/refine_impl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index ffb147f4b7e..420c9f60bd3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -313,7 +313,9 @@ public: calculate_scale_attribute(faces, interior_map, scale_attribute, accept_internal_facets); std::vector all_faces(boost::begin(faces), boost::end(faces)); + #ifdef CGAL_PMP_REFINE_DEBUG CGAL::Timer total_timer; total_timer.start(); + #endif for(int i = 0; i < 10; ++i) { std::vector new_faces;