cgal icon indicating copy to clipboard operation
cgal copied to clipboard

make_mesh_3,refine_mesh_3, then precondition failure in the pertuber

Open lrineau opened this issue 2 years ago • 1 comments

If one takes that example:

https://github.com/CGAL/cgal/blob/3b8666323e3daa76227b7ff178d889f375c83737/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp

with a slight change:

diff --git a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp
index eac3d9a4701..f725e5459f3 100644
--- a/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp
+++ b/Mesh_3/examples/Mesh_3/mesh_polyhedral_domain_sm.cpp
@@ -56,7 +56,7 @@ int main(int argc, char*argv[])
                                  cell_radius_edge_ratio(3));
 
   // Mesh generation
-  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, params::no_perturb().no_exude());
+  C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria);
 
   // Output
   std::ofstream medit_file("out_1.mesh");

Then the execution fails with an assertion:

terminate called after throwing an instance of 'CGAL::Precondition_exception'
  what():  CGAL ERROR: precondition violation!
Expr: !Mesh_3::internal::has_non_protecting_weights(c3t3.triangulation(), domain)
File: /home/lrineau/Git/cgal-master/Mesh_3/include/CGAL/perturb_mesh_3.h
Line: 170
zsh: IOT instruction (core dumped)  ./mesh_polyhedral_domain_sm

The reason is that the first make_mesh_3 calls the exuder, and then in the second pass (refine_mesh_3), the perturber complains that the triangulation has weighted points outside 1D-features.

That is probably the documented behavior, but is it the wanted behavior? If the user call refine_mesh_3 with "default parameters", without setting reset_c3t3, should not it work?

(To discuss with @janetournois.)

lrineau avatar Nov 27 '23 14:11 lrineau

After local discussion, we concluded that :

  • using reset_c3t3() is not a good idea, because it copies the full triangulation
  • it should be mentioned in the precondition, as a message, that is possible to use refine_mesh_3() after make_mesh_3() and even after exude_mesh_3(), provided reset_c3t3() is used

janetournois avatar Nov 27 '23 14:11 janetournois