From de6c5f28955f1ed9bf0af7d83607fb6549264c2d Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 5 Jan 2024 16:46:50 +0100 Subject: [PATCH] change the loop pattern when there are PLC errors That gave a direct improvement for the four PLC error case from Thingi: ``` name status time error new status new time new error Thingi10K_104400 FAILED 1.710520 PLC_error FAILED 1.243950 PLC_error Thingi10K_162100 FAILED 1.970900 PLC_error passed 1.018690 Thingi10K_285604 FAILED 13.096400 PLC_error FAILED 4.543940 PLC_error Thingi10K_464846 FAILED 321.774000 PLC_error FAILED 16.658500 PLC_error ``` One case `Thingi10K_162100` passed. And the other three got runtime improvement before they reach the error. --- .../CGAL/Constrained_Delaunay_triangulation_3.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h b/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h index 5fe59dba924..200a36bd424 100644 --- a/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h +++ b/Triangulation_3/include/CGAL/Constrained_Delaunay_triangulation_3.h @@ -2199,6 +2199,7 @@ public: cdt_2_are_initialized = true; const auto npos = face_constraint_misses_subfaces.npos; auto i = face_constraint_misses_subfaces.find_first(); + bool the_process_made_progress = false; while(i != npos) { try { if(restore_face(i)) { @@ -2207,6 +2208,7 @@ public: std::cerr << "restore_face(" << i << ") incomplete, back to conforming...\n"; Conforming_Dt::restore_Delaunay(insert_in_conflict_visitor); } + the_process_made_progress = true; } catch(PLC_error& e) { std::cerr << std::string("ERROR: PLC error with face #F") << std::to_string(e.face_index) + "\n"; @@ -2219,7 +2221,15 @@ public: std::cerr << "Next face is face #F " << i << '\n'; continue; } - i = face_constraint_misses_subfaces.find_first(); + i = face_constraint_misses_subfaces.find_next(i); + + // If we have made progress, we start again from the beginning. + // Otherwise, either we are done, or there was a full loop with + // only PLC errors. + if(i == npos && true == the_process_made_progress) { + i = face_constraint_misses_subfaces.find_first(); + the_process_made_progress = false; + } } }