From bca05c8d6734f179d52e7cc16cebe40f532c2742 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Sep 2021 11:14:01 +0200 Subject: [PATCH 1/5] add header inclusion protection --- STL_Extension/include/CGAL/assertions_impl.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/STL_Extension/include/CGAL/assertions_impl.h b/STL_Extension/include/CGAL/assertions_impl.h index cfe4a27cf00..8701e67ccf7 100644 --- a/STL_Extension/include/CGAL/assertions_impl.h +++ b/STL_Extension/include/CGAL/assertions_impl.h @@ -14,6 +14,9 @@ // // Author(s) : Geert-Jan Giezeman and Sven Schönherr +#ifndef CGAL_ASSERTIONS_IMPL_H +#define CGAL_ASSERTIONS_IMPL_H + #ifdef CGAL_HEADER_ONLY #define CGAL_INLINE_FUNCTION inline #else @@ -280,3 +283,5 @@ set_warning_behaviour(Failure_behaviour eb) } } //namespace CGAL + +#endif //CGAL_ASSERTIONS_IMPL_H From 6d42c1ddf2d07ac28dd997d2eb6ced44fdb4ec1c Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Sep 2021 11:14:29 +0200 Subject: [PATCH 2/5] add warning message for the case when initialization has failed --- Mesh_3/include/CGAL/Mesh_3/Mesher_3.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index de889e42acf..e5a78c9b56e 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -45,6 +45,7 @@ #include #include #include +#include #ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE #include @@ -719,6 +720,20 @@ initialize() else #endif // CGAL_LINKED_WITH_TBB { + + if (r_c3t3_.number_of_facets() == 0) + { + CGAL::warning_fail("c3t3.number_of_facets() == 0", + "CGAL/Mesh_3/Mesher_3.h", + 725, + "Warning : The mesh refinement process can't start.\n" + "When calling refine_mesh_3(), the input `c3t3` should have been initialized and have " + "at least one facet in the complex. Try to solve this issue using :\n" + "\t- The automatic initialization provided by make_mesh_3()\n" + "\t- Adding more and better chosen points on the input surface\n" + "\t- defining the compilation macro CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE\n"); + } + if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0 && (r_c3t3_.triangulation().dimension() < 3 From b58c67d712babfde2dd034f3d40916e85caf26e3 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 24 Sep 2021 14:41:10 +0200 Subject: [PATCH 3/5] use macros --- Mesh_3/include/CGAL/Mesh_3/Mesher_3.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index e5a78c9b56e..6b61f6c9a0d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -45,7 +45,7 @@ #include #include #include -#include +#include #ifdef CGAL_MESH_3_USE_OLD_SURFACE_RESTRICTED_DELAUNAY_UPDATE #include @@ -724,8 +724,8 @@ initialize() if (r_c3t3_.number_of_facets() == 0) { CGAL::warning_fail("c3t3.number_of_facets() == 0", - "CGAL/Mesh_3/Mesher_3.h", - 725, + __FILE__, + __LINE__, "Warning : The mesh refinement process can't start.\n" "When calling refine_mesh_3(), the input `c3t3` should have been initialized and have " "at least one facet in the complex. Try to solve this issue using :\n" From dc0dad1577bd98b08418aaf98fc0208549863ea9 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 27 Sep 2021 11:02:42 +0200 Subject: [PATCH 4/5] remove wrong recommendation --- Mesh_3/include/CGAL/Mesh_3/Mesher_3.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index 6b61f6c9a0d..b998782dba0 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -730,8 +730,7 @@ initialize() "When calling refine_mesh_3(), the input `c3t3` should have been initialized and have " "at least one facet in the complex. Try to solve this issue using :\n" "\t- The automatic initialization provided by make_mesh_3()\n" - "\t- Adding more and better chosen points on the input surface\n" - "\t- defining the compilation macro CGAL_SEQUENTIAL_MESH_3_ADD_OUTSIDE_POINTS_ON_A_FAR_SPHERE\n"); + "\t- Adding more and better chosen points on the input surface\n"); } if (r_c3t3_.number_of_far_points() == 0 && From 932639eb6f76cc1c3f7afd1d5754afb873c6d900 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 30 Sep 2021 11:24:21 +0200 Subject: [PATCH 5/5] move warning code to have it happen when c3t3 has already been scanned --- Mesh_3/include/CGAL/Mesh_3/Mesher_3.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h index b998782dba0..2ba606c5de3 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Mesher_3.h @@ -720,19 +720,6 @@ initialize() else #endif // CGAL_LINKED_WITH_TBB { - - if (r_c3t3_.number_of_facets() == 0) - { - CGAL::warning_fail("c3t3.number_of_facets() == 0", - __FILE__, - __LINE__, - "Warning : The mesh refinement process can't start.\n" - "When calling refine_mesh_3(), the input `c3t3` should have been initialized and have " - "at least one facet in the complex. Try to solve this issue using :\n" - "\t- The automatic initialization provided by make_mesh_3()\n" - "\t- Adding more and better chosen points on the input surface\n"); - } - if (r_c3t3_.number_of_far_points() == 0 && r_c3t3_.number_of_facets() == 0 && (r_c3t3_.triangulation().dimension() < 3 @@ -779,6 +766,18 @@ initialize() facets_mesher_.scan_triangulation(); refinement_stage = REFINE_FACETS; } + + if (r_c3t3_.number_of_facets() == 0) + { + CGAL::warning_fail("r_c3t3_.number_of_facets() == 0", + __FILE__, + __LINE__, + "Warning : The mesh refinement process can't start.\n" + "When calling refine_mesh_3(), the input `c3t3` should have been initialized and have " + "at least one facet in the complex. Try to solve this issue using :\n" + "\t- The automatic initialization provided by make_mesh_3()\n" + "\t- Adding more and better chosen points on the input surface\n"); + } }