diff --git a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h index 36d57935a4d..eef7058ba6d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h +++ b/Mesh_3/include/CGAL/Mesh_3/Protect_edges_sizing_field.h @@ -1197,6 +1197,7 @@ insert_balls(const Vertex_handle& vp, dim, index, out); + if(forced_stop()) return out; const Vertex_handle new_vertex = pair.first; out = pair.second; const FT sn = get_radius(new_vertex); @@ -1835,6 +1836,7 @@ walk_along_edge(const Vertex_handle& start, const Vertex_handle& next, // and current intersects enough while ( ! is_sampling_dense_enough(previous, current, curve_index, orientation) ) { + if(forced_stop()) return out; *out++ = current; // Don't go through corners @@ -1943,6 +1945,7 @@ repopulate(InputIterator begin, InputIterator last, #endif // CGAL_MESH_3_PROTECTION_DEBUG *out++ = *current; c3t3_.triangulation().remove(*current); + if(forced_stop()) return out; } // Repopulate edge diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 6b6e9cb3353..8c40a8c05cd 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -197,7 +197,13 @@ template < typename C3T3, typename MeshDomain, typename MeshCriteria> void init_c3t3_with_features(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria& criteria, - bool nonlinear = false) + bool nonlinear = false, + std::size_t maximal_number_of_vertices = 0, + Mesh_error_code* pointer_to_error_code = 0 +#ifndef CGAL_NO_ATOMIC + , CGAL::cpp11::atomic* pointer_to_stop = 0 +#endif + ) { typedef typename MeshCriteria::Edge_criteria Edge_criteria; typedef Edge_criteria_sizing_field_wrapper Sizing_field; @@ -206,7 +212,12 @@ void init_c3t3_with_features(C3T3& c3t3, protect_edges(c3t3, domain, Sizing_field(criteria.edge_criteria_object()), - typename Edge_criteria::FT() + typename Edge_criteria::FT(), + maximal_number_of_vertices, + pointer_to_error_code +#ifndef CGAL_NO_ATOMIC + , pointer_to_stop +#endif ); protect_edges.set_nonlinear_growth_of_balls(nonlinear); @@ -234,7 +245,13 @@ struct C3t3_initializer_base { return Mesh_3::internal::init_c3t3_with_features (c3t3, domain, criteria, - mesh_options.nonlinear_growth_of_balls); + mesh_options.nonlinear_growth_of_balls, + mesh_options.maximal_number_of_vertices, + mesh_options.pointer_to_error_code +#ifndef CGAL_NO_ATOMIC + , mesh_options.pointer_to_stop_atomic_boolean +#endif + ); } }; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h index 0408113e335..0188d438c2b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Mesh_3/Mesh_function.h @@ -136,8 +136,8 @@ private: private: boost::any object_to_destroy; C3t3& c3t3_; - Domain* domain_; - Mesh_parameters p_; + Domain* const domain_; + Mesh_parameters const p_; std::atomic stop_; Mesher* mesher_; #ifdef CGAL_MESH_3_MESHER_STATUS_ACTIVATED @@ -237,6 +237,7 @@ Mesh_function:: initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag) // for the other domain types { + namespace p = CGAL::parameters; // Initialization of the mesh, either with the protection of sharp // features, or with the initial points (or both). // If `detect_connected_components==true`, the initialization is @@ -250,7 +251,9 @@ initialize(const Mesh_criteria& criteria, Mesh_fnt::Domain_tag) *domain_, criteria, p_.protect_features, - p_.use_sizing_field_with_aabb_tree); + p::mesh_3_options(p::pointer_to_stop_atomic_boolean = &stop_, + p::nonlinear_growth_of_balls = + p_.use_sizing_field_with_aabb_tree)); } template < typename D_, typename Tag >