From da0635e4b1e62cfc8b58d2faf1a9006b36ee0494 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Mon, 20 Jul 2020 17:03:28 +0200 Subject: [PATCH 001/178] result_of changed to decltype --- Filtered_kernel/include/CGAL/Lazy.h | 1 + Kernel_23/examples/Kernel_23/MyKernel.cpp | 3 +- .../Kernel_23/cartesian_converter.cpp | 3 +- .../examples/Kernel_23/intersection_get.cpp | 3 +- .../Kernel_23/intersection_visitor.cpp | 6 +--- .../examples/Kernel_23/intersections.cpp | 3 +- Kernel_23/include/CGAL/Bbox_3.h | 1 - Kernel_23/include/CGAL/Circle_2.h | 5 ++-- Kernel_23/include/CGAL/Circle_3.h | 6 ++-- Kernel_23/include/CGAL/Direction_2.h | 7 ++--- Kernel_23/include/CGAL/Direction_3.h | 9 +++--- Kernel_23/include/CGAL/Iso_cuboid_3.h | 26 ++++++++--------- Kernel_23/include/CGAL/Iso_rectangle_2.h | 21 +++++++------- .../include/CGAL/Kernel/function_objects.h | 14 ++++----- Kernel_23/include/CGAL/Kernel_checker.h | 12 +++----- Kernel_23/include/CGAL/Plane_3.h | 9 +++--- Kernel_23/include/CGAL/Point_2.h | 17 +++++------ Kernel_23/include/CGAL/Point_3.h | 18 ++++++------ Kernel_23/include/CGAL/Ray_2.h | 7 ++--- Kernel_23/include/CGAL/Ray_3.h | 9 +++--- Kernel_23/include/CGAL/Segment_2.h | 29 +++++++++---------- Kernel_23/include/CGAL/Segment_3.h | 24 +++++++-------- Kernel_23/include/CGAL/Sphere_3.h | 2 +- Kernel_23/include/CGAL/Tetrahedron_3.h | 6 ++-- Kernel_23/include/CGAL/Triangle_2.h | 5 ++-- Kernel_23/include/CGAL/Triangle_3.h | 4 +-- Kernel_23/include/CGAL/Vector_2.h | 17 +++++------ Kernel_23/include/CGAL/Vector_3.h | 23 +++++++-------- Kernel_23/include/CGAL/Weighted_point_2.h | 19 ++++++------ Kernel_23/include/CGAL/Weighted_point_3.h | 22 +++++++------- Kernel_23/include/CGAL/basic.h | 5 ---- .../CGAL/_test_all_linear_intersections.h | 9 ++---- 32 files changed, 153 insertions(+), 192 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 067fbe57463..559e9daea55 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/Kernel_23/examples/Kernel_23/MyKernel.cpp b/Kernel_23/examples/Kernel_23/MyKernel.cpp index 7f0b862067a..13eec454b3d 100644 --- a/Kernel_23/examples/Kernel_23/MyKernel.cpp +++ b/Kernel_23/examples/Kernel_23/MyKernel.cpp @@ -56,8 +56,7 @@ int main() K::Intersect_2 intersection; - CGAL::cpp11::result_of::type - intersect = intersection(s1, s2); + const auto intersect = intersection(s1, s2); K::Construct_cartesian_const_iterator_2 construct_it; K::Cartesian_const_iterator_2 cit = construct_it(a); diff --git a/Kernel_23/examples/Kernel_23/cartesian_converter.cpp b/Kernel_23/examples/Kernel_23/cartesian_converter.cpp index 63c49c37585..ebd4343d304 100644 --- a/Kernel_23/examples/Kernel_23/cartesian_converter.cpp +++ b/Kernel_23/examples/Kernel_23/cartesian_converter.cpp @@ -25,8 +25,7 @@ int main(){ EK::Triangle_3 t2=to_exact(t1); EK::Line_3 l2=to_exact(l1); - CGAL::cpp11::result_of::type - inter = CGAL::intersection(t2,l2); + const auto inter = CGAL::intersection(t2,l2); // As we are sure that there IS an intersection // and that the intersection IS a point diff --git a/Kernel_23/examples/Kernel_23/intersection_get.cpp b/Kernel_23/examples/Kernel_23/intersection_get.cpp index 2e6c66cec4f..ff2332a153c 100644 --- a/Kernel_23/examples/Kernel_23/intersection_get.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_get.cpp @@ -12,8 +12,7 @@ int main() Segment_2 seg(Point_2(0,0), Point_2(2,2)); Line_2 lin(1,-1,0); - CGAL::cpp11::result_of::type - result = intersection(seg, lin); + const auto result = intersection(seg, lin); if (result) { if (const Segment_2* s = boost::get(&*result)) { std::cout << *s << std::endl; diff --git a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp index 1c511387b65..ffe5c09c7d8 100644 --- a/Kernel_23/examples/Kernel_23/intersection_visitor.cpp +++ b/Kernel_23/examples/Kernel_23/intersection_visitor.cpp @@ -26,11 +26,7 @@ int main() Segment_2 seg(Point_2(0,0), Point_2(1,1)); Line_2 lin(1,-1,0); - // with C++11 support - // auto result = intersection(seg, lin); - // without C++11 - CGAL::cpp11::result_of::type - result = intersection(seg, lin); + const auto result = intersection(seg, lin); if (result) { boost::apply_visitor(Intersection_visitor(), *result); } else { diff --git a/Kernel_23/examples/Kernel_23/intersections.cpp b/Kernel_23/examples/Kernel_23/intersections.cpp index 283fd5b9aad..193e77c292d 100644 --- a/Kernel_23/examples/Kernel_23/intersections.cpp +++ b/Kernel_23/examples/Kernel_23/intersections.cpp @@ -15,13 +15,12 @@ typedef CGAL::Creator_uniform_2< Point, Segment> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; struct Intersector{ - typedef CGAL::cpp11::result_of::type result_type; const Segment& s; K::Intersect_2 intersect; Intersector(const Segment& seg): s(seg) {} - result_type + decltype(auto) operator() ( const Segment& other) const { return intersect(s, other); diff --git a/Kernel_23/include/CGAL/Bbox_3.h b/Kernel_23/include/CGAL/Bbox_3.h index 1e5bb0d8eb9..2f5b6e49425 100644 --- a/Kernel_23/include/CGAL/Bbox_3.h +++ b/Kernel_23/include/CGAL/Bbox_3.h @@ -18,7 +18,6 @@ #include #include -#include #include #include #include diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index c9522d24c02..a1cc8092654 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -24,7 +24,6 @@ #include #include #include -#include namespace CGAL { @@ -89,13 +88,13 @@ public: Circle_2(const Point_2 & center) : RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {} - typename cpp11::result_of::type + decltype(auto) center() const { return R().construct_center_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) squared_radius() const { return R().compute_squared_radius_2_object()(*this); diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index e2c5c6c9adc..0b42941a064 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -93,8 +93,7 @@ public: Circle_3(const Rep& r) : Rep(r) {} - typename cpp11::result_of - ::type + decltype(auto) diametral_sphere() const { return typename R::Construct_sphere_3()(*this); @@ -110,8 +109,7 @@ public: return typename R::Construct_sphere_3()(*this).squared_radius(); } - typename cpp11::result_of - ::type + decltype(auto) supporting_plane() const { return typename R::Construct_plane_3()(*this); diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index 6517028cfa0..37f1196d794 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace CGAL { @@ -93,19 +92,19 @@ public: return R().construct_perpendicular_direction_2_object()(*this,o); } - typename cpp11::result_of::type + decltype(auto) dx() const { return R().compute_dx_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) dy() const { return R().compute_dy_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) delta(int i) const { CGAL_kernel_precondition( ( i == 0 ) || ( i == 1 ) ); diff --git a/Kernel_23/include/CGAL/Direction_3.h b/Kernel_23/include/CGAL/Direction_3.h index 3c491375d03..77be97c63be 100644 --- a/Kernel_23/include/CGAL/Direction_3.h +++ b/Kernel_23/include/CGAL/Direction_3.h @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace CGAL { @@ -99,25 +98,25 @@ public: Vector_3 vector() const { return to_vector(); } - typename cpp11::result_of::type + decltype(auto) dx() const { return R().compute_dx_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) dy() const { return R().compute_dy_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) dz() const { return R().compute_dz_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) delta(int i) const { CGAL_kernel_precondition( i >= 0 && i <= 2 ); diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index 0dd33eb0b9f..9c241a184ec 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -86,67 +86,67 @@ public: : Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.zmin(), bbox.xmax(), bbox.ymax(), bbox.zmax())) {} - typename cpp11::result_of::type + decltype(auto) min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_min_vertex_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_max_vertex_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_3_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return R().construct_vertex_3_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) xmin() const { return R().compute_xmin_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) xmax() const { return R().compute_xmax_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymin() const { return R().compute_ymin_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymax() const { return R().compute_ymax_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) zmin() const { return R().compute_zmin_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) zmax() const { return R().compute_zmax_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) min_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 ); @@ -158,7 +158,7 @@ public: return zmin(); } - typename cpp11::result_of::type + decltype(auto) max_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 ); @@ -206,7 +206,7 @@ public: return R().is_degenerate_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) volume() const { return R().compute_volume_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 187b9df2b86..10041882ce5 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -22,7 +22,6 @@ #include #include #include -#include namespace CGAL { @@ -82,13 +81,13 @@ public: Iso_rectangle_2(const Bbox_2& bbox) : Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.xmax(), bbox.ymax())) {} - typename cpp11::result_of::type + decltype(auto) min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_min_vertex_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return R().construct_max_vertex_2_object()(*this); @@ -107,43 +106,43 @@ public: } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_2_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return R().construct_vertex_2_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) xmin() const { return R().compute_xmin_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) xmax() const { return R().compute_xmax_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymin() const { return R().compute_ymin_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) ymax() const { return R().compute_ymax_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) min_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 ); @@ -153,7 +152,7 @@ public: return ymin(); } - typename cpp11::result_of::type + decltype(auto) max_coord(int i) const { CGAL_kernel_precondition( i == 0 || i == 1 ); diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index cd335df94fc..c3c3537838e 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -1682,8 +1682,7 @@ namespace CommonKernelFunctors { Line l1 = construct_line(l11, l12); Line l2 = construct_line(l21, l22); - typename cpp11::result_of::type - res = typename K::Intersect_3()(l1,l2); + const auto res = typename K::Intersect_3()(l1,l2); CGAL_assertion(res!=boost::none); const Point* e_pt = boost::get(&(*res)); CGAL_assertion(e_pt!=nullptr); @@ -2082,8 +2081,7 @@ namespace CommonKernelFunctors { Plane plane = construct_plane(p1, p2, p3); Line line = construct_line( l1, l2 ); - typename cpp11::result_of::type - res = typename K::Intersect_3()(plane,line); + const auto res = typename K::Intersect_3()(plane,line); CGAL_assertion(res!=boost::none); const Point* e_pt = boost::get(&(*res)); CGAL_assertion(e_pt!=nullptr); @@ -2096,8 +2094,7 @@ namespace CommonKernelFunctors { { Line line = construct_line( l1, l2 ); - typename cpp11::result_of::type - res = typename K::Intersect_3()(plane,line); + const auto res = typename K::Intersect_3()(plane,line); CGAL_assertion(res!=boost::none); const Point* e_pt = boost::get(&(*res)); CGAL_assertion(e_pt!=nullptr); @@ -3328,8 +3325,7 @@ namespace CommonKernelFunctors { if(!K().do_intersect_3_object()(s1, s2)) return false; const Circle_3 circ(s1, s2); const Plane_3& plane = circ.supporting_plane(); - typename CGAL::cpp11::result_of::type - optional = K().intersect_3_object()(plane, Segment_3(a, b)); + const auto optional = K().intersect_3_object()(plane, Segment_3(a, b)); CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting" " plane"); @@ -3558,7 +3554,7 @@ namespace CommonKernelFunctors { // n possibilities, so I keep the template. template - typename cpp11::result_of< Intersect_3(T1, T2) >::type + decltype(auto) operator()(const T1& t1, const T2& t2) const { return Intersections::internal::intersection(t1, t2, K() ); } diff --git a/Kernel_23/include/CGAL/Kernel_checker.h b/Kernel_23/include/CGAL/Kernel_checker.h index b16a3d4806c..a4753265266 100644 --- a/Kernel_23/include/CGAL/Kernel_checker.h +++ b/Kernel_23/include/CGAL/Kernel_checker.h @@ -21,7 +21,6 @@ // This file contains the definition of a kernel traits checker. #include -#include #include #include @@ -80,19 +79,16 @@ public: { } template - typename Pairify::type, - typename CGAL::cpp11::result_of::type>::result_type + decltype(auto) operator()(const A&... a) const { - typedef typename CGAL::cpp11::result_of::type result_type_1; - typedef typename CGAL::cpp11::result_of::type result_type_2; - result_type_1 res1 = p1(a.first...); - result_type_2 res2 = p2(a.second...); + auto res1 = p1(a.first...); + auto res2 = p2(a.second...); if (! cmp(res1, res2)) { CGAL_kernel_assertion(false); } - return Pairify()(res1, res2); + return Pairify()(res1, res2); } }; diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index 1cb4aaff9bb..659cde8d50b 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -21,7 +21,6 @@ #include #include #include -#include #include namespace CGAL { @@ -107,25 +106,25 @@ public: return Direction_3(a(), b(), c()); } - typename cpp11::result_of::type + decltype(auto) a() const { return R().compute_a_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) b() const { return R().compute_b_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) c() const { return R().compute_c_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) d() const { return R().compute_d_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index 7358d0dc46b..1d4403354b7 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -24,7 +24,6 @@ #include #include #include -#include namespace CGAL { @@ -93,26 +92,26 @@ public: swap(a.rep(), b.rep()); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_2()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_2()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); return (i==0) ? x() : y(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); @@ -129,19 +128,19 @@ public: } - typename cpp11::result_of::type + decltype(auto) hx() const { return typename R::Compute_hx_2()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return typename R::Compute_hy_2()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return typename R::Compute_hw_2()(*this); @@ -152,7 +151,7 @@ public: return 2; } - typename cpp11::result_of::type + decltype(auto) homogeneous(int i) const { CGAL_kernel_precondition( (i >= 0) || (i <= 2) ); diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 01b07bd3e0e..a8487afeb38 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -90,49 +90,49 @@ public: swap(a.rep(), b.rep()); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_3()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_3()(*this); } - typename cpp11::result_of::type + decltype(auto) z() const { return typename R::Compute_z_3()(*this); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hz() const { return R().compute_hz_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); @@ -151,7 +151,7 @@ public: return hw(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index b0568ee2cd3..732ea145918 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace CGAL { @@ -81,13 +80,13 @@ public: : RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, l)) {} - typename cpp11::result_of::type + decltype(auto) source() const { return R().construct_source_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) second_point() const { return R().construct_second_point_2_object()(*this); @@ -108,7 +107,7 @@ public: construct_scaled_vector(construct_vector(source(), second_point()), i)); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index 242edee56c5..6854f30a46f 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -22,7 +22,6 @@ #include #include #include -#include #include namespace CGAL { @@ -99,25 +98,25 @@ public: bool collinear_has_on(const Point_3 &p) const; */ - typename cpp11::result_of::type + decltype(auto) point(const FT i) const { return R().construct_point_on_3_object()(*this, i); } - typename cpp11::result_of::type + decltype(auto) source() const { return R().construct_source_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) second_point() const { return R().construct_second_point_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index a318f285648..acb75fd5374 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -23,7 +23,6 @@ #include #include #include -#include namespace CGAL { @@ -70,44 +69,44 @@ public: Segment_2(const Point_2 &sp, const Point_2 &ep) : RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {} - typename cpp11::result_of::type + decltype(auto) source() const { return R_().construct_source_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return R_().construct_target_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); } - typename cpp11::result_of::type + decltype(auto) end() const { return target(); } - typename cpp11::result_of::type + decltype(auto) min BOOST_PREVENT_MACRO_SUBSTITUTION() const; - typename cpp11::result_of::type + decltype(auto) max BOOST_PREVENT_MACRO_SUBSTITUTION () const; - typename cpp11::result_of::type + decltype(auto) vertex(int i) const; - typename cpp11::result_of::type + decltype(auto) point(int i) const; - typename cpp11::result_of::type + decltype(auto) operator[](int i) const; bool is_horizontal() const; @@ -172,7 +171,7 @@ public: template < class R_ > CGAL_KERNEL_INLINE -typename cpp11::result_of )>::type +decltype(auto) Segment_2::min BOOST_PREVENT_MACRO_SUBSTITUTION () const { typename R_::Less_xy_2 less_xy; @@ -181,7 +180,7 @@ Segment_2::min BOOST_PREVENT_MACRO_SUBSTITUTION () const template < class R_ > CGAL_KERNEL_INLINE -typename cpp11::result_of )>::type +decltype(auto) Segment_2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const { typename R_::Less_xy_2 less_xy; @@ -190,7 +189,7 @@ Segment_2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const template < class R_ > CGAL_KERNEL_INLINE -typename cpp11::result_of, int )>::type +decltype(auto) Segment_2::vertex(int i) const { return (i%2 == 0) ? source() : target(); @@ -198,7 +197,7 @@ Segment_2::vertex(int i) const template < class R_ > inline -typename cpp11::result_of, int )>::type +decltype(auto) Segment_2::point(int i) const { return vertex(i); @@ -206,7 +205,7 @@ Segment_2::point(int i) const template < class R_ > inline -typename cpp11::result_of, int )>::type +decltype(auto) Segment_2::operator[](int i) const { return vertex(i); diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index da8783d67fb..9bece158b35 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -68,44 +68,44 @@ public: Segment_3(const Point_3& sp, const Point_3& ep) : Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {} - typename cpp11::result_of::type + decltype(auto) source() const { return R_().construct_source_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return R_().construct_target_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) start() const { return source(); } - typename cpp11::result_of::type + decltype(auto) end() const { return target(); } - typename cpp11::result_of::type + decltype(auto) min BOOST_PREVENT_MACRO_SUBSTITUTION () const; - typename cpp11::result_of::type + decltype(auto) max BOOST_PREVENT_MACRO_SUBSTITUTION () const; - typename cpp11::result_of::type + decltype(auto) vertex(int i) const; - typename cpp11::result_of::type + decltype(auto) point(int i) const { return vertex(i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); } @@ -163,7 +163,7 @@ public: template < class R_ > CGAL_KERNEL_INLINE -typename cpp11::result_of ) >::type +decltype(auto) Segment_3::min BOOST_PREVENT_MACRO_SUBSTITUTION () const { typename R_::Less_xyz_3 less_xyz; @@ -172,7 +172,7 @@ Segment_3::min BOOST_PREVENT_MACRO_SUBSTITUTION () const template < class R_ > CGAL_KERNEL_INLINE -typename cpp11::result_of ) >::type +decltype(auto) Segment_3::max BOOST_PREVENT_MACRO_SUBSTITUTION () const { typename R_::Less_xyz_3 less_xyz; @@ -181,7 +181,7 @@ Segment_3::max BOOST_PREVENT_MACRO_SUBSTITUTION () const template < class R_ > CGAL_KERNEL_INLINE -typename cpp11::result_of, int ) >::type +decltype(auto) Segment_3::vertex(int i) const { return (i%2 == 0) ? source() : target(); diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index 8e9076b6c3c..246801a068e 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -86,7 +86,7 @@ public: Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const; - typename cpp11::result_of::type + decltype(auto) center() const { return R().construct_center_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index 5916902e060..634e73434da 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -70,13 +70,13 @@ public: t.transform(this->vertex(3))); } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_3_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); @@ -128,7 +128,7 @@ public: return R().has_on_unbounded_side_3_object()(*this, p); } - typename cpp11::result_of::type + decltype(auto) volume() const { return R().compute_volume_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index 7bd394e10f3..5cc5aa97cad 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -22,7 +22,6 @@ #include #include #include -#include #include namespace CGAL { @@ -101,13 +100,13 @@ public: return !(*this == t); } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_2_object()(*this,i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 61a310fb5fe..7999ca64f82 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -82,13 +82,13 @@ public: } - typename cpp11::result_of::type + decltype(auto) vertex(int i) const { return R().construct_vertex_3_object()(*this, i); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return vertex(i); diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index fed404db54b..8c08dfd29d5 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace CGAL { @@ -103,26 +102,26 @@ public: } - typename cpp11::result_of::type + decltype(auto) x() const { return R().compute_x_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return R().compute_y_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); return (i==0) ? x() : y(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); @@ -138,26 +137,26 @@ public: return typename R::Construct_cartesian_const_iterator_2()(*this,2); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_2_object()(*this); } - typename cpp11::result_of::type + decltype(auto) homogeneous(int i) const { CGAL_kernel_precondition( (i >= 0) || (i <= 2) ); diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index 9304ca4701b..681e3ec7ceb 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -25,7 +25,6 @@ #include #include #include -#include #include namespace CGAL { @@ -173,49 +172,49 @@ public: return *this; } - typename cpp11::result_of::type + decltype(auto) x() const { return R().compute_x_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) y() const { return R().compute_y_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) z() const { return R().compute_z_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hz() const { return R().compute_hz_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_3_object()(*this); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); @@ -224,7 +223,7 @@ public: return z(); } - typename cpp11::result_of::type + decltype(auto) homogeneous(int i) const { CGAL_kernel_precondition( (i >= 0) || (i <= 3) ); @@ -239,7 +238,7 @@ public: return 3; } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); @@ -255,7 +254,7 @@ public: return typename R::Construct_cartesian_const_iterator_3()(*this,3); } - typename cpp11::result_of::type + decltype(auto) squared_length() const { return R().compute_squared_length_3_object()(*this); diff --git a/Kernel_23/include/CGAL/Weighted_point_2.h b/Kernel_23/include/CGAL/Weighted_point_2.h index 0b9919d784b..fc6dd9ff44b 100644 --- a/Kernel_23/include/CGAL/Weighted_point_2.h +++ b/Kernel_23/include/CGAL/Weighted_point_2.h @@ -24,7 +24,6 @@ #include #include #include -#include #include namespace CGAL { @@ -83,50 +82,50 @@ public: : Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y)) {} - typename cpp11::result_of::type + decltype(auto) point() const { return typename R::Construct_point_2()(*this); } - typename cpp11::result_of::type + decltype(auto) weight() const { return typename R::Compute_weight_2()(*this); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_2()(point()); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_2()(point()); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_2_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_2_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_2_object()(point()); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) ); @@ -143,7 +142,7 @@ public: return hw(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); diff --git a/Kernel_23/include/CGAL/Weighted_point_3.h b/Kernel_23/include/CGAL/Weighted_point_3.h index e03a8b651b3..548614a9e79 100644 --- a/Kernel_23/include/CGAL/Weighted_point_3.h +++ b/Kernel_23/include/CGAL/Weighted_point_3.h @@ -84,62 +84,62 @@ public: : Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z)) {} - typename cpp11::result_of::type + decltype(auto) point() const { return typename R::Construct_point_3()(*this); } - typename cpp11::result_of::type + decltype(auto) weight() const { return typename R::Compute_weight_3()(*this); } - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_x_3()(point()); } - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_y_3()(point()); } - typename cpp11::result_of::type + decltype(auto) z() const { return typename R::Compute_z_3()(point()); } - typename cpp11::result_of::type + decltype(auto) hx() const { return R().compute_hx_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hy() const { return R().compute_hy_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hz() const { return R().compute_hz_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) hw() const { return R().compute_hw_3_object()(point()); } - typename cpp11::result_of::type + decltype(auto) cartesian(int i) const { CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) ); @@ -158,7 +158,7 @@ public: return hw(); } - typename cpp11::result_of::type + decltype(auto) operator[](int i) const { return cartesian(i); diff --git a/Kernel_23/include/CGAL/basic.h b/Kernel_23/include/CGAL/basic.h index 7a9f0a31771..7c6e2768bae 100644 --- a/Kernel_23/include/CGAL/basic.h +++ b/Kernel_23/include/CGAL/basic.h @@ -23,11 +23,6 @@ #include #include -// This cannot be disabled for now until we have a clear idea which -// compilers implement N3276. - -#include - #include #include #include diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h index 92278176ca6..4d2b09ac3b2 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_all_linear_intersections.h @@ -17,8 +17,7 @@ template void test_2d(const T1& t1, const T2& t2) { CGAL::Cartesian_converter convert; - typename CGAL::cpp11::result_of::type res1 = - CGAL::intersection(t1, t2); + const auto res1 = CGAL::intersection(t1, t2); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); } @@ -26,8 +25,7 @@ template void test_3d(const T1& t1, const T2& t2) { CGAL::Cartesian_converter convert; - typename CGAL::cpp11::result_of::type res1 = - CGAL::intersection(t1, t2); + const auto res1 = CGAL::intersection(t1, t2); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); } @@ -112,7 +110,6 @@ void test_linear_intersections() test_3d(triangle_3, triangle_3); CGAL::Cartesian_converter convert; - typename CGAL::cpp11::result_of::type res1 = - CGAL::intersection(plane_3, plane_3, plane_3); + const auto res1 = CGAL::intersection(plane_3, plane_3, plane_3); assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) ); } From eb2f7e5b90f8a047f2acd35c9d1b5f4170ceb488 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Wed, 22 Jul 2020 14:24:56 +0200 Subject: [PATCH 002/178] kernel_23 doc typo fixes --- Kernel_23/doc/Kernel_23/CGAL/intersections.h | 6 +++--- Kernel_23/doc/Kernel_23/Kernel_23.txt | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Kernel_23/doc/Kernel_23/CGAL/intersections.h b/Kernel_23/doc/Kernel_23/CGAL/intersections.h index 47155df7898..7421c3e57f6 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/intersections.h @@ -95,7 +95,7 @@ The following tables give the possible values for `Type1` and `Type2`. \cgalHeading{2D Intersections} -The return type can be obtained through `CGAL::cpp11::result_of::%type`. +The return type can be obtained through `cpp11::result_of::%type`. It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack.
@@ -191,7 +191,7 @@ intersections existing with the type `Iso_rectangle_2`. Note that the return typ \cgalHeading{3D Intersections} -The return type can be obtained through `CGAL::cpp11::result_of::%type`. +The return type can be obtained through `cpp11::result_of::%type`. It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack.
@@ -350,7 +350,7 @@ The following examples demonstrate the most common use of `intersection()` functions with the 2D and 3D Linear %Kernel. In the first two examples we intersect a segment and a line. -The result type can be obtained with `CGAL::cpp11::result_of`. It looks simpler +The result type can be obtained with `cpp11::result_of`. It looks simpler if you use a C++ compiler which supports `auto`, but you must anyways know that the result type is a `boost::optional >`, in order to unpack the point or segment. diff --git a/Kernel_23/doc/Kernel_23/Kernel_23.txt b/Kernel_23/doc/Kernel_23/Kernel_23.txt index 0947dbecd5e..c624cc64db8 100644 --- a/Kernel_23/doc/Kernel_23/Kernel_23.txt +++ b/Kernel_23/doc/Kernel_23/Kernel_23.txt @@ -498,8 +498,8 @@ in a type-safe way \cgal uses return values of type `boost::optional< boost::variant< T... > >` were `T...` is a list of all possible resulting geometric objects. The exact result type of an intersection can be determined through the metafunction -`cpp11::result_of` or -`cpp11::result_of`, where +`CGAL::cpp11::result_of` or +`CGAL::cpp11::result_of`, where `Type1` and `Type2` are the types of the objects used in the intersection computation. @@ -525,7 +525,7 @@ std::cin >> segment_1 >> segment_2; // auto v = intersection(segment_1, segment_2); /* C++03 */ -cpp11::result_of::type +CGAL::cpp11::result_of::type v = intersection(segment_1, segment_2); if(v) { /* not empty */ From 059bc6062d6a91c3aa3bd7dce0664b6746b2611b Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Wed, 22 Jul 2020 15:13:09 +0200 Subject: [PATCH 003/178] circular kernel 2 result_of to decltype --- Circular_kernel_2/include/CGAL/Circular_arc_2.h | 15 +++++++-------- .../include/CGAL/Circular_arc_point_2.h | 7 ++----- .../CGAL/Circular_kernel_2/Circular_arc_2.h | 4 ++-- .../function_objects_polynomial_circular.h | 4 ++-- Circular_kernel_2/include/CGAL/Line_arc_2.h | 9 ++++----- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_2.h index 54be46b256a..37f94cf45fe 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_2.h @@ -22,7 +22,6 @@ #include -#include #include #include namespace CGAL { @@ -107,25 +106,25 @@ public: {} - typename cpp11::result_of::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_2()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_2()(*this); } - typename cpp11::result_of::type + decltype(auto) left() const { return typename R::Construct_circular_min_vertex_2()(*this); } - typename cpp11::result_of::type + decltype(auto) right() const { return typename R::Construct_circular_max_vertex_2()(*this); @@ -141,19 +140,19 @@ public: return typename R::Is_y_monotone_2()(*this); } - typename cpp11::result_of::type + decltype(auto) supporting_circle() const { return typename R::Construct_circle_2()(*this); } - typename cpp11::result_of::type + decltype(auto) center() const { return typename R::Construct_center_2()(*this); } - typename cpp11::result_of::type + decltype(auto) squared_radius() const { return typename R::Compute_squared_radius_2()(*this); diff --git a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h index 99cfbbfeced..8dbadf1ebcf 100644 --- a/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_arc_point_2.h @@ -21,7 +21,6 @@ #include -#include #include #include @@ -72,15 +71,13 @@ public: : RCircular_arc_point_2(typename R::Construct_circular_arc_point_2()(p)) {} - typename - cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_circular_x_2()(*this); } - typename - cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_circular_y_2()(*this); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h index f6ef588c083..4288ef1657b 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h @@ -639,13 +639,13 @@ public: return _support; } - typename cpp11::result_of::type + decltype(auto) center() const { return supporting_circle().center(); } - typename cpp11::result_of::type + decltype(auto) squared_radius() const { return supporting_circle().squared_radius(); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index fe78f2e6e5c..75b4350bf30 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -1307,7 +1307,7 @@ namespace CircularFunctors { typedef typename cpp11::result_of::type type; }; - typename cpp11::result_of::type + decltype(auto) operator()( const Circle_2& c) const { return LK_Compute_squared_radius_2()(c); } @@ -1320,7 +1320,7 @@ namespace CircularFunctors { FT operator()( const Point_2& p, const Point_2& q, const Point_2& r) const { return LK_Compute_squared_radius_2()(p, q, r); } - typename cpp11::result_of::type + decltype(auto) operator()(const Circular_arc_2& c) const { return c.rep().squared_radius(); } diff --git a/Circular_kernel_2/include/CGAL/Line_arc_2.h b/Circular_kernel_2/include/CGAL/Line_arc_2.h index 3bd75815e8c..deb4cecc458 100644 --- a/Circular_kernel_2/include/CGAL/Line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Line_arc_2.h @@ -21,7 +21,6 @@ #include -#include #include namespace CGAL { @@ -91,25 +90,25 @@ public: : RLine_arc_2(a) {} - typename cpp11::result_of< typename R::Construct_circular_source_vertex_2(Line_arc_2)>::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_2()(*this); } - typename cpp11::result_of< typename R::Construct_circular_target_vertex_2(Line_arc_2)>::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_2()(*this); } - typename cpp11::result_of< typename R::Construct_circular_min_vertex_2(Line_arc_2)>::type + decltype(auto) left() const { return typename R::Construct_circular_min_vertex_2()(*this); } - typename cpp11::result_of< typename R::Construct_circular_max_vertex_2(Line_arc_2)>::type + decltype(auto) right() const { return typename R::Construct_circular_max_vertex_2()(*this); From acdf4c6beed88832b4d84642ac3e5e600be66bf3 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Wed, 22 Jul 2020 15:23:09 +0200 Subject: [PATCH 004/178] circular kernel 3 result_of to decltype --- Circular_kernel_3/include/CGAL/Circular_arc_3.h | 7 +++---- Circular_kernel_3/include/CGAL/Circular_arc_point_3.h | 7 +++---- Circular_kernel_3/include/CGAL/Line_arc_3.h | 11 +++++------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Circular_kernel_3/include/CGAL/Circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_arc_3.h index 86c0756bda4..6843fac6003 100644 --- a/Circular_kernel_3/include/CGAL/Circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_arc_3.h @@ -20,7 +20,6 @@ #include -#include #include namespace CGAL { @@ -117,19 +116,19 @@ namespace CGAL { : RCircular_arc_3(a) {} - typename cpp11::result_of::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) supporting_circle() const { return typename R::Construct_circle_3()(*this); diff --git a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h index 36c0ed41c18..f9f941d2d8b 100644 --- a/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_arc_point_3.h @@ -20,7 +20,6 @@ #include -#include #include #include @@ -196,15 +195,15 @@ public: - typename cpp11::result_of::type + decltype(auto) x() const { return typename R::Compute_circular_x_3()(*this);} - typename cpp11::result_of::type + decltype(auto) y() const { return typename R::Compute_circular_y_3()(*this);} - typename cpp11::result_of::type + decltype(auto) z() const { return typename R::Compute_circular_z_3()(*this);} diff --git a/Circular_kernel_3/include/CGAL/Line_arc_3.h b/Circular_kernel_3/include/CGAL/Line_arc_3.h index e2413b1317c..f9955774c9b 100644 --- a/Circular_kernel_3/include/CGAL/Line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Line_arc_3.h @@ -20,7 +20,6 @@ #include -#include #include @@ -122,31 +121,31 @@ namespace CGAL { : RLine_arc_3(a) {} - typename cpp11::result_of::type + decltype(auto) source() const { return typename R::Construct_circular_source_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) target() const { return typename R::Construct_circular_target_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) lower_xyz_extremity() const { return typename R::Construct_circular_min_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) higher_xyz_extremity() const { return typename R::Construct_circular_max_vertex_3()(*this); } - typename cpp11::result_of::type + decltype(auto) supporting_line() const { return typename R::Construct_line_3()(*this); From 4b187338210ce32c8bb04ea56f8f4f508636019e Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Wed, 22 Jul 2020 16:19:15 +0200 Subject: [PATCH 005/178] filtered kernel result_of to decltype --- Filtered_kernel/include/CGAL/Lazy.h | 2 +- .../test/Filtered_kernel/test_lazy_vector_objects.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 559e9daea55..c4df37b5a03 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1705,7 +1705,7 @@ struct result { \ BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) // nullary - typename Type_mapper< typename cpp11::result_of::type ,AK, LK>::type + decltype(auto) operator()() const { typedef typename cpp11::result_of::type AT; diff --git a/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp b/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp index 6d6b9737c34..a0793b58c8b 100644 --- a/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp +++ b/Filtered_kernel/test/Filtered_kernel/test_lazy_vector_objects.cpp @@ -35,7 +35,7 @@ int main() obj = CGAL::intersection(s1,s2); // check the variant return type - CGAL::cpp11::result_of::type o_variant = CGAL::intersection(t1,t2); + const auto o_variant = CGAL::intersection(t1,t2); if(!o_variant) { std::cerr << "ERROR, empty" << std::endl; return EXIT_FAILURE; @@ -75,7 +75,7 @@ int main() } // check the variant return type - CGAL::cpp11::result_of::type o_variant = CGAL::intersection(t1,t2); + const auto o_variant = CGAL::intersection(t1,t2); if(!o_variant) { std::cerr << "ERROR, empty" << std::endl; return EXIT_FAILURE; From e4f5d0b5bdb4fcea7a0ac5e413a9553486e76b1a Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Wed, 22 Jul 2020 16:28:40 +0200 Subject: [PATCH 006/178] kernel_d result_of to decltype --- Kernel_d/doc/Kernel_d/CGAL/intersections_d.h | 2 +- .../Kernel_d/Concepts/Kernel--Intersect_d.h | 2 +- Kernel_d/doc/Kernel_d/Kernel_d.txt | 4 +-- Kernel_d/include/CGAL/intersections_d.h | 30 +++++++++---------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h index f425e157a84..5949422420c 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h @@ -147,7 +147,7 @@ void foo(Segment_d seg, Line_d lin) // auto result = intersection(seg, lin); // without C++11 support - typename cpp11::result_of, Line_d)>::type + typename CGAL::cpp11::result_of, Line_d)>::type result = intersection(seg, lin); if(result) { boost::apply_visitor(Intersection_visitor(), *result); } diff --git a/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h b/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h index 7d01b176b0c..79d9ec8d323 100644 --- a/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h +++ b/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h @@ -23,7 +23,7 @@ For a list of the possible return types, see `CGAL::intersection()`. \pre `p` and `q` have the same dimension. */ template -cpp11::result_of::type +CGAL::cpp11::result_of::type operator()(const Type1& p, const Type2& q); /// @} diff --git a/Kernel_d/doc/Kernel_d/Kernel_d.txt b/Kernel_d/doc/Kernel_d/Kernel_d.txt index fb1ca9a5b92..f61d9de2636 100644 --- a/Kernel_d/doc/Kernel_d/Kernel_d.txt +++ b/Kernel_d/doc/Kernel_d/Kernel_d.txt @@ -481,7 +481,7 @@ returns a `boost::optional< boost::variant< T... > >` where `T...` is a list of all possible resulting geometric objects. The exact result type of an intersection can be determined by using -`cpp11::result_of::%type` +`CGAL::cpp11::result_of::%type` where `Type1` and `Type2` are the types of the objects used in the intersection computation. @@ -500,7 +500,7 @@ typedef Segment_d Segment; Segment s1, s2; std::cin >> s1 >> s2; -cpp11::result_of::type +CGAL::cpp11::result_of::type v = intersection(s1, s2); if(v) { // not empty diff --git a/Kernel_d/include/CGAL/intersections_d.h b/Kernel_d/include/CGAL/intersections_d.h index 84697944f78..75607475d94 100644 --- a/Kernel_d/include/CGAL/intersections_d.h +++ b/Kernel_d/include/CGAL/intersections_d.h @@ -25,7 +25,7 @@ namespace Intersections { namespace internal { template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R&) { typedef typename R::Line_d_Line_d_pair ll_pair; @@ -46,7 +46,7 @@ intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&) { typedef typename R::Ray_d_Ray_d_pair ll_pair; @@ -75,7 +75,7 @@ intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&) } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, const R&) { typedef typename R::Segment_d_Segment_d_pair ll_pair; @@ -99,7 +99,7 @@ intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, c } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&) { typedef typename R::Line_d_Ray_d_pair lr_pair; @@ -121,12 +121,12 @@ intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&) } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Ray_d& r, const typename R::Line_d& l, const R& k) { return intersection(l,r,k); } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R&) { typedef typename R::Ray_d_Segment_d_pair rs_pair; @@ -150,12 +150,12 @@ intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Segment_d& s, const typename R::Ray_d& r, const R& k) { return intersection(r,s, k); } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const R&) { typedef typename R::Line_d_Segment_d_pair rs_pair; @@ -179,12 +179,12 @@ intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Segment_d& s, const typename R::Line_d& l, const R& r) { return intersection(l,s,r); } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, const R&) { typedef typename R::Line_d_Hyperplane_d_pair lh_pair; @@ -205,12 +205,12 @@ intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, con } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Hyperplane_d& h, const typename R::Line_d& l, const R& r) { return intersection(l,h,r); } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, const R&) { typedef typename R::Ray_d_Hyperplane_d_pair rh_pair; @@ -231,12 +231,12 @@ intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, cons } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Hyperplane_d& h, const typename R::Ray_d& r, const R& k) { return intersection(r,h,k); } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, const R&) { typedef typename R::Segment_d_Hyperplane_d_pair sh_pair; @@ -258,7 +258,7 @@ intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, } template -typename cpp11::result_of::type +decltype(auto) intersection(const typename R::Hyperplane_d& h, const typename R::Segment_d& s, const R& r) { return intersection(s,h,r); } From 4248a8a9f79887ebc4ccaba95f035e6313e9160f Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 23 Jul 2020 16:00:06 +0200 Subject: [PATCH 007/178] lazy and type mapper result_of fix --- Filtered_kernel/include/CGAL/Lazy.h | 39 ++++++++++----------- Kernel_23/include/CGAL/Kernel/Type_mapper.h | 3 ++ STL_Extension/include/CGAL/result_of.h | 15 ++------ 3 files changed, 24 insertions(+), 33 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index c4df37b5a03..39f335151fc 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -786,7 +786,8 @@ struct Lazy_construction_bbox CGAL_NO_UNIQUE_ADDRESS EC ec; template - result_type operator()(const L1& l1) const + decltype(auto) + operator()(const L1& l1) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); // Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG @@ -994,14 +995,14 @@ struct Lazy_cartesian_const_iterator_2 public: template < typename L1> - result_type + decltype(auto) operator()(const L1& l1) const { return result_type(&l1); } template < typename L1> - result_type + decltype(auto) operator()(const L1& l1, int) const { return result_type(&l1,2); @@ -1023,14 +1024,14 @@ struct Lazy_cartesian_const_iterator_3 public: template < typename L1> - result_type + decltype(auto) operator()(const L1& l1) const { return result_type(&l1); } template < typename L1> - result_type + decltype(auto) operator()(const L1& l1, int) const { return result_type(&l1,3); @@ -1243,7 +1244,7 @@ struct Lazy_construction_object public: template - result_type + decltype(auto) operator()(const L1& l1) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -1276,7 +1277,7 @@ public: } template - result_type + decltype(auto) operator()(const L1& l1, const L2& l2) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -1330,7 +1331,7 @@ CGAL_Kernel_obj(Point_3) } template - result_type + decltype(auto) operator()(const L1& l1, const L2& l2, const L3& l3) const { CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -1497,9 +1498,9 @@ struct Lazy_construction_variant { BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) template - typename result::type + decltype(auto) operator()(const L1& l1, const L2& l2) const { - typedef typename cpp11::result_of::type result_type; + typedef typename result::type result_type; typedef typename cpp11::result_of::type, typename Type_mapper::type)>::type AT; @@ -1545,7 +1546,7 @@ struct Lazy_construction_variant { } template - typename result::type + decltype(auto) operator()(const L1& l1, const L2& l2, const L3& l3) const { typedef typename result::type result_type; @@ -1620,7 +1621,7 @@ struct Lazy_construction { #define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \ template \ - result_type \ + decltype(auto) \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ typedef Lazy< AT, ET, E2A> Handle; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ @@ -1638,7 +1639,7 @@ struct Lazy_construction { BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _) // nullary - result_type + decltype(auto) operator()() const { typedef Lazy Handle; @@ -1680,16 +1681,14 @@ struct result { \ #define CGAL_CONSTRUCTION_OPERATOR(z, n, d) \ template \ - typename cpp11::result_of::type \ + decltype(auto) \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \ - typedef typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \ - typedef typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \ + typedef typename Type_mapper::type,EK,EK>::type ET; \ + typedef typename Type_mapper::type,AK,AK>::type AT; \ typedef Lazy< AT, ET, E2A> Handle; \ - typedef typename cpp11::result_of::type result_type; \ + typedef typename result::type result_type; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ Protect_FPU_rounding P; \ try { \ @@ -1711,7 +1710,7 @@ struct result { \ typedef typename cpp11::result_of::type AT; typedef typename cpp11::result_of::type ET; typedef Lazy Handle; - typedef typename Type_mapper< typename cpp11::result_of::type ,AK, LK>::type result_type; + typedef typename Type_mapper::type result_type; return result_type( Handle(new Lazy_rep_0()) ); } diff --git a/Kernel_23/include/CGAL/Kernel/Type_mapper.h b/Kernel_23/include/CGAL/Kernel/Type_mapper.h index fe54b5fe96b..3dda35168d6 100644 --- a/Kernel_23/include/CGAL/Kernel/Type_mapper.h +++ b/Kernel_23/include/CGAL/Kernel/Type_mapper.h @@ -90,6 +90,9 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) #define CGAL_Kernel_obj(X) \ template < typename K1, typename K2 > \ struct Type_mapper_impl < typename K1::X, K1, K2 > \ + { typedef typename K2::X type; }; \ + template < typename K1, typename K2 > \ + struct Type_mapper_impl < typename K1::X::Rep, K1, K2 > \ { typedef typename K2::X type; }; #include diff --git a/STL_Extension/include/CGAL/result_of.h b/STL_Extension/include/CGAL/result_of.h index 337344bc328..f75ebc6c859 100644 --- a/STL_Extension/include/CGAL/result_of.h +++ b/STL_Extension/include/CGAL/result_of.h @@ -20,6 +20,7 @@ #include #include +#include // Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' // result_of.hpp includes files from boost/preprocessor @@ -37,21 +38,9 @@ namespace CGAL{ -// Even if for now we use the tr1 result_of implementation, we use the cpp11 -// namespace since in the future, that's the decltype version that will be used namespace cpp11{ -template -struct result_of -{ - // from boost 1.44 release note https://www.boost.org/users/history/version_1_44_0.html : - // New template boost::tr1_result_of that implements the TR1 ResultOf protocol even if boost::result_of uses the C++0x decltype-based implementation. - #if BOOST_VERSION < 104400 - typedef typename boost::result_of::type type; - #else - typedef typename boost::tr1_result_of::type type; - #endif -}; +using std::result_of; } From 847e2277d60f242f7748360b38901762fb0df3f6 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 23 Jul 2020 18:46:46 +0200 Subject: [PATCH 008/178] result_of types to decltype(declval), both issues #3035 and #3846 are addressed --- .../function_objects_polynomial_circular.h | 4 +- Filtered_kernel/include/CGAL/Lazy.h | 43 ++++++++----------- STL_Extension/include/CGAL/iterator.h | 7 ++- STL_Extension/include/CGAL/result_of.h | 11 ++++- 4 files changed, 33 insertions(+), 32 deletions(-) diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index 75b4350bf30..b2326adedd4 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -1299,12 +1299,12 @@ namespace CircularFunctors { template struct result { - typedef typename cpp11::result_of::type type; + typedef decltype(std::declval()(Circle_2())) type; }; template struct result { - typedef typename cpp11::result_of::type type; + typedef decltype(std::declval()(Circle_2())) type; }; decltype(auto) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 39f335151fc..7ae3bcb36fe 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -399,6 +398,7 @@ public: }; // Macro helpers to build the kernel objects +#define CGAL_PARAM(z, n, t) t##n() #define CGAL_TYPEMAP_AC(z, n, t) typedef typename Type_mapper< t##n, LK, AK >::type A##n; #define CGAL_TYPEMAP_EC(z, n, t) typedef typename Type_mapper< t##n, LK, EK >::type E##n; #define CGAL_LEXACT(z,n,t) CGAL::exact( l##n ) @@ -826,7 +826,7 @@ struct Lazy_construction_nt { BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, T) \ typedef Lazy_exact_nt< \ typename boost::remove_cv< typename boost::remove_reference < \ - typename cpp11::result_of::type >::type >::type > type; \ + decltype(std::declval()(BOOST_PP_ENUM(n, CGAL_PARAM, E))) >::type >::type > type; \ }; BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _) @@ -1370,7 +1370,7 @@ CGAL_Kernel_obj(Point_3) //____________________________________________________________ // The magic functor that has Lazy as result type. // Two versions are distinguished: one that needs to fiddle -// with result_of and another that can forward the result types. +// with decltype and another that can forward the result types. namespace internal { BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) @@ -1492,7 +1492,7 @@ struct Lazy_construction_variant { struct result { \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \ typedef typename Type_mapper< \ - typename cpp11::result_of::type, AK, LK>::type type; \ + decltype(std::declval()(BOOST_PP_ENUM(n, CGAL_PARAM, A))), AK, LK>::type type; \ }; BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) @@ -1502,10 +1502,10 @@ struct Lazy_construction_variant { operator()(const L1& l1, const L2& l2) const { typedef typename result::type result_type; - typedef typename cpp11::result_of::type, - typename Type_mapper::type)>::type AT; - typedef typename cpp11::result_of::type, - typename Type_mapper::type)>::type ET; + typedef decltype(std::declval()(typename Type_mapper::type(), + typename Type_mapper::type())) AT; + typedef decltype(std::declval()(typename Type_mapper::type(), + typename Type_mapper::type())) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; @@ -1550,12 +1550,12 @@ struct Lazy_construction_variant { operator()(const L1& l1, const L2& l2, const L3& l3) const { typedef typename result::type result_type; - typedef typename cpp11::result_of::type, - typename Type_mapper::type, - typename Type_mapper::type)>::type AT; - typedef typename cpp11::result_of::type, - typename Type_mapper::type, - typename Type_mapper::type)>::type ET; + typedef decltype(std::declval()(typename Type_mapper::type(), + typename Type_mapper::type(), + typename Type_mapper::type())) AT; + typedef decltype(std::declval()(typename Type_mapper::type(), + typename Type_mapper::type(), + typename Type_mapper::type())) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; @@ -1670,13 +1670,6 @@ struct Lazy_construction CGAL_NO_UNIQUE_ADDRESS EC ec; // acquire the result_type of the approximate kernel, map it back to the lazy kernel object -#define CGAL_RESULT(z, n, d) \ -template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \ -struct result { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \ - typedef typename Type_mapper< typename cpp11::result_of::type, AK, LK>::type type; \ -}; - BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _) #define CGAL_CONSTRUCTION_OPERATOR(z, n, d) \ @@ -1685,8 +1678,8 @@ struct result { \ operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \ BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \ - typedef typename Type_mapper::type,EK,EK>::type ET; \ - typedef typename Type_mapper::type,AK,AK>::type AT; \ + typedef typename Type_mapper()(BOOST_PP_ENUM(n, CGAL_PARAM, E))),EK,EK>::type ET; \ + typedef typename Type_mapper()(BOOST_PP_ENUM(n, CGAL_PARAM, A))),AK,AK>::type AT; \ typedef Lazy< AT, ET, E2A> Handle; \ typedef typename result::type result_type; \ CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \ @@ -1707,8 +1700,8 @@ struct result { \ decltype(auto) operator()() const { - typedef typename cpp11::result_of::type AT; - typedef typename cpp11::result_of::type ET; + typedef decltype(std::declval()()) AT; + typedef decltype(std::declval()()) ET; typedef Lazy Handle; typedef typename Type_mapper::type result_type; diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index ea2b445b6f5..dec026e4a43 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -660,7 +659,7 @@ class Join_input_iterator_1 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef std::decay_t::type> value_type; + typedef std::decay_t()(arg_type()))> value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type const* pointer; typedef value_type const& reference; @@ -746,7 +745,7 @@ class Join_input_iterator_2 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef typename cpp11::result_of::type value_type; + typedef decltype(std::declval()(arg_type_1(), arg_type_2())) value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type* pointer; typedef value_type& reference; @@ -840,7 +839,7 @@ class Join_input_iterator_3 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef typename cpp11::result_of::type + typedef decltype(std::declval()(arg_type_1(), arg_type_2(), arg_type_3())) value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type* pointer; diff --git a/STL_Extension/include/CGAL/result_of.h b/STL_Extension/include/CGAL/result_of.h index f75ebc6c859..bd25c2a45fe 100644 --- a/STL_Extension/include/CGAL/result_of.h +++ b/STL_Extension/include/CGAL/result_of.h @@ -40,7 +40,16 @@ namespace CGAL{ namespace cpp11{ -using std::result_of; +// When we switch to C++17, we should use the std::invoke_result instead. +// #if __cplusplus >= 201703L +// template +// struct result_of : public std::invoke_result +// { + +// }; +// #else + using std::result_of; +// #endif } From 2f7f37983b59802d2aee1cabee2ad9d5827f347a Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Fri, 24 Jul 2020 11:26:28 +0200 Subject: [PATCH 009/178] periodic 3 and generator fixes + the issue #3083 is addressed --- .../internal/Generic_random_point_generator.h | 1 + .../CGAL/Periodic_3_regular_triangulation_3.h | 3 +- .../include/CGAL/Periodic_3_triangulation_3.h | 3 +- STL_Extension/include/CGAL/result_of.h | 61 +++++++++++-------- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/Generator/include/CGAL/internal/Generic_random_point_generator.h b/Generator/include/CGAL/internal/Generic_random_point_generator.h index a161df1da76..76c52dd55cb 100644 --- a/Generator/include/CGAL/internal/Generic_random_point_generator.h +++ b/Generator/include/CGAL/internal/Generic_random_point_generator.h @@ -18,6 +18,7 @@ #include #include #include +#include #include diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index 27583fe8a15..030d0f9d409 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -497,7 +498,7 @@ public: // Spatial sorting can only be applied to bare points, so we need an adaptor typedef typename Geom_traits::Construct_point_3 Construct_point_3; - typedef typename boost::result_of::type Ret; + typedef typename cpp11::result_of::type Ret; typedef boost::function_property_map fpmap; typedef CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h index c96cb05bc11..93854244f30 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_triangulation_3.h @@ -47,7 +47,6 @@ #include #include #include -#include #include #include @@ -650,7 +649,7 @@ public: // but point() -like functions have return type Point template // can be Point or Point_3 - typename boost::result_of::type + decltype(auto) construct_point(const P& p) const { return geom_traits().construct_point_3_object()(p); } diff --git a/STL_Extension/include/CGAL/result_of.h b/STL_Extension/include/CGAL/result_of.h index bd25c2a45fe..1ed20008f20 100644 --- a/STL_Extension/include/CGAL/result_of.h +++ b/STL_Extension/include/CGAL/result_of.h @@ -20,41 +20,50 @@ #include #include -#include -// Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' -// result_of.hpp includes files from boost/preprocessor -// This concerns boost 1_65_1 -#if defined(BOOST_MSVC) -# pragma warning(push) -# pragma warning(disable: 4003) -#endif -#include -#if defined(BOOST_MSVC) -# pragma warning(pop) -#endif +#if CGAL_CXX11 -#include + #include -namespace CGAL{ +#else // C++<11 -namespace cpp11{ + // Address the warning C4003: not enough actual parameters for macro 'BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY' + // result_of.hpp includes files from boost/preprocessor + // This concerns boost 1_65_1 + #if defined(BOOST_MSVC) + #pragma warning(push) + #pragma warning(disable: 4003) + #endif + #include + #if defined(BOOST_MSVC) + #pragma warning(pop) + #endif + #include -// When we switch to C++17, we should use the std::invoke_result instead. -// #if __cplusplus >= 201703L -// template -// struct result_of : public std::invoke_result -// { +#endif // end C++<11 + +namespace CGAL { +namespace cpp11 { + +#if CGAL_CXX20 + + template class result_of; + template + class result_of : public std::invoke_result { }; + +#elif CGAL_CXX11 -// }; -// #else using std::result_of; -// #endif -} +#else // C++<11 -} + using boost::result_of; + +#endif + +} // end cpp11 +} // end CGAL #include -#endif //CGAL_RESULT_OF_H +#endif // CGAL_RESULT_OF_H From ad813b4cb0c276bb77755c1d5bfeee770a0d5477 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 30 Jul 2020 16:19:02 +0200 Subject: [PATCH 010/178] further removed result_of and result --- AABB_tree/include/CGAL/AABB_traits.h | 1 + .../function_objects_polynomial_circular.h | 45 +------------------ .../function_objects_polynomial_sphere.h | 40 +---------------- .../get_equation_object_on_curved_kernel_3.h | 27 ----------- Filtered_kernel/include/CGAL/Lazy.h | 16 ------- .../include/CGAL/Intersection_traits.h | 19 ++++---- .../internal/intersection_3_1_impl.h | 2 +- .../include/CGAL/Kernel/function_objects.h | 35 +-------------- 8 files changed, 16 insertions(+), 169 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 8ff12dfe862..07bdad7d520 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index b2326adedd4..beecb4c1dba 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -518,22 +518,8 @@ namespace CircularFunctors { //using CK::Linear_kernel::Intersect_2::operator(); - template - struct result; - - template - struct result { - typedef typename Intersection_traits::result_type type; - }; - - //need a specialization for the case of 3 object in CK - template - struct result { - typedef OutputIterator type; - }; - template - typename Intersection_traits::result_type + decltype(auto) operator()(const A& a, const B& b) const{ return typename CK::Linear_kernel::Intersect_2()(a,b); } @@ -643,21 +629,6 @@ namespace CircularFunctors { { public: - template - struct result; - - template - struct result - { - typedef typename CK::Polynomial_1_2 type; - }; - - template - struct result - { - typedef typename CK::Polynomial_for_circles_2_2 type; - }; - typename CK::Polynomial_1_2 operator() ( const typename CK::Line_2 & l ) { @@ -1292,20 +1263,6 @@ namespace CircularFunctors { typedef typename CK::Point_2 Point_2; typedef typename CK::Circle_2 Circle_2; public: - template - struct result{ - typedef FT type; - }; - - template - struct result { - typedef decltype(std::declval()(Circle_2())) type; - }; - - template - struct result { - typedef decltype(std::declval()(Circle_2())) type; - }; decltype(auto) operator()( const Circle_2& c) const diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h index 694705639c3..7ab1bd49b97 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h @@ -667,15 +667,6 @@ template < class SK > \ typedef typename SK::Kernel_base::Circle_3 RCircle_3; typedef typename Circle_3::Rep Rep; public: - template - struct result { - typedef forwarded_result_type type; - }; - - template - struct result { - typedef const forwarded_result_type& type; - }; forwarded_result_type operator()(const Point_3& p, const FT& sr, @@ -1168,44 +1159,17 @@ template < class SK > \ public: - template - struct result; - - // the binary overload always goes to Linear::Intersect_3 - template - struct result - { typedef typename Intersection_traits::result_type type; }; - - // This one is only for the spherical kernel, O is an output iterator - template - struct result - { typedef OutputIterator type;}; - - // there is no quaternary form in the linear Kernel - template - struct result - { typedef OutputIterator type; }; - - //only ternary from the linear kernel - template - struct result { - typedef boost::optional< - boost::variant< Point_3, - Line_3, - Plane_3 > > type; - }; - //using SK::Linear_kernel::Intersect_3::operator(); typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3; template - typename Intersection_traits::result_type + decltype(auto) operator()(const A& a, const B& b) const{ return Intersect_linear_3()(a,b); } - typename result::type + decltype(auto) operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const { return Intersect_linear_3()(p, q, r); diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h index 7bd216c466b..ef7bd172f99 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/get_equation_object_on_curved_kernel_3.h @@ -41,33 +41,6 @@ namespace CGAL { typedef typename SK::Polynomials_for_circle_3 result_type_for_circle; //using LinearFunctors::Get_equation::operator(); - template - struct result; - - template - struct result - { - typedef result_type_for_sphere type; - }; - - template - struct result - { - typedef result_type_for_plane type; - }; - - template - struct result - { - typedef result_type_for_line type; - }; - - template - struct result - { - typedef result_type_for_circle type; - }; - result_type_for_sphere operator() ( const typename SK::Sphere_3 & s ) { diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 7ae3bcb36fe..f348718c544 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -817,20 +817,6 @@ struct Lazy_construction_nt { CGAL_NO_UNIQUE_ADDRESS AC ac; CGAL_NO_UNIQUE_ADDRESS EC ec; - template - struct result { }; - -#define CGAL_RESULT_NT(z, n, d) \ - template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \ - struct result { \ - BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, T) \ - typedef Lazy_exact_nt< \ - typename boost::remove_cv< typename boost::remove_reference < \ - decltype(std::declval()(BOOST_PP_ENUM(n, CGAL_PARAM, E))) >::type >::type > type; \ - }; - - BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _) - template auto operator()(L const&...l) const -> Lazy_exact_nt>> @@ -847,8 +833,6 @@ struct Lazy_construction_nt { return new Lazy_rep_0 >(ec( CGAL::exact(l)... )); } } - -#undef CGAL_RESULT_NT }; diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 740fe435f9e..5892d511db3 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -41,13 +40,13 @@ #define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \ template \ inline \ - typename cpp11::result_of::type \ + decltype(auto) \ intersection(const A& a, const B& b) { \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } \ template \ inline \ - typename cpp11::result_of::type \ + decltype(auto) \ intersection(const B& a, const A& b) { \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } @@ -55,7 +54,7 @@ #define CGAL_INTERSECTION_FUNCTION_SELF(A, DIM) \ template \ inline \ - typename cpp11::result_of::type \ + decltype(auto) \ intersection(const A & a, const A & b) { \ return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \ } @@ -123,11 +122,11 @@ namespace internal { // the real type. // Overloads for empty returns are also provided. template - inline typename cpp11::result_of::type - intersection_return(T&& t) { return typename cpp11::result_of::type(std::forward(t)); } + decltype(auto) + intersection_return(T&& t) { return decltype(std::declval()(A(), B()))(std::forward(t)); } template - inline typename cpp11::result_of::type - intersection_return() { return typename cpp11::result_of::type(); } + decltype(auto) + intersection_return() { return decltype(std::declval()(A(), B()))(); } // Something similar to wrap around boost::get and object_cast to // prevent ifdefing too much. Another way could be to introduce an @@ -153,14 +152,14 @@ const T* intersect_get(const boost::variant & v) { } template -typename cpp11::result_of::Kernel::Intersect_2(A, B)>::type +decltype(auto) intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_2_object()(a, b); } template -typename cpp11::result_of::Kernel::Intersect_3(A, B)>::type +decltype(auto) intersection_impl(const A& a, const B& b, Dimension_tag<3>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_3_object()(a, b); diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h b/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h index f836dbd6aea..b8c1b77dad8 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h @@ -57,7 +57,7 @@ namespace CGAL { // the special plane_3 function template inline -typename cpp11::result_of::type +decltype(auto) intersection(const Plane_3 &plane1, const Plane_3 &plane2, const Plane_3 &plane3) { diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index c3c3537838e..41e978b703b 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2557,15 +2557,6 @@ namespace CommonKernelFunctors { typedef typename K::Triangle_3 Triangle_3; typedef typename K::Tetrahedron_3 Tetrahedron_3; public: - template - struct result { - typedef const Point_3& type; - }; - - template - struct result { - typedef Point_3 type; - }; const Point_3& operator()( const Segment_3& s, int i) const @@ -3516,17 +3507,10 @@ namespace CommonKernelFunctors { class Intersect_2 { public: - template - struct result; - - template - struct result { - typedef typename Intersection_traits::result_type type; - }; // 25 possibilities, so I keep the template. template - typename Intersection_traits::result_type + decltype(auto) operator()(const T1& t1, const T2& t2) const { return Intersections::internal::intersection(t1, t2, K()); } }; @@ -3536,21 +3520,6 @@ namespace CommonKernelFunctors { { typedef typename K::Plane_3 Plane_3; public: - template - struct result; - - template - struct result { - typedef typename Intersection_traits::result_type type; - }; - - template - struct result { - typedef boost::optional< - boost::variant< typename K::Point_3, - typename K::Line_3, - typename K::Plane_3 > > type; - }; // n possibilities, so I keep the template. template @@ -3558,7 +3527,7 @@ namespace CommonKernelFunctors { operator()(const T1& t1, const T2& t2) const { return Intersections::internal::intersection(t1, t2, K() ); } - typename boost::optional< boost::variant< typename K::Point_3, typename K::Line_3, typename K::Plane_3 > > + decltype(auto) operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const { return Intersections::internal::intersection(pl1, pl2, pl3, K() ); } }; From 758ae808c0f527bfccd90cec8643dda5fbb60b94 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 30 Jul 2020 17:33:00 +0200 Subject: [PATCH 011/178] better use of declval --- Filtered_kernel/include/CGAL/Lazy.h | 22 +++++++++++----------- STL_Extension/include/CGAL/iterator.h | 8 +++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index f348718c544..33228d1a0fd 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -398,7 +398,7 @@ public: }; // Macro helpers to build the kernel objects -#define CGAL_PARAM(z, n, t) t##n() +#define CGAL_PARAM(z, n, t) std::declval() #define CGAL_TYPEMAP_AC(z, n, t) typedef typename Type_mapper< t##n, LK, AK >::type A##n; #define CGAL_TYPEMAP_EC(z, n, t) typedef typename Type_mapper< t##n, LK, EK >::type E##n; #define CGAL_LEXACT(z,n,t) CGAL::exact( l##n ) @@ -1486,10 +1486,10 @@ struct Lazy_construction_variant { operator()(const L1& l1, const L2& l2) const { typedef typename result::type result_type; - typedef decltype(std::declval()(typename Type_mapper::type(), - typename Type_mapper::type())) AT; - typedef decltype(std::declval()(typename Type_mapper::type(), - typename Type_mapper::type())) ET; + typedef decltype(std::declval()(std::declval::type>(), + std::declval::type>())) AT; + typedef decltype(std::declval()(std::declval::type>(), + std::declval::type>())) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; @@ -1534,12 +1534,12 @@ struct Lazy_construction_variant { operator()(const L1& l1, const L2& l2, const L3& l3) const { typedef typename result::type result_type; - typedef decltype(std::declval()(typename Type_mapper::type(), - typename Type_mapper::type(), - typename Type_mapper::type())) AT; - typedef decltype(std::declval()(typename Type_mapper::type(), - typename Type_mapper::type(), - typename Type_mapper::type())) ET; + typedef decltype(std::declval()(std::declval::type>(), + std::declval::type>(), + std::declval::type>())) AT; + typedef decltype(std::declval()(std::declval::type>(), + std::declval::type>(), + std::declval::type>())) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; diff --git a/STL_Extension/include/CGAL/iterator.h b/STL_Extension/include/CGAL/iterator.h index dec026e4a43..8395606f4b5 100644 --- a/STL_Extension/include/CGAL/iterator.h +++ b/STL_Extension/include/CGAL/iterator.h @@ -659,7 +659,8 @@ class Join_input_iterator_1 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef std::decay_t()(arg_type()))> value_type; + typedef std::decay_t()(std::declval()))> + value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type const* pointer; typedef value_type const& reference; @@ -745,7 +746,8 @@ class Join_input_iterator_2 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef decltype(std::declval()(arg_type_1(), arg_type_2())) value_type; + typedef decltype(std::declval()(std::declval(), std::declval())) + value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type* pointer; typedef value_type& reference; @@ -839,7 +841,7 @@ class Join_input_iterator_3 public: typedef typename std::iterator_traits::iterator_category iterator_category; - typedef decltype(std::declval()(arg_type_1(), arg_type_2(), arg_type_3())) + typedef decltype(std::declval()(std::declval(), std::declval(), std::declval())) value_type; typedef typename std::iterator_traits::difference_type difference_type; typedef value_type* pointer; From 69ed0152cc19b31191f2b6df4a4a2154162388ec Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 30 Jul 2020 18:30:56 +0200 Subject: [PATCH 012/178] some cleanup --- Filtered_kernel/include/CGAL/Lazy.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 33228d1a0fd..1fa84f44ceb 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -979,14 +979,14 @@ struct Lazy_cartesian_const_iterator_2 public: template < typename L1> - decltype(auto) + result_type operator()(const L1& l1) const { return result_type(&l1); } template < typename L1> - decltype(auto) + result_type operator()(const L1& l1, int) const { return result_type(&l1,2); @@ -1008,14 +1008,14 @@ struct Lazy_cartesian_const_iterator_3 public: template < typename L1> - decltype(auto) + result_type operator()(const L1& l1) const { return result_type(&l1); } template < typename L1> - decltype(auto) + result_type operator()(const L1& l1, int) const { return result_type(&l1,3); From 209513dc5612a8a3be2b19fc8f5e4460e4ea7535 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Fri, 31 Jul 2020 15:58:38 +0200 Subject: [PATCH 013/178] fixed docs + a few code improvements --- .../doc/AABB_tree/Concepts/AABBGeomTraits.h | 4 +-- .../include/CGAL/AABB_segment_primitive.h | 8 ++---- AABB_tree/include/CGAL/AABB_traits.h | 14 ++++------ .../include/CGAL/AABB_triangle_primitive.h | 9 +++--- .../AABB_triangulation_3_cell_primitive.h | 8 +++--- .../include/CGAL/Intersection_traits.h | 4 +-- .../CGAL/Circular_kernel_intersections.h | 2 +- .../CGAL/Spherical_kernel_intersections.h | 13 ++++----- Kernel_23/doc/Kernel_23/CGAL/intersections.h | 28 +++++++++++-------- .../Concepts/FunctionObjectConcepts.h | 10 ++----- Kernel_23/doc/Kernel_23/Kernel_23.txt | 28 +++++++------------ Kernel_d/doc/Kernel_d/CGAL/intersections_d.h | 23 +++++++-------- .../Kernel_d/Concepts/Kernel--Intersect_d.h | 2 +- Kernel_d/doc/Kernel_d/Kernel_d.txt | 17 +++++------ .../NewKernel_d/Cartesian_static_filters.h | 1 - .../CGAL/NewKernel_d/Filtered_predicate2.h | 1 - .../CGAL/NewKernel_d/KernelD_converter.h | 2 +- .../CGAL/NewKernel_d/Kernel_d_interface.h | 10 +++---- .../CGAL/NewKernel_d/Wrapper/Point_d.h | 2 +- .../CGAL/NewKernel_d/Wrapper/Vector_d.h | 1 - .../CGAL/Periodic_3_regular_triangulation_3.h | 3 +- .../doc/STL_Extension/CGAL/result_of.h | 16 ++++++----- .../include/CGAL/transforming_iterator.h | 1 - 23 files changed, 91 insertions(+), 116 deletions(-) diff --git a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h index 6f732e50340..e9a664c2ff8 100644 --- a/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h +++ b/AABB_tree/doc/AABB_tree/Concepts/AABBGeomTraits.h @@ -45,11 +45,9 @@ typedef unspecified_type Do_intersect_3; /*! A functor object to construct the intersection between two geometric objects. -This functor must support the result_of protocol, that is the return -type of the `operator()(A, B)` is `CGAL::cpp11::result`. Provides the operators: -`CGAL::cpp11::result operator()(const A& a, const B& b);` +`decltype(auto) operator()(const A& a, const B& b);` where `A` and `B` are any relevant types among `Ray_3`, `Segment_3`, `Line_3`, `Triangle_3`, `Plane_3` and `Bbox_3`. Relevant herein means that a line primitive (ray, segment, line) is tested diff --git a/AABB_tree/include/CGAL/AABB_segment_primitive.h b/AABB_tree/include/CGAL/AABB_segment_primitive.h index 34851f55a63..d28c681c4c3 100644 --- a/AABB_tree/include/CGAL/AABB_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_segment_primitive.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace CGAL { @@ -31,9 +30,9 @@ namespace internal { //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - typedef typename cpp11::result_of< - typename GeomTraits::Construct_source_3(typename GeomTraits::Segment_3) - >::type reference; + typedef decltype( + std::declval()( + std::declval())) reference; typedef boost::readable_property_map_tag category; inline friend @@ -57,7 +56,6 @@ namespace internal { * \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Segment_3`. * It also provides the functor `Construct_source_3` that has an operator taking a `Segment_3` * and returning its source as a type convertible to `Point_3`. - * In addition `Construct_source_3` must support the result_of protocol. * \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Segment_3` * \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, * the datum is stored in the primitive, while in the latter it is diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 07bdad7d520..0018d9476e7 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -190,14 +189,14 @@ public: typedef typename std::pair Point_and_primitive_id; /// `Intersection_and_primitive_id::%Type::first_type` is found according to - /// the result type of `GeomTraits::Intersect_3::operator()`, - /// (that is cpp11::result_of::type). If it is + /// the result type of `GeomTraits::Intersect_3::operator()`. If it is /// `boost::optional` then it is `T`, and the result type otherwise. template struct Intersection_and_primitive_id { - typedef typename cpp11::result_of< - typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) - >::type Intersection_type; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) Intersection_type; typedef std::pair< typename internal::AABB_tree::Remove_optional::type, @@ -364,8 +363,7 @@ public: template boost::optional< typename Intersection_and_primitive_id::Type > operator()(const Query& query, const typename AT::Primitive& primitive) const { - typename cpp11::result_of::type - inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper::get_datum(primitive,m_traits),query); + auto inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper::get_datum(primitive,m_traits),query); if (!inter_res) return boost::none; return boost::make_optional( std::make_pair(*inter_res, primitive.id()) ); diff --git a/AABB_tree/include/CGAL/AABB_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_triangle_primitive.h index 5c1502d60af..89b45f940be 100644 --- a/AABB_tree/include/CGAL/AABB_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangle_primitive.h @@ -20,7 +20,6 @@ #include #include -#include #include namespace CGAL { @@ -31,9 +30,10 @@ namespace internal { //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - typedef typename cpp11::result_of< - typename GeomTraits::Construct_vertex_3(typename GeomTraits::Triangle_3,int) - >::type reference; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) reference; typedef boost::readable_property_map_tag category; inline friend @@ -57,7 +57,6 @@ namespace internal { * \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Triangle_3`. * It also provides the functor `Construct_vertex_3` that has an operator taking a `Triangle_3` * and an integer as parameters and returning a triangle point as a type convertible to `Point_3`. - * In addition `Construct_vertex_3` must support the result_of protocol. * \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Triangle_3` * \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case, * the datum is stored in the primitive, while in the latter it is diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index 66783dcff9b..90d520061a4 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -18,7 +18,6 @@ #include -#include #include namespace CGAL @@ -31,9 +30,10 @@ namespace CGAL //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - typedef typename cpp11::result_of< - typename GeomTraits::Construct_vertex_3(typename GeomTraits::Tetrahedron_3, int) - >::type reference; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) reference; typedef boost::readable_property_map_tag category; inline friend diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index 5892d511db3..cafd0428ef8 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -123,10 +123,10 @@ namespace internal { // Overloads for empty returns are also provided. template decltype(auto) - intersection_return(T&& t) { return decltype(std::declval()(A(), B()))(std::forward(t)); } + intersection_return(T&& t) { return decltype(std::declval()(std::declval(), std::declval()))(std::forward(t)); } template decltype(auto) - intersection_return() { return decltype(std::declval()(A(), B()))(); } + intersection_return() { return decltype(std::declval()(std::declval(), std::declval()))(); } // Something similar to wrap around boost::get and object_cast to // prevent ifdefing too much. Another way could be to introduce an diff --git a/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h index 5cc62d8227c..52b6131ddbc 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h @@ -48,7 +48,7 @@ with `Dispatch_output_iterator`. Since both the number of intersections, if any, and their types, depend on the arguments, the function expects an output iterator on -`cpp11::result_of::%type`, as +`decltype(std::declval()(std::declval(), std::declval()))`, as presented below. */ diff --git a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h index 3dbd6b566ae..63b75823a33 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h @@ -59,18 +59,15 @@ with `Dispatch_output_iterator`. Since both the number of intersections, if any, and their types, depend on the arguments, the function expects an output iterator on -`cpp11::result_of::%type`, +`decltype(std::declval()(std::declval(), std::declval()))`, as presented below. */ /// @{ /*! -Copies in the output iterator the intersection elements between the -two objects. `intersections` iterates on -elements of type `result_of< Intersect_3(SphericalType1, SphericalType2) >`, in lexicographic order, -when this ordering is defined on the computed objects, - -where `SphericalType1` and `SphericalType2` can both be one of: +Constructs the intersection elements between the two input +objects and stores them in the OutputIterator in lexicographic order, +where both, `SphericalType1` and `SphericalType2`, can be either - `Sphere_3`, - `Plane_3`, @@ -90,7 +87,7 @@ type can be and if the two objets `obj1` and `obj2` are equal, - `Line_3` or `Circle_3` when `SphericalType1` and `SphericalType2` - are two-dimensional objets intersecting along a curve (2 planes, or 2 + are two-dimensional objects intersecting along a curve (2 planes, or 2 spheres, or one plane and one sphere), - `Circular_arc_3` in case of an overlap of two circular arcs or diff --git a/Kernel_23/doc/Kernel_23/CGAL/intersections.h b/Kernel_23/doc/Kernel_23/CGAL/intersections.h index 7421c3e57f6..b39269c53a6 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/intersections.h @@ -95,12 +95,15 @@ The following tables give the possible values for `Type1` and `Type2`. \cgalHeading{2D Intersections} -The return type can be obtained through `cpp11::result_of::%type`. -It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. +The return type of intersecting two objects of the types `Type1` and `Type2` can be +specified through the placeholder type specifier `auto`. It is equivalent to +`boost::optional< boost::variant< T... > >`, the last column in the table providing +the template parameter pack.
- + + @@ -191,12 +194,15 @@ intersections existing with the type `Iso_rectangle_2`. Note that the return typ \cgalHeading{3D Intersections} -The return type can be obtained through `cpp11::result_of::%type`. -It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. +The return type of intersecting two objects of the types `Type1` and `Type2` can be +specified through the placeholder type specifier `auto`. It is equivalent to +`boost::optional< boost::variant< T... > >`, the last column in the table providing +the template parameter pack.
Type1
Type1 Type2 Return Type: `T...`
- + + @@ -350,9 +356,9 @@ The following examples demonstrate the most common use of `intersection()` functions with the 2D and 3D Linear %Kernel. In the first two examples we intersect a segment and a line. -The result type can be obtained with `cpp11::result_of`. It looks simpler -if you use a C++ compiler which supports `auto`, -but you must anyways know that the result type is a `boost::optional >`, in order to unpack the point or segment. +The result type can be specified through the placeholder type specifier `auto`, +but you must anyway know that the result type is a `boost::optional >`, +in order to unpack the point or segment. `boost::optional` comes in as there might be no intersection. `boost::variant` comes in @@ -374,7 +380,7 @@ a standard library algorithm. */ template -cpp11::result_of::type +decltype(auto) intersection(Type1 obj1, Type2 obj2); /*! @@ -382,7 +388,7 @@ returns the intersection of 3 planes, which can be a point, a line, a plane, or empty. */ template -boost::optional< boost::variant< Point_3, Line_3, Plane_3 > > +decltype(auto) intersection(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3); diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index 44e13cfbbe4..b77db9d9a89 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -8413,8 +8413,6 @@ public: \cgalRefines `AdaptableFunctor` (with two arguments) \sa \link intersection_grp `CGAL::intersection()` \endlink - \sa `CGAL::cpp11::result_of` - */ class Intersect_2 { public: @@ -8428,7 +8426,7 @@ public: `Type1` and `Type2`, for all pairs `Type1` and `Type2`. For details see the reference manual page for \link intersection_grp `CGAL::intersection()` \endlink. */ - CGAL::cpp11::result_of::type + decltype(auto) operator()(Type1 obj1, Type2 obj2); /// @} @@ -8442,8 +8440,6 @@ public: \cgalRefines `AdaptableFunctor` (with two or three arguments) \sa intersection_linear_grp - \sa `CGAL::cpp11::result_of` - */ class Intersect_3 { public: @@ -8457,8 +8453,8 @@ public: objects of type `Type1` and `Type2`. For details see the reference manual page for \ref intersection_linear_grp. */ - CGAL::cpp11::result_of::type - operator()(Type1 obj1, Type2 obj2); + decltype(auto) + operator()(Type1 obj1, Type2 obj2); diff --git a/Kernel_23/doc/Kernel_23/Kernel_23.txt b/Kernel_23/doc/Kernel_23/Kernel_23.txt index c624cc64db8..3777a054165 100644 --- a/Kernel_23/doc/Kernel_23/Kernel_23.txt +++ b/Kernel_23/doc/Kernel_23/Kernel_23.txt @@ -493,23 +493,19 @@ especially integer types and rationals. \subsection Kernel_23VariantReturnValues Intersections and Variant Return Types -Some functions, for example \link intersection_linear_grp `intersection()`\endlink, can return different types of objects. To achieve this -in a type-safe way \cgal uses return values of type -`boost::optional< boost::variant< T... > >` were `T...` is a -list of all possible resulting geometric objects. The exact result -type of an intersection can be determined through the metafunction -`CGAL::cpp11::result_of` or -`CGAL::cpp11::result_of`, where -`Type1` and `Type2` are the types of the objects used in the -intersection computation. +Some functions, for example \link intersection_linear_grp `intersection()`\endlink, +can return different types of objects. To achieve this in a type-safe way \cgal uses +return values of type `boost::optional< boost::variant< T... > >` where `T...` is a +list of all possible resulting geometric objects. The exact result type of an intersection +can be specified through the placeholder type specifier `auto`. Example ------- -In the following example, `result_of` is used to query the type of the -return value for the intersection computation: +In the following example, `auto` is used to specify the type of the return value +for the intersection computation: \code{.cpp} typedef Cartesian K; @@ -521,13 +517,9 @@ Segment_2 segment_1, segment_2; std::cin >> segment_1 >> segment_2; -/* C++11 */ -// auto v = intersection(segment_1, segment_2); - -/* C++03 */ -CGAL::cpp11::result_of::type -v = intersection(segment_1, segment_2); -if(v) { +/* use auto */ +auto v = intersection(segment_1, segment_2); +if (v) { /* not empty */ if (const Point_2 *p = boost::get(&*v) ) { /* do something with *p */ diff --git a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h index 5949422420c..1ac4f08cf2d 100644 --- a/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h +++ b/Kernel_d/doc/Kernel_d/CGAL/intersections_d.h @@ -34,14 +34,16 @@ The same functionality is also available through the functor `Kernel::Intersect_ The following table gives the possible values for `Type1` and `Type2`. -The return type can be obtained through `cpp11::result_of::%type`. -It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack. - +The return type of intersecting two objects of the types `Type1` and `Type2` can be +specified through the placeholder type specifier `auto`. It is equivalent to +`boost::optional< boost::variant< T... > >`, the last column in the table providing +the template parameter pack.
Type1
Type1 Type2 Return Type: `T...`
- + + @@ -143,13 +145,8 @@ struct Intersection_visitor { template void foo(Segment_d seg, Line_d lin) { - // with C++11 support - // auto result = intersection(seg, lin); - - // without C++11 support - typename CGAL::cpp11::result_of, Line_d)>::type - result = intersection(seg, lin); - + // use auto + auto result = intersection(seg, lin); if(result) { boost::apply_visitor(Intersection_visitor(), *result); } else { // no intersection } @@ -160,10 +157,10 @@ void foo(Segment_d seg, Line_d lin) \sa `Kernel_d::Intersect_d` \sa `boost::optional` \sa `boost::variant` -\sa `cpp11::result_of` */ -cpp11::result_of, Type2)>::type intersection(Type1 f1, Type2 f2); +decltype(auto) +intersection(Type1 f1, Type2 f2); } /* namespace CGAL */ diff --git a/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h b/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h index 79d9ec8d323..92f272da256 100644 --- a/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h +++ b/Kernel_d/doc/Kernel_d/Concepts/Kernel--Intersect_d.h @@ -23,7 +23,7 @@ For a list of the possible return types, see `CGAL::intersection()`. \pre `p` and `q` have the same dimension. */ template -CGAL::cpp11::result_of::type +decltype(auto) operator()(const Type1& p, const Type2& q); /// @} diff --git a/Kernel_d/doc/Kernel_d/Kernel_d.txt b/Kernel_d/doc/Kernel_d/Kernel_d.txt index f61d9de2636..ebccd581875 100644 --- a/Kernel_d/doc/Kernel_d/Kernel_d.txt +++ b/Kernel_d/doc/Kernel_d/Kernel_d.txt @@ -480,17 +480,14 @@ that are part of flats (`R::Segment_d`, `R::Ray_d`, returns a `boost::optional< boost::variant< T... > >` where `T...` is a list of all possible resulting geometric objects. -The exact result type of an intersection can be determined by using -`CGAL::cpp11::result_of::%type` -where `Type1` and `Type2` are the types of the objects -used in the intersection computation. +The return type of intersecting two objects of the types `Type1` and `Type2` can be +specified through the placeholder type specifier `auto`. \subsubsection Kernel_dExample Example -In the following example, the object type is used as a return value for -the intersection computation, as there are -possibly different return values. +In the following example, the `auto` is used for the intersection computation, +as there are possibly different return values. \code{.cpp} typedef Cartesian_d K; @@ -500,9 +497,9 @@ typedef Segment_d Segment; Segment s1, s2; std::cin >> s1 >> s2; -CGAL::cpp11::result_of::type - v = intersection(s1, s2); -if(v) { +/* use auto */ +auto v = intersection(s1, s2); +if (v) { // not empty if (const Point *p = boost::get(&*v) ) { // do something with *p diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 507e4144694..701cbff1efc 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -32,7 +32,6 @@ template struct Orientation_of_points_2 : private Store_k struct Point_2 { R_ const&r; CC const&c; Point const& p; Point_2(R_ const&r_, CC const&c_, Point const&p_):r(r_),c(c_),p(p_){} - // use result_of instead? typename CC::result_type x()const{return c(p,0);} typename CC::result_type y()const{return c(p,1);} }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h index c3d2281ad96..0265a9239e7 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h @@ -58,7 +58,6 @@ public: typedef C2E To_exact_converter; typedef C2A To_approximate_converter; - // FIXME: should use result_of, see emails by Nico typedef typename EP::result_type result_type; // AP::result_type must be convertible to EP::result_type. diff --git a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h index d48f3dc7ffc..5f2481695af 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/KernelD_converter.h @@ -134,7 +134,7 @@ typename typeset_intersection(a),Store_kernel2(b){} - // For boost::result_of, used in transforming_iterator + // For the (not anymore used in CGAL) boost result of, used in transforming_iterator template::value?42:0> struct result:Base::template result{}; template struct result { typedef transforming_iterator type; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index 23e2fad48d0..c4d0bd80e4b 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -127,15 +127,15 @@ template struct Kernel_d_interface : public Base_ { typedef typename Get_functor >::type CPI; typedef typename Get_functor >::type CVI; // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d. - //typedef typename CGAL::decay::type>::type result_type; - //typedef typename CGAL::decay::type result_type; - //typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; + // typedef typename CGAL::decay()(std::declval(), std::declval()))>::type result_type; + // typedef typename CGAL::decay::type result_type; + // typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; // HACK typedef typename Base::Point_cartesian_const_iterator result_type; // Kernel_d requires a common iterator type for points and vectors // TODO: provide this mixed functor in preKernel? - //CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); - //CGAL_static_assertion((boost::is_same::type, result_type>::value)); + // CGAL_static_assertion((boost::is_same()(std::declval(), std::declval()))>::type, result_type>::value)); + // CGAL_static_assertion((boost::is_same::type, result_type>::value)); template auto operator()(Point_d const&p, Tag_ t)const{ return CPI(this->kernel())(p,t); diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 7716c54bf05..90bb34da3de 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -49,7 +49,7 @@ public: typedef Dimension_tag<0> Feature_dimension; typedef typename Get_type::type Rep; - //typedef typename CGAL::decay::type>::type Cartesian_const_iterator; + // typedef typename CGAL::decay()(std::declval(), std::declval()))>::type Cartesian_const_iterator; const Rep& rep() const noexcept { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h index 16174e9a4cb..de13385758d 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Vector_d.h @@ -22,7 +22,6 @@ #include #include #include -#include namespace CGAL { namespace Wrap { diff --git a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h index 030d0f9d409..63ab4c6be9b 100644 --- a/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/Periodic_3_regular_triangulation_3.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -498,7 +497,7 @@ public: // Spatial sorting can only be applied to bare points, so we need an adaptor typedef typename Geom_traits::Construct_point_3 Construct_point_3; - typedef typename cpp11::result_of::type Ret; + typedef decltype(std::declval()(std::declval())) Ret; typedef boost::function_property_map fpmap; typedef CGAL::Spatial_sort_traits_adapter_3 Search_traits_3; diff --git a/STL_Extension/doc/STL_Extension/CGAL/result_of.h b/STL_Extension/doc/STL_Extension/CGAL/result_of.h index e39e27c35f3..507efb3645c 100644 --- a/STL_Extension/doc/STL_Extension/CGAL/result_of.h +++ b/STL_Extension/doc/STL_Extension/CGAL/result_of.h @@ -3,16 +3,18 @@ namespace cpp11 { /*! \ingroup PkgSTLExtensionRef - Alias to the tr1 implementation from boost of the `result_of` mechanism. - When all compilers supported by %CGAL will have a Standard compliant implemention of the - the \cpp11 `decltype` feature, it will become an alias to std::result_of. + Alias to the implementation of the `std::result_of` mechanism. When all compilers + supported by \cgal have a Standard compliant implemention of the `std::invoke_result` + mechanism, it will become an alias to the std::invoke_result. - \sa boost::result_of + \sa std::result_of */ template - struct result_of{ - /// starting from boost version 1.44, it is `boost::tr1_result_of::%type`, and - /// `boost::result_of::%type` otherwise. + struct result_of { + + /*! + It is a type `std::result_of::%type`. + */ typedef unspecified_type type; }; diff --git a/STL_Extension/include/CGAL/transforming_iterator.h b/STL_Extension/include/CGAL/transforming_iterator.h index 16bf7649da5..c77e36669fa 100644 --- a/STL_Extension/include/CGAL/transforming_iterator.h +++ b/STL_Extension/include/CGAL/transforming_iterator.h @@ -12,7 +12,6 @@ #ifndef CGAL_TRANSFORMING_ITERATOR_H #define CGAL_TRANSFORMING_ITERATOR_H #include -#include #include #include #include From 371db977c85a29583124a433fb9e559b5089dc3a Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 20 Aug 2020 14:12:16 +0200 Subject: [PATCH 014/178] better kernel checker --- Kernel_23/include/CGAL/Kernel_checker.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel_checker.h b/Kernel_23/include/CGAL/Kernel_checker.h index a4753265266..bd35c115a08 100644 --- a/Kernel_23/include/CGAL/Kernel_checker.h +++ b/Kernel_23/include/CGAL/Kernel_checker.h @@ -84,10 +84,8 @@ public: { auto res1 = p1(a.first...); auto res2 = p2(a.second...); - if (! cmp(res1, res2)) - { - CGAL_kernel_assertion(false); - } + + CGAL_kernel_assertion(cmp(res1, res2)); return Pairify()(res1, res2); } }; From 263ad6bc991f28fdf00f3d0e893ac23b5cc1d9e7 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 20 Aug 2020 18:25:01 +0200 Subject: [PATCH 015/178] fixed ch3, inter3, otr2, psp, pmp, smsp, mesh3 + cleanup --- .../CGAL/Extreme_points_traits_adapter_3.h | 7 +-- .../test/Intersections_3/call_test.cpp | 12 ++-- Mesh_3/benchmark/Mesh_3/StdAfx.h | 1 - .../Concepts/MeshTriangulationTraits_3.h | 6 +- Mesh_3/include/CGAL/Labeled_mesh_domain_3.h | 9 +-- .../Mesh_3/Robust_intersection_traits_3.h | 62 ++++++++----------- .../Sizing_field_with_aabb_tree.h | 5 +- .../include/CGAL/Polyhedral_mesh_domain_3.h | 4 +- .../OTR_2/Reconstruction_triangulation_2.h | 3 +- .../include/CGAL/structure_point_set.h | 15 ++--- .../Corefinement/intersection_nodes.h | 8 +-- .../internal/Corefinement/predicates.h | 9 +-- .../include/CGAL/Polygon_mesh_slicer.h | 3 +- .../Concepts/SurfaceMeshShortestPathTraits.h | 2 +- .../Surface_mesh_shortest_path.h | 14 ++--- .../function_objects.h | 7 +-- 16 files changed, 61 insertions(+), 106 deletions(-) diff --git a/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h b/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h index adeb88c6e26..dfc0b27c7ba 100644 --- a/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h +++ b/Convex_hull_3/include/CGAL/Extreme_points_traits_adapter_3.h @@ -22,7 +22,6 @@ #include #include -#include namespace CGAL { namespace Convex_hull_3 { @@ -37,14 +36,14 @@ struct Forward_functor Forward_functor(const PointPropertyMap& vpm, const F& f) : F(f), vpm_(vpm) {} template - typename cpp11::result_of::type + decltype(auto) operator()(const Vertex& p, const Vertex& q) const { return static_cast(this)->operator()(get(vpm_, p), get(vpm_, q)); } template - typename cpp11::result_of::type + decltype(auto) operator()(const Vertex& p, const Vertex& q, const Vertex& r) const { return static_cast(this)->operator()(get(vpm_, p), @@ -53,7 +52,7 @@ struct Forward_functor } template - typename cpp11::result_of::type + decltype(auto) operator()(const Vertex& p, const Vertex& q, const Vertex& r, const Vertex& s) const { return static_cast(this)->operator()(get(vpm_, p), diff --git a/Intersections_3/test/Intersections_3/call_test.cpp b/Intersections_3/test/Intersections_3/call_test.cpp index 34c45488e5b..90f595bcbb6 100644 --- a/Intersections_3/test/Intersections_3/call_test.cpp +++ b/Intersections_3/test/Intersections_3/call_test.cpp @@ -25,9 +25,9 @@ typedef CGAL::Bbox_3 Bbox_3; template void call_intersection_global(const A& a, const B& b) { - typename CGAL::cpp11::result_of::type x = CGAL::intersection(a, b); - typename CGAL::cpp11::result_of::type y = CGAL::intersection(b, a); - typename CGAL::cpp11::result_of::type z = CGAL::intersection(b, a); + const auto x = CGAL::intersection(a, b); + const auto y = CGAL::intersection(b, a); + const auto z = CGAL::intersection(b, a); CGAL_USE(x); CGAL_USE(y); CGAL_USE(z); @@ -42,8 +42,8 @@ void call_do_intersect_global(const A& a, const B& b) { template void call_intersection_with_kernel(const A& a, const B& b, const K&) { typedef typename K::Intersect_3 Intersect; - typename CGAL::cpp11::result_of::type x = Intersect()(a, b); - typename CGAL::cpp11::result_of::type y = Intersect()(b, a); + const auto x = Intersect()(a, b); + const auto y = Intersect()(b, a); } template @@ -83,7 +83,7 @@ int main(int argc, char**) // call_intersection_global(Pl(), Cub()); // special - CGAL::cpp11::result_of::type plplpl = CGAL::intersection(Pl(), Pl(), Pl()); + const auto plplpl = CGAL::intersection(Pl(), Pl(), Pl()); call_intersection_global(Tr(), S()); call_intersection_global(Tr(), L()); diff --git a/Mesh_3/benchmark/Mesh_3/StdAfx.h b/Mesh_3/benchmark/Mesh_3/StdAfx.h index 6fee6450e2f..ac0f9e1b5b2 100644 --- a/Mesh_3/benchmark/Mesh_3/StdAfx.h +++ b/Mesh_3/benchmark/Mesh_3/StdAfx.h @@ -145,7 +145,6 @@ #include #include #include -#include #include #include diff --git a/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h b/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h index 0fdacdb302c..4d1af263528 100644 --- a/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h +++ b/Mesh_3/doc/Mesh_3/Concepts/MeshTriangulationTraits_3.h @@ -312,11 +312,11 @@ public: /*! A constructor object that must provide the function operators: - `CGAL::cpp11::result_of< Kernel::Intersect_3(Segment_3, Plane_3)>::%type operator()(Segment_3 s, Plane_3 p)` + `boost::optional< boost::variant< T... > > operator()(Segment_3 s, Plane_3 p)` - `CGAL::cpp11::result_of< Kernel::Intersect_3(Ray_3, Iso_cuboid_3)>::%type operator()(Ray_3 r, Iso_cuboid i)` + `boost::optional< boost::variant< T... > > operator()(Ray_3 r, Iso_cuboid i)` - `CGAL::cpp11::result_of< Kernel::Intersect_3(Segment_3, Iso_cuboid_3)>::%type operator()(Segment_3 s, Iso_cuboid i)` + `boost::optional< boost::variant< T... > > operator()(Segment_3 s, Iso_cuboid i)` which returns the intersection region of two geometrical objects. */ diff --git a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h index 0e4cf7822ab..0dceef7f282 100644 --- a/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Labeled_mesh_domain_3.h @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -590,9 +589,7 @@ public: template Surface_patch clip_to_segment(const Query& query) const { - typename cpp11::result_of::type - clipped = CGAL::intersection(query, r_domain_.bbox_); - + const auto clipped = CGAL::intersection(query, r_domain_.bbox_); if(clipped) if(const Segment_3* s = boost::get(&*clipped)) return this->operator()(*s); @@ -720,9 +717,7 @@ public: template Intersection clip_to_segment(const Query& query) const { - typename cpp11::result_of::type - clipped = CGAL::intersection(query, r_domain_.bbox_); - + const auto clipped = CGAL::intersection(query, r_domain_.bbox_); if(clipped) if(const Segment_3* s = boost::get(&*clipped)) return this->operator()(*s); diff --git a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h index 6611d928a00..3178ebcbb9c 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h @@ -261,15 +261,15 @@ lp_intersection(const typename K::Point_3& p, const typename K::Point_3& q, // returns a point or the empty Object. In case of degeneracy, the empty // Object is returned as well. template -typename cpp11::result_of< - typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3)>::type +decltype(auto) ts_intersection(const typename K::Triangle_3 &t, const typename K::Segment_3 &s, const K & k) { - typedef typename cpp11::result_of< - typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3) - >::type result_type; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) result_type; CGAL_MESH_3_BRANCH_PROFILER(std::string("coplanar/calls in : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -399,8 +399,7 @@ ts_intersection(const typename K::Triangle_3 &t, template -typename cpp11::result_of< - typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3)>::type +decltype(auto) tr_intersection(const typename K::Triangle_3 &t, const typename K::Ray_3 &r, const K& k) @@ -410,9 +409,10 @@ tr_intersection(const typename K::Triangle_3 &t, CGAL_kernel_precondition( ! k.is_degenerate_3_object()(t) ) ; CGAL_kernel_precondition( ! k.is_degenerate_3_object()(r) ) ; - typedef typename cpp11::result_of< - typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3) - >::type result_type; + typedef decltype( + std::declval()( + std::declval(), + std::declval())) result_type; typedef typename K::Point_3 Point_3; @@ -471,20 +471,12 @@ public: typedef typename K_::Segment_3 Segment_3; typedef typename K_::Ray_3 Ray_3; - template - struct result; - - template - struct result { - typedef typename cpp11::result_of::type type; - }; - typedef Exact_predicates_exact_constructions_kernel EK; typedef Cartesian_converter To_exact; typedef Cartesian_converter Back_from_exact; template - typename cpp11::result_of::type + decltype(auto) operator() (const T1& t, const T2& s) const { // Switch to exact @@ -493,28 +485,31 @@ public: EK::Intersect_3 exact_intersection = EK().intersect_3_object(); // Cartesian converters have an undocumented, optional< variant > operator - return typename cpp11::result_of::type - (back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); + typedef decltype( + std::declval()( + std::declval(), std::declval())) result_type; + + return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); } - typename cpp11::result_of::type + decltype(auto) operator()(const Segment_3& s, const Triangle_3& t) const { return ts_intersection(t, s, K_()); } - typename cpp11::result_of::type + decltype(auto) operator()(const Triangle_3& t, const Segment_3& s) const { return ts_intersection(t, s, K_()); } - typename cpp11::result_of::type + decltype(auto) operator()(const Ray_3& r, const Triangle_3& t) const { return tr_intersection(t, r, K_()); } - typename cpp11::result_of::type + decltype(auto) operator()(const Triangle_3& t, const Ray_3& r) const { return tr_intersection(t, r, K_()); @@ -531,20 +526,12 @@ public: typedef typename K_::Triangle_3 Triangle_3; typedef typename K_::Segment_3 Segment_3; - template - struct result; - - template - struct result { - typedef typename cpp11::result_of::type type; - }; - typedef Exact_predicates_exact_constructions_kernel EK; typedef Cartesian_converter To_exact; typedef Cartesian_converter Back_from_exact; template - typename cpp11::result_of::type + decltype(auto) operator() (const T1& t, const T2& s) const { // Switch to exact @@ -553,8 +540,11 @@ public: EK::Intersect_3 exact_intersection = EK().intersect_3_object(); // Cartesian converters have an undocumented, optional< variant > operator - return typename cpp11::result_of::type - (back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); + typedef decltype( + std::declval()( + std::declval(), std::declval())) result_type; + + return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); } }; diff --git a/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h b/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h index c27f99353ec..bda94612b75 100644 --- a/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h +++ b/Mesh_3/include/CGAL/Mesh_3/experimental/Sizing_field_with_aabb_tree.h @@ -384,8 +384,6 @@ struct Sizing_field_with_aabb_tree //Compute distance to the curve on which p lies typedef typename GeomTraits::Segment_3 Segment_3; typedef typename GeomTraits::Plane_3 Plane_3; - typedef typename CGAL::cpp11::result_of< - typename GeomTraits::Intersect_3(Segment_3, Plane_3)>::type Intersection_result; const typename Input_curves_AABB_tree_::Point_and_primitive_id& ppid = domain.curves_aabb_tree().closest_point_and_primitive(p); @@ -416,8 +414,7 @@ struct Sizing_field_with_aabb_tree if (curve_id != prim.id().first->first) continue;//don't deal with the same curves as what is done above - Intersection_result int_res - = CGAL::intersection(prim.datum(), curr_ortho_plane); + const auto int_res = CGAL::intersection(prim.datum(), curr_ortho_plane); if (int_res) { if (const Point_3* pp = boost::get(&*int_res)) diff --git a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h index 7b9fbd23f95..ce7d0088fe3 100644 --- a/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h +++ b/Mesh_3/include/CGAL/Polyhedral_mesh_domain_3.h @@ -439,9 +439,7 @@ public: if(r_domain_.query_is_cached(q)) { const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id(); - typename cpp11::result_of< - typename IGT::Intersect_3(typename Primitive::Datum, Query)>::type o - = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q); + const auto o = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q); intersection = o ? Intersection_and_primitive_id(*o, primitive_id) : AABB_intersection(); diff --git a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h index 33c956e19cb..f952c9232e8 100644 --- a/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h +++ b/Optimal_transportation_reconstruction_2/include/CGAL/OTR_2/Reconstruction_triangulation_2.h @@ -787,8 +787,7 @@ public: pt, geom_traits().construct_vector_2_object()(pt, ps)); boost::optional Dqt; - typename CGAL::cpp11::result_of::type - result = intersection(lab, lts); + const auto result = intersection(lab, lts); if (result) { const Point* iq = boost::get(&(*result)); diff --git a/Point_set_processing_3/include/CGAL/structure_point_set.h b/Point_set_processing_3/include/CGAL/structure_point_set.h index c9f882617df..7aa3fc27957 100644 --- a/Point_set_processing_3/include/CGAL/structure_point_set.h +++ b/Point_set_processing_3/include/CGAL/structure_point_set.h @@ -780,9 +780,7 @@ private: double angle_A = std::acos (CGAL::abs (plane1.orthogonal_vector() * plane2.orthogonal_vector())); double angle_B = CGAL_PI - angle_A; - typename cpp11::result_of::type - result = CGAL::intersection(plane1, plane2); - + const auto result = CGAL::intersection(plane1, plane2); if (!result) { #ifdef CGAL_PSP3_VERBOSE @@ -1009,8 +1007,7 @@ private: pts2.push_back (m_points[inde]); } - typename cpp11::result_of::type - result = CGAL::intersection (plane1, ortho); + auto result = CGAL::intersection (plane1, ortho); if (result) { if (const Line* l = boost::get(&*result)) @@ -1174,16 +1171,12 @@ private: const Plane& plane2 = m_planes[m_corners[i].planes[1]]; const Plane& plane3 = m_planes[m_corners[i].planes[2]]; - typename cpp11::result_of::type - result = CGAL::intersection(plane1, plane2); - + const auto result = CGAL::intersection(plane1, plane2); if (result) { if (const Line* l = boost::get(&*result)) { - typename cpp11::result_of::type - result2 = CGAL::intersection(*l, plane3); - + const auto result2 = CGAL::intersection(*l, plane3); if (result2) { if (const Point* p = boost::get(&*result2)) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h index 9d43f9cc043..22fda45ad20 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_nodes.h @@ -246,9 +246,7 @@ public: p3(to_exact( get(vpm, source(h3,tm)) ), to_exact( get(vpm, target(h3,tm)) ), to_exact( get(vpm, target(next(h3,tm),tm)))); - typename cpp11::result_of< - Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3) - >::type inter_res = exact_intersection(p1, p2, p3); + const auto inter_res = exact_intersection(p1, p2, p3); CGAL_assertion(inter_res != boost::none); const Exact_kernel::Point_3* pt = @@ -363,9 +361,7 @@ public: p3(get(vpm, source(h3,tm)), get(vpm, target(h3,tm)), get(vpm, target(next(h3,tm),tm))); - typename cpp11::result_of< - typename Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3) - >::type inter_res = intersection(p1, p2, p3); + const auto inter_res = intersection(p1, p2, p3); CGAL_assertion(inter_res != boost::none); const Point_3* pt = diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h index a296e8de90a..5ac3ff63be9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h @@ -84,11 +84,8 @@ bool sorted_around_edge( typename Kernel::Orientation_3 orientation; typedef typename Kernel::Point_3 Point_3; - typedef typename cpp11::result_of< - typename Kernel::Orientation_3(Point_3, Point_3, Point_3, Point_3)>::type - Orientation; - Orientation s0 = orientation(o_prime, o, p1, p2); + const auto s0 = orientation(o_prime, o, p1, p2); if ( s0==COPLANAR ) { //o, o_prime, p1 and p2 are coplanar @@ -98,8 +95,8 @@ bool sorted_around_edge( } //o, o_prime, p1 and p2 are not coplanar - Orientation s1 = orientation(o_prime, o, p1, q); - Orientation s2 = orientation(o_prime, o, q , p2); + const auto s1 = orientation(o_prime, o, p1, q); + const auto s2 = orientation(o_prime, o, q , p2); if (s0 == POSITIVE) // the angle p1,o,p2 is smaller that Pi. return ( s1 == POSITIVE ) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h index 499ed2506a4..9c80a2e630a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_slicer.h @@ -276,8 +276,7 @@ class Polygon_mesh_slicer get(m_vpmap, source(ed, m_tmesh)), get(m_vpmap,target(ed, m_tmesh)) ); - typename cpp11::result_of::type - inter = intersect_3(m_plane, s); + const auto inter = intersect_3(m_plane, s); CGAL_assertion(inter != boost::none); const Point_3* pt_ptr = boost::get(&(*inter)); current_poly.push_back( *pt_ptr ); diff --git a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h index 811ad3de64c..ff38140189c 100644 --- a/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h +++ b/Surface_mesh_shortest_path/doc/Surface_mesh_shortest_path/Concepts/SurfaceMeshShortestPathTraits.h @@ -152,7 +152,7 @@ public: /*! Function object type. Must provide - `CGAL::cpp11::result_of::%type operator()(A obj1, B obj2)` + `boost::optional< boost::variant< T... > > operator()(A obj1, B obj2)` to compute the intersection between `obj1` and `obj2`, where `A` and `B` can be any type amongst `Line_2`, `Ray_2`, `Segment_2`. */ diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h index 6d24ecfcab3..bcb3c685778 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/Surface_mesh_shortest_path.h @@ -977,8 +977,6 @@ private: typename Traits::Construct_point_on_2 cpo2(m_traits.construct_point_on_2_object()); typename Traits::Compute_parametric_distance_along_segment_2 pdas2(m_traits.compute_parametric_distance_along_segment_2_object()); - typedef typename cpp11::result_of::type LineLineIntersectResult; - Point_2 leftPoint; Point_2 rightPoint; @@ -1003,7 +1001,7 @@ private: } else { - LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(leftBoundary)); + const auto cgalIntersection = i2(cl2(segment), cl2(leftBoundary)); if (!cgalIntersection || !boost::get(&*cgalIntersection)) { @@ -1015,7 +1013,7 @@ private: } else { - Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = boost::get(&*cgalIntersection); FT t0 = pdas2(cs2(segment), ct2(segment), *result); if (t0 >= FT(1)) @@ -1061,7 +1059,7 @@ private: } else { - LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(rightBoundary)); + const auto cgalIntersection = i2(cl2(segment), cl2(rightBoundary)); if (!cgalIntersection || !boost::get(&*cgalIntersection)) { @@ -1073,7 +1071,7 @@ private: } else { - Point_2* result = boost::get(&*cgalIntersection); + const Point_2* result = boost::get(&*cgalIntersection); FT t0 = pdas2(cs2(segment), ct2(segment), *result); if (t0 <= FT(0)) @@ -1695,8 +1693,6 @@ private: typename Traits::Construct_target_2 construct_target_2(m_traits.construct_target_2_object()); typename Traits::Intersect_2 intersect_2(m_traits.intersect_2_object()); - typedef typename cpp11::result_of::type LineLineIntersectResult; - Cone_tree_node* current = startNode; Point_2 currentLocation(startLocation); @@ -1711,7 +1707,7 @@ private: const Point_2& currentSourceImage = current->source_image(); Ray_2 rayToLocation(construct_ray_2(currentSourceImage, currentLocation)); - LineLineIntersectResult cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation)); + const auto cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation)); CGAL_assertion(bool(cgalIntersection)); diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h index b637938b366..6dd44eec600 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h @@ -25,7 +25,6 @@ #include #include #include -#include #include #include @@ -459,12 +458,10 @@ public: result_type operator () (const Segment_2& s1, const Line_2& l1, const Segment_2& s2, const Line_2& l2) const { - typedef typename CGAL::cpp11::result_of::type LineLineIntersectResult; - Line_2 s1Line(m_construct_line_2(s1)); Line_2 s2Line(m_construct_line_2(s2)); - LineLineIntersectResult intersectResult1(m_intersect_2(s1Line, l1)); + const auto intersectResult1 = m_intersect_2(s1Line, l1); CGAL_assertion(bool(intersectResult1)); if (!intersectResult1) return CGAL::SMALLER; @@ -476,7 +473,7 @@ public: CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *p1_ptr);) CGAL_assertion(t1 >= FT(-1)/FT(100000) && t1 <= FT(1)+FT(1)/FT(100000)); - LineLineIntersectResult intersectResult2 = m_intersect_2(s2Line, l2); + const auto intersectResult2 = m_intersect_2(s2Line, l2); CGAL_assertion(bool(intersectResult2)); if (!intersectResult2) return CGAL::SMALLER; From 005f237f5515b81dbc6eba460cab3decd7c46692 Mon Sep 17 00:00:00 2001 From: oboes Date: Tue, 29 Sep 2020 16:31:56 +0200 Subject: [PATCH 016/178] Add mollification step to avoid degenerate faces Degenerate faces (which can cause an infinite loop in `loop_over_edges`) are handled by using the mollification step described in section 4.5 of N. Sharp & K. Crane "A Laplacian for Nonmanifold Triangle Meshes" (2020). The tolerance value is set to 1/1000 of the minimum non-zero edge length. --- .../Intrinsic_Delaunay_triangulation_3.h | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index bbea606cf8b..9187345144a 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -285,6 +285,29 @@ private: return CGAL::sqrt(S*(S-a)*(S-b)*(S-c)); } + // Mollification strategy to avoid degeneracies + void + mollify(double delta) + { + // compute smallest length epsilon we can add to + // all edges to ensure that the strict triangle + // inequality holds with a tolerance of delta + double epsilon = 0; + for(halfedge_descriptor hd : halfedges(m_intrinsic_tm)) { + halfedge_descriptor hd2 = next(hd, m_intrinsic_tm); + halfedge_descriptor hd3 = next(hd2,m_intrinsic_tm); + Index i = get(edge_id_map, edge(hd,m_intrinsic_tm)); + Index j = get(edge_id_map, edge(hd2,m_intrinsic_tm)); + Index k = get(edge_id_map, edge(hd3,m_intrinsic_tm)); + double ineq = edge_lengths[j] + edge_lengths[k] - edge_lengths[i]; + epsilon = std::max(epsilon, std::max(0., delta-ineq)); + } + // update edge lengths + for(edge_descriptor ed : edges(m_intrinsic_tm)) { + Index i = get(edge_id_map, ed); + edge_lengths[i] += epsilon; + } + } void loop_over_edges(edge_stack stack, std::vector& marked_edges) @@ -365,13 +388,16 @@ private: Index edge_i = 0; VertexPointMap vpm_intrinsic_tm = get(boost::vertex_point,m_intrinsic_tm); + double min_length = (std::numeric_limits::max)(); for(edge_descriptor ed : edges(m_intrinsic_tm)) { edge_lengths[edge_i] = CGAL::sqrt(to_double(squared_distance(get(vpm_intrinsic_tm, source(ed,m_intrinsic_tm)), get(vpm_intrinsic_tm, target(ed,m_intrinsic_tm))))); // Polygon_mesh_processing::edge_length(halfedge(ed,m_intrinsic_tm),m_intrinsic_tm); + if (edge_lengths[edge_i] != 0 && edge_lengths[edge_i] < min_length) min_length = edge_lengths[edge_i]; put(edge_id_map, ed, edge_i++); stack.push(ed); } + mollify(min_length*1e-4); loop_over_edges(stack, mark_edges); //now that edges are calculated, go through and for each face, calculate the vertex positions around it From 6aa3d6d5833e964e64849d5f3886a3cf427e0725 Mon Sep 17 00:00:00 2001 From: Olivier Boes Date: Mon, 5 Oct 2020 16:54:11 +0200 Subject: [PATCH 017/178] Update Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h Co-authored-by: Sebastien Loriot --- .../Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index 9187345144a..d9ec5147f53 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -300,7 +300,7 @@ private: Index j = get(edge_id_map, edge(hd2,m_intrinsic_tm)); Index k = get(edge_id_map, edge(hd3,m_intrinsic_tm)); double ineq = edge_lengths[j] + edge_lengths[k] - edge_lengths[i]; - epsilon = std::max(epsilon, std::max(0., delta-ineq)); + epsilon = (std::max)(epsilon, (std::max)(0., delta-ineq)); } // update edge lengths for(edge_descriptor ed : edges(m_intrinsic_tm)) { From a8a1b2de3e60a884e6445fa8e5f33d0822d4a430 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 13 Nov 2020 16:33:46 +0100 Subject: [PATCH 018/178] degenerate faces are allowed with Intrinsic_Delaunay Mode thanks to mollification step --- .../Heat_method_3/Surface_mesh_geodesic_distances_3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index d1499bbca35..f193d28ab07 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -769,11 +769,11 @@ struct Base_helper * time after changes to the set of sources. * * \tparam TriangleMesh a triangulated surface mesh, model of `FaceListGraph` and `HalfedgeListGraph` - * with no degenerate faces * \tparam Mode must be `Intrinsic_Delaunay` to indicate that an intrinsic Delaunay triangulation is internally constructed * or `Direct` to indicate that the input mesh should be used as is. * If `Intrinsic_Delaunay`, then the type `TriangleMesh` must have an internal property for `vertex_point` * and its value type must be the same as the value type of `VertexPointMap`. + * If `Direct`, then the input mesh should not have any degenerate faces. * \tparam VertexPointMap a model of `ReadablePropertyMap` with * `boost::graph_traits::%vertex_descriptor` as key and * `Traits::Point_3` as value type. @@ -940,7 +940,7 @@ public: * \tparam VertexDistanceMap a property map model of `WritablePropertyMap` * with `vertex_descriptor` as key type and `double` as value type. * \param vdm the vertex distance map to be filled - * \pre the support triangle mesh does not have any degenerate faces + * \pre If `Mode` is `Direct`, the support triangle mesh does not have any degenerate faces * \warning The key type is `double` even when used with an exact kernel. **/ template @@ -961,7 +961,7 @@ public: /// \tparam Mode either the tag `Direct` or `Intrinsic_Delaunay`, which determines if the geodesic distance /// is computed directly on the mesh or if the intrinsic Delaunay triangulation is applied first. /// The default is `Intrinsic_Delaunay`. -/// \pre `tm` does not have any degenerate faces +/// \pre If `Mode` is `Direct`, `tm` does not have any degenerate faces /// \warning The return type is `double` even when used with an exact kernel. /// /// \sa `CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3` @@ -1003,7 +1003,7 @@ estimate_geodesic_distances(const TriangleMesh& tm, /// \tparam Mode either the tag `Direct` or `Intrinsic_Delaunay`, which determines if the geodesic distance /// is computed directly on the mesh or if the intrinsic Delaunay triangulation is applied first. /// The default is `Intrinsic_Delaunay`. -/// \pre `tm` does not have any degenerate faces +/// \pre If `Mode` is `Direct`, `tm` mesh does not have any degenerate faces /// \warning The return type is `double` even when used with an exact kernel. /// \sa `CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3` template From 14cc8714baf6c6261019a19edbafdc0b505a2d67 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 20 Nov 2020 15:33:25 +0100 Subject: [PATCH 019/178] with mollification degenerate faces are allowed with Mode=Intrinsic_Delaunay --- .../Heat_method_3/Surface_mesh_geodesic_distances_3.h | 9 +++------ .../internal/Intrinsic_Delaunay_triangulation_3.h | 7 +++++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index f193d28ab07..96f7846baa6 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -485,9 +485,6 @@ public: template void estimate_geodesic_distances(VertexDistanceMap vdm) { - CGAL_precondition( - !CGAL::Heat_method_3::internal::has_degenerate_faces(triangle_mesh(), Traits())); - if(is_empty(tm)){ return; } @@ -666,6 +663,9 @@ struct Base_helper template void estimate_geodesic_distances(VertexDistanceMap vdm) { + CGAL_assertion( + !CGAL::Heat_method_3::internal::has_degenerate_faces( + base().triangle_mesh(), Traits())); base().estimate_geodesic_distances(vdm); } }; @@ -751,9 +751,6 @@ struct Base_helper template void estimate_geodesic_distances(VertexDistanceMap vdm) { - CGAL_precondition( - !CGAL::Heat_method_3::internal::has_degenerate_faces( - this->m_idt.triangle_mesh(), Traits())); base().estimate_geodesic_distances(this->m_idt.vertex_distance_map(vdm)); } }; diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index d9ec5147f53..b5aff168bb7 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -287,7 +287,7 @@ private: // Mollification strategy to avoid degeneracies void - mollify(double delta) + mollify(const double delta) { // compute smallest length epsilon we can add to // all edges to ensure that the strict triangle @@ -397,7 +397,10 @@ private: put(edge_id_map, ed, edge_i++); stack.push(ed); } - mollify(min_length*1e-4); + + if(internal::has_degenerate_faces(m_intrinsic_tm, Traits())) + mollify(min_length*1e-4); + loop_over_edges(stack, mark_edges); //now that edges are calculated, go through and for each face, calculate the vertex positions around it From bc18b7d331d18554ba98b5865b5fe524e4b4ee5a Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 20 Nov 2020 15:35:28 +0100 Subject: [PATCH 020/178] add a test for Intrinsic_Delaunay Mode with an input with degenerate faces --- .../test/Heat_method_3/CMakeLists.txt | 3 + .../data/rectangle_with_degenerate_faces.off | 762 ++++++++++++++++++ ...eat_method_surface_mesh_intrinsic_test.cpp | 115 +++ 3 files changed, 880 insertions(+) create mode 100644 Heat_method_3/test/Heat_method_3/data/rectangle_with_degenerate_faces.off create mode 100644 Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_intrinsic_test.cpp diff --git a/Heat_method_3/test/Heat_method_3/CMakeLists.txt b/Heat_method_3/test/Heat_method_3/CMakeLists.txt index 962f84378b1..aa9a6963ac5 100644 --- a/Heat_method_3/test/Heat_method_3/CMakeLists.txt +++ b/Heat_method_3/test/Heat_method_3/CMakeLists.txt @@ -48,3 +48,6 @@ target_link_libraries(heat_method_surface_mesh_test PUBLIC CGAL::Eigen_support) create_single_source_cgal_program("heat_method_surface_mesh_direct_test.cpp") target_link_libraries(heat_method_surface_mesh_direct_test PUBLIC CGAL::Eigen_support) +create_single_source_cgal_program("heat_method_surface_mesh_intrinsic_test.cpp") +target_link_libraries(heat_method_surface_mesh_intrinsic_test + PUBLIC CGAL::Eigen_support) diff --git a/Heat_method_3/test/Heat_method_3/data/rectangle_with_degenerate_faces.off b/Heat_method_3/test/Heat_method_3/data/rectangle_with_degenerate_faces.off new file mode 100644 index 00000000000..40ce808fa7b --- /dev/null +++ b/Heat_method_3/test/Heat_method_3/data/rectangle_with_degenerate_faces.off @@ -0,0 +1,762 @@ +OFF +270 490 0 +0 0 0 +1 1 0 +2 1 0 +0 1 0 +1 0 0 +2 0 0 +1 0.5 0 +0.53125 0.47916666666666669 0 +1.5 0.5 0 +0.48958333333333331 0.22916666666666666 0 +0.5 1 0 +0 0.5 0 +1.5 0 0 +2 0.5 0 +1.5 1 0 +1 0.5 0 +0.5 0 0 +0.75 0.75 0 +0.28749999999999998 0.25 0 +0.25 0.75 0 +1.75 0.75 0 +1.25 0.25 0 +1.75 0.25 0 +1.25 0.75 0 +0.23958333333333334 0.10416666666666667 0 +0.75 0.375 0 +0.75 0.125 0 +1 0.75 0 +1 0.25 0 +0.75 0.48214285714285715 0 +0.75 1 0 +0.25 1 0 +0.5 0.75 0 +0 0.75 0 +0 0.25 0 +0.25 0.5 0 +1.25 0 0 +1.75 0 0 +1.5 0.25 0 +2 0.25 0 +2 0.75 0 +1.75 0.5 0 +1.75 1 0 +1.25 1 0 +1.5 0.75 0 +1 0.75 0 +1 0.25 0 +1.25 0.5 0 +0.25 0 0 +0.75 0 0 +0.875 0.1875 0 +0.85416666666666663 0.85416666666666663 0 +0.625 0.6428571428571429 0 +0.85416666666666663 0.64583333333333337 0 +0.625 0.8571428571428571 0 +0.35714285714285715 0.375 0 +0.125 0.15625 0 +0.14285714285714285 0.375 0 +0.375 0.625 0 +0.14583333333333334 0.85416666666666663 0 +0.14285714285714285 0.625 0 +0.375 0.8571428571428571 0 +1.8541666666666667 0.85416666666666663 0 +1.625 0.625 0 +1.8571428571428572 0.625 0 +1.625 0.8571428571428571 0 +1.375 0.375 0 +1.1458333333333333 0.14583333333333334 0 +1.375 0.14285714285714285 0 +1.1428571428571428 0.375 0 +1.625 0.375 0 +1.8541666666666667 0.14583333333333334 0 +1.8571428571428572 0.375 0 +1.625 0.14285714285714285 0 +1.375 0.625 0 +1.1458333333333333 0.85416666666666663 0 +1.1428571428571428 0.625 0 +1.375 0.8571428571428571 0 +0.125 0.0625 0 +0.3482142857142857 0.17857142857142858 0 +0.375 0.072916666666666671 0 +0.5982142857142857 0.3125 0 +0.875 0.42708333333333331 0 +0.625 0.42708333333333331 0 +0.625 0.1875 0 +0.875 0.072916666666666671 0 +0.625 0.072916666666666671 0 +0.875 0.3125 0 +0.52500000000000002 0.40000000000000002 0 +0.5 0.125 0 +0.375 0.28125 0 +0.75 0.25 0 +1 0.625 0 +1 0.875 0 +0.875 0.75 0 +1 0.125 0 +1 0.375 0 +0.625 0.51249999999999996 0 +0.875 0.51249999999999996 0 +0.75 0.625 0 +0.875 1 0 +0.625 1 0 +0.75 0.875 0 +0.375 1 0 +0.125 1 0 +0.25 0.875 0 +0.5 0.875 0 +0.5 0.625 0 +0.625 0.75 0 +0.375 0.75 0 +0 0.875 0 +0 0.625 0 +0.125 0.75 0 +0 0.375 0 +0 0.125 0 +0.125 0.25 0 +0.125 0.5 0 +0.375 0.5 0 +0.25 0.625 0 +0.25 0.375 0 +1.125 0 0 +1.375 0 0 +1.25 0.125 0 +1.625 0 0 +1.875 0 0 +1.75 0.125 0 +1.5 0.125 0 +1.5 0.375 0 +1.375 0.25 0 +1.625 0.25 0 +2 0.125 0 +2 0.375 0 +1.875 0.25 0 +2 0.625 0 +2 0.875 0 +1.875 0.75 0 +1.875 0.5 0 +1.625 0.5 0 +1.75 0.375 0 +1.75 0.625 0 +1.875 1 0 +1.625 1 0 +1.75 0.875 0 +1.375 1 0 +1.125 1 0 +1.25 0.875 0 +1.5 0.875 0 +1.5 0.625 0 +1.625 0.75 0 +1.375 0.75 0 +1 0.875 0 +1 0.625 0 +1.125 0.75 0 +1 0.375 0 +1 0.125 0 +1.125 0.25 0 +1.125 0.5 0 +1.375 0.5 0 +1.25 0.625 0 +1.25 0.375 0 +0.125 0 0 +0.375 0 0 +0.625 0 0 +0.875 0 0 +1.4583333333333333 0.79166666666666663 0 +1.3125 0.9375 0 +1.4375 0.9375 0 +1.2916666666666667 0.79166666666666663 0 +1.0625 0.6875 0 +1.2083333333333333 0.54166666666666663 0 +1.0625 0.5625 0 +0.91666666666666663 0.91666666666666663 0 +0.79166666666666663 0.79166666666666663 0 +0.9375 0.8125 0 +0.8125 0.9375 0 +0.70833333333333337 0.70833333333333337 0 +0.5625 0.5625 0 +0.6875 0.5625 0 +0.54166666666666663 0.70833333333333337 0 +0.79166666666666663 0.70833333333333337 0 +0.91666666666666663 0.58333333333333337 0 +0.9375 0.6875 0 +0.8125 0.5625 0 +0.70833333333333337 0.79166666666666663 0 +0.5625 0.9375 0 +0.54166666666666663 0.79166666666666663 0 +0.6875 0.9375 0 +0.4375 0.4375 0 +0.28749999999999998 0.3125 0 +0.46875 0.33333333333333331 0 +0.29166666666666669 0.45833333333333331 0 +0.21875 0.20833333333333334 0 +1.2083333333333333 0.70833333333333337 0 +0.0625 0.21249999999999999 0 +0.20833333333333334 0.29166666666666669 0 +0.0625 0.4375 0 +0.0625 0.3125 0 +0.20833333333333334 0.45833333333333331 0 +0.45833333333333331 0.54166666666666663 0 +0.29166666666666669 0.70833333333333337 0 +0.29166666666666669 0.54166666666666663 0 +0.45833333333333331 0.70833333333333337 0 +0.20833333333333334 0.79166666666666663 0 +0.083333333333333329 0.91666666666666663 0 +0.0625 0.8125 0 +0.1875 0.9375 0 +0.20833333333333334 0.70833333333333337 0 +0.0625 0.5625 0 +0.20833333333333334 0.54166666666666663 0 +0.0625 0.6875 0 +0.29166666666666669 0.79166666666666663 0 +0.4375 0.9375 0 +0.3125 0.9375 0 +0.45833333333333331 0.79166666666666663 0 +1.9166666666666667 0.91666666666666663 0 +1.7916666666666667 0.79166666666666663 0 +1.9375 0.8125 0 +1.8125 0.9375 0 +1.7083333333333333 0.70833333333333337 0 +1.5416666666666667 0.54166666666666663 0 +1.7083333333333333 0.54166666666666663 0 +1.5416666666666667 0.70833333333333337 0 +1.7916666666666667 0.70833333333333337 0 +1.9375 0.5625 0 +1.9375 0.6875 0 +1.7916666666666667 0.54166666666666663 0 +1.7083333333333333 0.79166666666666663 0 +1.5625 0.9375 0 +1.5416666666666667 0.79166666666666663 0 +1.6875 0.9375 0 +1.4583333333333333 0.45833333333333331 0 +1.2916666666666667 0.29166666666666669 0 +1.4583333333333333 0.29166666666666669 0 +1.2916666666666667 0.45833333333333331 0 +1.2083333333333333 0.20833333333333334 0 +1.0833333333333333 0.083333333333333329 0 +1.1875 0.0625 0 +1.0625 0.1875 0 +1.2916666666666667 0.20833333333333334 0 +1.4375 0.0625 0 +1.4583333333333333 0.20833333333333334 0 +1.3125 0.0625 0 +1.2083333333333333 0.29166666666666669 0 +1.0625 0.4375 0 +1.0625 0.3125 0 +1.2083333333333333 0.45833333333333331 0 +1.5416666666666667 0.45833333333333331 0 +1.7083333333333333 0.29166666666666669 0 +1.7083333333333333 0.45833333333333331 0 +1.5416666666666667 0.29166666666666669 0 +1.7916666666666667 0.20833333333333334 0 +1.9166666666666667 0.083333333333333329 0 +1.9375 0.1875 0 +1.8125 0.0625 0 +1.7916666666666667 0.29166666666666669 0 +1.9375 0.4375 0 +1.7916666666666667 0.45833333333333331 0 +1.9375 0.3125 0 +1.7083333333333333 0.20833333333333334 0 +1.5625 0.0625 0 +1.6875 0.0625 0 +1.5416666666666667 0.20833333333333334 0 +1.4583333333333333 0.54166666666666663 0 +1.2916666666666667 0.70833333333333337 0 +1.2916666666666667 0.54166666666666663 0 +1.4583333333333333 0.70833333333333337 0 +1.2083333333333333 0.79166666666666663 0 +1.0833333333333333 0.91666666666666663 0 +1.0625 0.8125 0 +1.1875 0.9375 0 +3 94 172 179 +3 118 199 206 +3 138 247 254 +3 158 263 192 +3 91 26 50 +3 15 6 96 +3 90 9 189 +3 108 175 183 +3 128 231 238 +3 148 218 226 +3 167 263 149 +3 228 65 146 +3 105 202 210 +3 115 191 194 +3 125 250 258 +3 135 215 222 +3 145 266 167 +3 155 234 242 +3 27 15 151 +3 95 28 50 +3 99 53 179 +3 179 53 94 +3 90 55 188 +3 188 18 90 +3 112 60 206 +3 206 60 118 +3 139 64 222 +3 222 64 135 +3 122 68 238 +3 238 68 128 +3 132 72 254 +3 254 72 138 +3 152 76 192 +3 192 76 158 +3 48 161 80 +3 24 79 191 +3 88 187 189 +3 166 14 143 +3 91 81 84 +3 165 166 143 +3 94 53 181 +3 15 27 92 +3 149 265 164 +3 46 28 95 +3 181 173 94 +3 99 52 177 +3 211 61 106 +3 209 60 112 +3 182 53 99 +3 212 205 105 +3 207 195 116 +3 114 0 78 +3 117 187 198 +3 196 193 115 +3 259 73 126 +3 257 72 132 +3 127 70 246 +3 260 253 125 +3 255 223 136 +3 135 64 224 +3 137 219 246 +3 224 216 135 +3 166 77 146 +3 168 76 152 +3 246 70 137 +3 165 269 145 +3 170 243 156 +3 93 45 150 +3 241 68 122 +3 28 46 153 +3 157 230 262 +3 244 237 155 +3 80 24 48 +3 85 26 49 +3 227 14 166 +3 85 4 95 +3 173 171 51 +3 93 1 171 +3 107 58 198 +3 52 176 177 +3 99 177 182 +3 53 180 181 +3 185 178 108 +3 106 61 213 +3 189 187 55 +3 88 7 187 +3 263 74 149 +3 115 57 196 +3 116 60 207 +3 57 195 196 +3 200 190 117 +3 118 60 208 +3 105 61 212 +3 59 203 204 +3 208 200 118 +3 116 197 208 +3 106 184 211 +3 61 211 212 +3 216 214 62 +3 134 2 214 +3 225 64 139 +3 137 70 248 +3 136 72 255 +3 64 223 224 +3 228 221 148 +3 146 77 164 +3 249 70 127 +3 128 68 240 +3 155 69 244 +3 67 235 236 +3 240 232 128 +3 126 73 261 +3 156 76 170 +3 69 243 244 +3 248 220 137 +3 138 72 256 +3 125 73 260 +3 71 251 252 +3 256 248 138 +3 136 225 256 +3 126 239 259 +3 73 259 260 +3 264 233 157 +3 158 76 169 +3 145 77 165 +3 75 267 268 +3 169 264 158 +3 156 245 169 +3 146 227 166 +3 77 166 165 +3 89 9 79 +3 78 0 160 +3 91 25 81 +3 191 56 24 +3 80 161 16 +3 78 160 48 +3 98 180 182 +3 189 9 81 +3 87 28 96 +3 91 50 87 +3 97 29 177 +3 96 6 82 +3 86 162 49 +3 80 16 89 +3 95 50 85 +3 84 9 89 +3 86 84 89 +3 87 25 91 +3 164 228 146 +3 87 50 28 +3 88 81 83 +3 89 16 86 +3 83 7 88 +3 89 79 80 +3 90 18 79 +3 18 188 194 +3 97 7 83 +3 49 163 85 +3 173 51 94 +3 92 6 15 +3 173 27 93 +3 93 27 45 +3 17 175 179 +3 93 171 173 +3 96 82 87 +3 95 4 154 +3 92 27 181 +3 153 15 96 +3 83 25 29 +3 7 176 198 +3 98 29 82 +3 29 25 82 +3 17 172 183 +3 82 6 98 +3 102 51 174 +3 106 54 184 +3 94 51 172 +3 101 184 186 +3 205 59 105 +3 205 31 104 +3 206 199 19 +3 104 203 205 +3 178 52 108 +3 103 31 212 +3 83 29 97 +3 109 58 201 +3 179 172 17 +3 107 52 178 +3 118 58 199 +3 32 185 213 +3 112 59 204 +3 195 57 116 +3 19 199 210 +3 111 207 209 +3 193 56 115 +3 78 56 114 +3 191 79 18 +3 114 56 193 +3 190 35 197 +3 113 34 196 +3 189 81 88 +3 119 55 190 +3 19 202 206 +3 190 55 117 +3 79 9 90 +3 200 58 118 +3 122 67 236 +3 126 68 239 +3 21 231 242 +3 121 239 241 +3 253 71 125 +3 253 37 124 +3 254 247 22 +3 124 251 253 +3 232 66 128 +3 123 37 260 +3 8 219 262 +3 129 70 249 +3 21 234 238 +3 127 66 232 +3 138 70 247 +3 38 240 261 +3 132 71 252 +3 223 64 136 +3 22 247 258 +3 131 255 257 +3 216 62 135 +3 216 40 134 +3 20 218 222 +3 134 214 216 +3 220 41 225 +3 133 40 224 +3 8 230 246 +3 139 63 220 +3 22 250 254 +3 220 63 137 +3 20 215 226 +3 248 70 138 +3 142 62 217 +3 146 65 227 +3 135 62 215 +3 141 227 229 +3 269 75 145 +3 269 43 144 +3 192 263 23 +3 144 267 269 +3 221 63 148 +3 143 43 165 +3 137 63 219 +3 149 74 265 +3 222 215 20 +3 147 63 221 +3 158 74 263 +3 44 228 164 +3 152 75 268 +3 150 1 93 +3 243 69 156 +3 151 45 27 +3 23 263 167 +3 151 170 168 +3 237 67 155 +3 96 28 153 +3 237 46 154 +3 154 46 95 +3 238 231 21 +3 154 235 237 +3 233 47 245 +3 153 46 244 +3 246 219 8 +3 159 66 233 +3 23 266 192 +3 233 66 157 +3 128 66 231 +3 264 74 158 +3 48 24 78 +3 16 162 86 +3 49 26 86 +3 163 4 85 +3 192 266 152 +3 84 26 91 +3 268 45 168 +3 50 26 85 +3 152 268 168 +3 79 24 80 +3 169 245 47 +3 81 25 83 +3 151 15 170 +3 81 9 84 +3 168 45 151 +3 82 25 87 +3 266 75 152 +3 86 26 84 +3 186 54 102 +3 100 30 174 +3 183 175 17 +3 51 171 174 +3 181 27 173 +3 102 54 183 +3 174 171 100 +3 171 1 100 +3 201 58 107 +3 108 52 175 +3 198 187 7 +3 108 54 185 +3 177 176 97 +3 176 7 97 +3 185 32 178 +3 183 54 108 +3 182 180 53 +3 175 52 99 +3 182 29 98 +3 98 6 180 +3 181 180 92 +3 180 6 92 +3 177 29 182 +3 179 175 99 +3 186 184 54 +3 172 51 102 +3 186 30 101 +3 101 10 184 +3 201 32 213 +3 102 174 186 +3 174 30 186 +3 183 172 102 +3 197 57 119 +3 117 55 187 +3 194 191 18 +3 117 58 200 +3 189 55 90 +3 119 57 194 +3 200 35 190 +3 198 58 117 +3 193 34 114 +3 115 56 191 +3 168 170 76 +3 78 24 56 +3 196 34 193 +3 194 57 115 +3 208 60 116 +3 188 55 119 +3 207 11 195 +3 119 190 197 +3 196 195 113 +3 195 11 113 +3 116 57 197 +3 194 188 119 +3 213 61 109 +3 176 52 107 +3 210 202 19 +3 107 178 201 +3 208 35 200 +3 109 61 210 +3 178 32 201 +3 198 176 107 +3 205 203 59 +3 105 59 202 +3 110 33 204 +3 104 3 203 +3 204 203 110 +3 203 3 110 +3 212 31 205 +3 210 61 105 +3 209 207 60 +3 202 59 112 +3 209 33 111 +3 111 11 207 +3 208 197 35 +3 112 204 209 +3 204 33 209 +3 206 202 112 +3 213 185 106 +3 199 58 109 +3 184 10 211 +3 109 201 213 +3 212 211 103 +3 211 10 103 +3 185 54 106 +3 210 199 109 +3 229 65 142 +3 140 42 217 +3 226 218 20 +3 62 214 217 +3 224 40 216 +3 142 65 226 +3 217 214 140 +3 214 2 140 +3 265 74 147 +3 148 63 218 +3 262 230 8 +3 148 65 228 +3 248 41 220 +3 147 74 262 +3 228 44 221 +3 226 65 148 +3 256 72 136 +3 218 63 139 +3 255 13 223 +3 139 220 225 +3 224 223 133 +3 223 13 133 +3 136 64 225 +3 222 218 139 +3 229 227 65 +3 215 62 142 +3 229 42 141 +3 141 14 227 +3 265 44 164 +3 142 217 229 +3 217 42 229 +3 226 215 142 +3 245 69 159 +3 157 66 230 +3 242 234 21 +3 157 74 264 +3 240 38 232 +3 159 69 242 +3 264 47 233 +3 262 74 157 +3 237 235 67 +3 155 67 234 +3 120 36 236 +3 154 4 235 +3 236 235 120 +3 235 4 120 +3 244 46 237 +3 242 69 155 +3 241 239 68 +3 234 67 122 +3 241 36 121 +3 121 12 239 +3 249 38 261 +3 122 236 241 +3 236 36 241 +3 238 234 122 +3 169 76 156 +3 231 66 159 +3 170 15 243 +3 159 233 245 +3 244 243 153 +3 243 15 153 +3 156 69 245 +3 242 231 159 +3 261 73 129 +3 230 66 127 +3 258 250 22 +3 127 232 249 +3 256 41 248 +3 129 73 258 +3 232 38 249 +3 246 230 127 +3 253 251 71 +3 125 71 250 +3 130 39 252 +3 124 5 251 +3 252 251 130 +3 251 5 130 +3 260 37 253 +3 258 73 125 +3 257 255 72 +3 250 71 132 +3 257 39 131 +3 131 13 255 +3 256 225 41 +3 132 252 257 +3 252 39 257 +3 254 250 132 +3 261 240 126 +3 247 70 129 +3 239 12 259 +3 129 249 261 +3 260 259 123 +3 259 12 123 +3 240 68 126 +3 258 247 129 +3 164 77 149 +3 219 63 147 +3 167 266 23 +3 147 221 265 +3 169 47 264 +3 149 77 167 +3 221 44 265 +3 262 219 147 +3 269 267 75 +3 145 75 266 +3 150 45 268 +3 144 1 267 +3 268 267 150 +3 267 1 150 +3 165 43 269 +3 167 77 145 diff --git a/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_intrinsic_test.cpp b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_intrinsic_test.cpp new file mode 100644 index 00000000000..e4aeb76dd2c --- /dev/null +++ b/Heat_method_3/test/Heat_method_3/heat_method_surface_mesh_intrinsic_test.cpp @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include + + +typedef CGAL::Simple_cartesian Kernel; +typedef Kernel::Point_3 Point_3; +typedef CGAL::Surface_mesh Surface_mesh; + +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; +typedef Surface_mesh::Property_map Vertex_distance_map; +typedef CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3 Heat_method; + + + +int main(int argc, char* argv[]) +{ + //read in mesh + Surface_mesh sm; + const char* filename = (argc > 1) ? argv[1] : "./data/rectangle_with_degenerate_faces.off"; + std::ifstream in(filename); + in >> sm; + //property map for the distance values to the source set + Vertex_distance_map vertex_distance = sm.add_property_map("v:distance", 0).first; + + Heat_method hm(sm); + + //add the first vertex as the source set + vertex_descriptor source = *(vertices(sm).first); + hm.add_source(source); + assert(hm.sources().size() == 1); + hm.estimate_geodesic_distances(vertex_distance); + + Point_3 sp = sm.point(source); + + std::cout << "source: " << sp << " " << source << std::endl; + vertex_descriptor vfar; + double sdistance = 0; + + for(vertex_descriptor vd : vertices(sm)){ + if(get(vertex_distance,vd) > sdistance){ + vfar = vd; + sdistance = get(vertex_distance,vd); + } + } + assert(sdistance > 1.); + assert(sdistance < 2.26);//2.236 = sqrt(5) + + hm.add_source(vfar); + assert(hm.sources().size() == 2); + hm.estimate_geodesic_distances(vertex_distance); + + sdistance = 0; + for(vertex_descriptor vd : vertices(sm)){ + if(get(vertex_distance,vd) > sdistance){ + sdistance = get(vertex_distance,vd); + } + } + + assert(sdistance > 1.); + assert(sdistance < 2.26);//2.236 = sqrt(5) + + hm.remove_source(vfar); + assert(hm.sources().size() == 1); + + hm.clear_sources(); + + // add range of sources + std::vector vrange; + vrange.push_back(source); + vrange.push_back(vfar); + hm.add_sources(vrange); + assert(hm.sources().size() == 2); + hm.estimate_geodesic_distances(vertex_distance); + sdistance = 0; + for(vertex_descriptor vd : vertices(sm)){ + if(get(vertex_distance,vd) > sdistance){ + sdistance = get(vertex_distance,vd); + } + } + + assert(sdistance > 1.); + assert(sdistance < 2.26);//2.236 = sqrt(5) + + // do it again for one source + hm.clear_sources(); + assert(hm.sources().size() == 0); + hm.add_source(source); + hm.estimate_geodesic_distances(vertex_distance); + for(vertex_descriptor vd : vertices(sm)){ + if(get(vertex_distance,vd) > sdistance){ + sdistance = get(vertex_distance,vd); + } + } + assert(sdistance > 1.); + assert(sdistance < 2.26);//2.236 = sqrt(5) + + + CGAL::Heat_method_3::estimate_geodesic_distances(sm, vertex_distance, source, + CGAL::Heat_method_3::Intrinsic_Delaunay()); + sdistance = 0; + for(vertex_descriptor vd : vertices(sm)){ + if(get(vertex_distance,vd) > sdistance){ + sdistance = get(vertex_distance,vd); + } + } + assert(sdistance > 1.); + assert(sdistance < 2.26);//2.236 = sqrt(5) + + std::cout << "done" << std::endl; + return 0; +} From f2f10e7a22465f86e0247e031c3640b705049975 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 20 Nov 2020 16:18:11 +0100 Subject: [PATCH 021/178] add missing namespace --- .../Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index b5aff168bb7..6ce491def7b 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -398,7 +398,7 @@ private: stack.push(ed); } - if(internal::has_degenerate_faces(m_intrinsic_tm, Traits())) + if(CGAL::Heat_method_3::internal::has_degenerate_faces(m_intrinsic_tm, Traits())) mollify(min_length*1e-4); loop_over_edges(stack, mark_edges); From 78bbe1532563c6746ad672487d69218e96818540 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 28 Nov 2020 14:17:59 +0000 Subject: [PATCH 022/178] Add a destructor assertion catch macro --- STL_Extension/include/CGAL/assertions.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/STL_Extension/include/CGAL/assertions.h b/STL_Extension/include/CGAL/assertions.h index caa0237fc7d..e13f181f970 100644 --- a/STL_Extension/include/CGAL/assertions.h +++ b/STL_Extension/include/CGAL/assertions.h @@ -79,6 +79,7 @@ inline bool possibly(Uncertain c); #if defined(CGAL_NO_ASSERTIONS) # define CGAL_assertion(EX) (static_cast(0)) # define CGAL_destructor_assertion(EX) (static_cast(0)) +# define CGAL_destructor_assertion_catch(CODE) CODE # define CGAL_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_assertion_code(CODE) # ifdef CGAL_ASSUME @@ -94,9 +95,11 @@ inline bool possibly(Uncertain c); # if __cpp_lib_uncaught_exceptions || ( _MSVC_LANG >= 201703L ) // C++17 # define CGAL_destructor_assertion(EX) \ (CGAL::possibly(EX)||(std::uncaught_exceptions() > 0)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) +# define CGAL_destructor_assertion_catch(CODE) try{ CODE } catch(...) { if(std::uncaught_exceptions() <= 0) throw; } # else // use C++03 `std::uncaught_exception()` # define CGAL_destructor_assertion(EX) \ (CGAL::possibly(EX)||std::uncaught_exception()?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__)) +# define CGAL_destructor_assertion_catch(CODE) try{ CODE } catch(...) { if(!std::uncaught_exception()) throw; } # endif // use C++03 `std::uncaught_exception()` # define CGAL_assertion_msg(EX,MSG) \ (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::assertion_fail( # EX , __FILE__, __LINE__, MSG)) @@ -293,11 +296,19 @@ inline bool possibly(Uncertain c); #if defined(CGAL_NO_WARNINGS) # define CGAL_warning(EX) (static_cast(0)) +# define CGAL_destructor_warning(EX) (static_cast(0)) # define CGAL_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_warning_code(CODE) #else # define CGAL_warning(EX) \ (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) +# if __cpp_lib_uncaught_exceptions || ( _MSVC_LANG >= 201703L ) // C++17 +# define CGAL_destructor_warning(EX) \ + (CGAL::possibly(EX)||(std::uncaught_exceptions() > 0)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) +# else // use C++03 `std::uncaught_exception()` +# define CGAL_destructor_warning(EX) \ + (CGAL::possibly(EX)||std::uncaught_exception()?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__)) +# endif // use C++03 `std::uncaught_exception()` # define CGAL_warning_msg(EX,MSG) \ (CGAL::possibly(EX)?(static_cast(0)): ::CGAL::warning_fail( # EX , __FILE__, __LINE__, MSG)) # define CGAL_warning_code(CODE) CODE From 96024d1bb1bea1e98fc49808fa70c9f7cc3c8873 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 28 Nov 2020 14:25:25 +0000 Subject: [PATCH 023/178] Fix uncaught exception in K3_tree.h --- Nef_3/include/CGAL/Nef_3/K3_tree.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/K3_tree.h b/Nef_3/include/CGAL/Nef_3/K3_tree.h index c3b8aaecffc..b551b5c1625 100644 --- a/Nef_3/include/CGAL/Nef_3/K3_tree.h +++ b/Nef_3/include/CGAL/Nef_3/K3_tree.h @@ -442,12 +442,15 @@ friend std::ostream& operator<< } -~Node() { +~Node() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) +{ CGAL_NEF_TRACEN("~Node: deleting node..."); - if( !is_leaf()) { - delete left_node; - delete right_node; - } + CGAL_destructor_assertion_catch( + if( !is_leaf()) { + delete left_node; + delete right_node; + } + ); } private: @@ -1103,9 +1106,12 @@ bool update( Node* node, return (left_updated || right_updated); } -~K3_tree() { +~K3_tree() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) +{ CGAL_NEF_TRACEN("~K3_tree: deleting root..."); - delete root; + CGAL_destructor_assertion_catch( + delete root; + ); } private: From 9d442f26c783a6e3416c3b5b2d56b0ec28ffe3d4 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 28 Nov 2020 17:48:05 +0000 Subject: [PATCH 024/178] Fix uncaught exception in VRML_2_ostream.h --- Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h index 08e8fdd7e49..d200643068d 100644 --- a/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h +++ b/Stream_support/include/CGAL/IO/VRML/VRML_2_ostream.h @@ -30,7 +30,12 @@ class VRML_2_ostream public: VRML_2_ostream() : m_os(nullptr) {} VRML_2_ostream(std::ostream& o) : m_os(&o) { header(); } - ~VRML_2_ostream() { close(); } + ~VRML_2_ostream() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) + { + CGAL_destructor_assertion_catch( + close(); + ); + } void open(std::ostream& o) { m_os = &o; header(); } void close() From 35c148078ce711321d7c557319d8516a3028c8fc Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 28 Nov 2020 20:26:00 +0000 Subject: [PATCH 025/178] Fix uncaught exception in Sphere_map.h --- Nef_S2/include/CGAL/Nef_S2/Sphere_map.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h index 93670a125e2..0ee5d431292 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_map.h @@ -229,7 +229,12 @@ public: Sphere_map(bool = false) : boundary_item_(boost::none), svertices_(), sedges_(), sfaces_(), shalfloop_() {} - ~Sphere_map() { clear(); } + ~Sphere_map() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) + { + CGAL_destructor_assertion_catch( + clear(); + ); + } Sphere_map(const Self& D) : boundary_item_(boost::none), svertices_(D.svertices_), From e222a423aff1070ae92d0e443bd3459b19620f9d Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 29 Nov 2020 11:30:21 +0000 Subject: [PATCH 026/178] Fix uncaught exception in Nef_polyhedron_S2.h --- Nef_S2/include/CGAL/Nef_polyhedron_S2.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h index 10003b5b47a..59613249388 100644 --- a/Nef_S2/include/CGAL/Nef_polyhedron_S2.h +++ b/Nef_S2/include/CGAL/Nef_polyhedron_S2.h @@ -73,7 +73,12 @@ class Nef_polyhedron_S2_rep { public: Nef_polyhedron_S2_rep() : sm_() {} Nef_polyhedron_S2_rep(const Self&) : sm_() {} - ~Nef_polyhedron_S2_rep() { sm_.clear(); } + ~Nef_polyhedron_S2_rep() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) + { + CGAL_destructor_assertion_catch( + sm_.clear(); + ); + } }; /*{\Moptions print_title=yes }*/ From ce26378d5431dd1f89eb482fef246edd11ec1d6f Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 29 Nov 2020 12:11:37 +0000 Subject: [PATCH 027/178] Fix uncaught exception in SNC_point_locator.h --- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index 3b81b1119c0..e381a9ae60a 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -126,7 +126,8 @@ public: virtual void add_vertex(Vertex_handle) {} - virtual ~SNC_point_locator() { + virtual ~SNC_point_locator() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) + { CGAL_NEF_CLOG(""); CGAL_NEF_CLOG("construction_time: "< Date: Sun, 29 Nov 2020 14:42:55 +0000 Subject: [PATCH 028/178] Fix uncaught exception in Handle_for.h --- STL_Extension/include/CGAL/Handle_for.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/STL_Extension/include/CGAL/Handle_for.h b/STL_Extension/include/CGAL/Handle_for.h index 537096b6e73..97543f58db8 100644 --- a/STL_Extension/include/CGAL/Handle_for.h +++ b/STL_Extension/include/CGAL/Handle_for.h @@ -149,12 +149,14 @@ public: return *this; } - ~Handle_for() + ~Handle_for() noexcept { - if (--(ptr_->count) == 0) { - Allocator_traits::destroy(allocator, ptr_); - allocator.deallocate( ptr_, 1); - } + try{ + if (--(ptr_->count) == 0) { + Allocator_traits::destroy(allocator, ptr_); + allocator.deallocate( ptr_, 1); + } + } catch(...) {} } void From a7abec0a422a145fe73a18735bc3ceddfb3c244b Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 29 Nov 2020 15:21:49 +0000 Subject: [PATCH 029/178] Add noexcept to Ref_counted_base in Straight_skeleton_aux.h --- .../include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h index 532d72e3a88..7e642e8b10b 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/Straight_skeleton_aux.h @@ -164,7 +164,7 @@ private: Ref_counted_base& operator=( Ref_counted_base const &); protected: Ref_counted_base(): mCount(0) {} - virtual ~Ref_counted_base() {} + virtual ~Ref_counted_base() CGAL_NOEXCEPT(CGAL_NO_ASSERTIONS_BOOL) {} public: void AddRef() const { ++mCount; } void Release() const From e7aebc424ec965a2e5231edfaf517d6c62e74831 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 29 Nov 2020 14:42:55 +0000 Subject: [PATCH 030/178] Fix uncaught exception in In_place_list.h --- STL_Extension/include/CGAL/In_place_list.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/STL_Extension/include/CGAL/In_place_list.h b/STL_Extension/include/CGAL/In_place_list.h index 89fd3da3c82..e19c8ca5e4d 100644 --- a/STL_Extension/include/CGAL/In_place_list.h +++ b/STL_Extension/include/CGAL/In_place_list.h @@ -445,9 +445,11 @@ public: (*node).prev_link = node; insert(begin(), x.begin(), x.end()); } - ~In_place_list() { - erase(begin(), end()); - put_node(node); + ~In_place_list() noexcept { + try { + erase(begin(), end()); + put_node(node); + } catch(...) {} } Self& operator=(const Self& x); From 1373150f1da4ad94ac12890b682688a2dca6e1f4 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 29 Nov 2020 14:42:55 +0000 Subject: [PATCH 031/178] Fix uncaught exception in HalfedgeDS_list.h --- HalfedgeDS/include/CGAL/HalfedgeDS_list.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/HalfedgeDS/include/CGAL/HalfedgeDS_list.h b/HalfedgeDS/include/CGAL/HalfedgeDS_list.h index aecf7b7e29b..664be1c2c30 100644 --- a/HalfedgeDS/include/CGAL/HalfedgeDS_list.h +++ b/HalfedgeDS/include/CGAL/HalfedgeDS_list.h @@ -395,7 +395,11 @@ public: // halfedges, and f faces. The reservation sizes are a hint for // optimizing storage allocation. They are not used here. - ~HalfedgeDS_list() { clear(); } + ~HalfedgeDS_list() noexcept { + try { + clear(); + } catch (...) {} + } HalfedgeDS_list( const Self& hds) : vertices( hds.vertices), From 5a36ff89b5d2ea6f65ed33781b2d1aa00aa7be07 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Fri, 4 Dec 2020 08:02:26 +0000 Subject: [PATCH 032/178] Drop NDEBUG it is already visible through CGAL_NO_ASSERTIONS --- .../CGAL/Curved_kernel_via_analysis_2/Arc_2.h | 3 +- .../Approximate_min_ellipsoid_d_configure.h | 2 +- .../Convex_hull_2/ch_akl_toussaint_impl.h | 6 +-- .../CGAL/Convex_hull_2/ch_assertions.h | 50 ++++++----------- .../CGAL/Convex_hull_2/ch_bykat_impl.h | 12 ++--- .../Convex_hull_2/ch_graham_andrew_impl.h | 24 +++------ .../CGAL/Convex_hull_2/ch_jarvis_impl.h | 6 +-- Kernel_23/include/CGAL/kernel_assertions.h | 50 ++++++----------- .../Partition_2/partition_approx_convex_2.h | 4 +- .../CGAL/Partition_2/partition_assertions.h | 50 ++++++----------- .../partition_greene_approx_convex_2.h | 4 +- .../Partition_2/partition_optimal_convex_2.h | 4 +- .../CGAL/Partition_2/partition_y_monotone_2.h | 4 +- .../CGAL/point_set_processing_assertions.h | 50 ++++++----------- ...surface_reconstruction_points_assertions.h | 50 ++++++----------- .../CGAL/Polygon_2/polygon_assertions.h | 53 +++++++------------ Polytope_distance_d/include/CGAL/Width_3.h | 24 +++------ .../include/CGAL/Width_polyhedron_3.h | 3 +- .../include/CGAL/multiset_assertions.h | 50 ++++++----------- .../include/CGAL/triangulation_assertions.h | 50 ++++++----------- Scripts/scripts/cgal_create_assertions.sh | 50 ++++++----------- .../include/CGAL/Tree_assertions.h | 50 ++++++----------- .../CGAL/Straight_skeleton_2/assertions.h | 3 +- .../include/CGAL/streamlines_assertions.h | 50 ++++++----------- 24 files changed, 224 insertions(+), 428 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index ea0df939fd7..3080b586837 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -1818,8 +1818,7 @@ protected: */ void _check_arc_interior() const { -#if !(defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG)) +#if !(defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS)) if(is_vertical()) { Coordinate_1 x0 = _minpoint().x(); diff --git a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h index 79c3b4e66c5..e993f09b580 100644 --- a/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h +++ b/Bounding_volumes/include/CGAL/Approximate_min_ellipsoid_d/Approximate_min_ellipsoid_d_configure.h @@ -20,7 +20,7 @@ #include #include -#if (defined(CGAL_NO_ASSERTIONS) || defined(NDEBUG)) +#if defined(CGAL_NO_ASSERTIONS) #undef CGAL_APPEL_ASSERTION_MODE #undef CGAL_APPEL_EXP_ASSERTION_MODE #undef CGAL_APPEL_LOG_MODE diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h index c06435efcef..1f452e86dca 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_akl_toussaint_impl.h @@ -285,8 +285,7 @@ ch_akl_toussaint(ForwardIterator first, ForwardIterator last, internal::ch_akl_toussaint_assign_points_to_regions(std::next(std::get<3>(ranges)),last,left_turn,e,w,n,s,region1,region2,region3,region4,ch_traits); } - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else Tee_for_output_iterator res(result); @@ -336,8 +335,7 @@ ch_akl_toussaint(ForwardIterator first, ForwardIterator last, res.output_so_far_begin(), res.output_so_far_end(), \ ch_traits) ); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h index 267f9cf068b..1706f796e9f 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_assertions.h @@ -15,7 +15,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -28,8 +28,7 @@ #undef CGAL_ch_assertion_msg #undef CGAL_ch_assertion_code -#if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_ch_assertion(EX) (static_cast(0)) #include @@ -51,8 +50,7 @@ #undef CGAL_ch_exactness_assertion_code #if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_ch_exactness_assertion(EX) (static_cast(0)) # define CGAL_ch_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_exactness_assertion_code(CODE) @@ -72,8 +70,7 @@ #if defined(CGAL_CH_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_assertion(EX) (static_cast(0)) # define CGAL_ch_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_assertion_code(CODE) @@ -93,8 +90,7 @@ #if defined(CGAL_CH_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_ch_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_exactness_assertion_code(CODE) @@ -115,8 +111,7 @@ #undef CGAL_ch_precondition_msg #undef CGAL_ch_precondition_code -#if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_ch_precondition(EX) (static_cast(0)) # define CGAL_ch_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_precondition_code(CODE) @@ -135,8 +130,7 @@ #undef CGAL_ch_exactness_precondition_code #if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_ch_exactness_precondition(EX) (static_cast(0)) # define CGAL_ch_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_exactness_precondition_code(CODE) @@ -155,8 +149,7 @@ #undef CGAL_ch_expensive_precondition_code #if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_precondition(EX) (static_cast(0)) # define CGAL_ch_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_precondition_code(CODE) @@ -176,8 +169,7 @@ #if defined(CGAL_CH_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_ch_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_exactness_precondition_code(CODE) @@ -198,8 +190,7 @@ #undef CGAL_ch_postcondition_msg #undef CGAL_ch_postcondition_code -#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_ch_postcondition(EX) (static_cast(0)) # define CGAL_ch_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_postcondition_code(CODE) @@ -218,8 +209,7 @@ #undef CGAL_ch_exactness_postcondition_code #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_ch_exactness_postcondition(EX) (static_cast(0)) # define CGAL_ch_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_exactness_postcondition_code(CODE) @@ -238,8 +228,7 @@ #undef CGAL_ch_expensive_postcondition_code #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_postcondition(EX) (static_cast(0)) # define CGAL_ch_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_postcondition_code(CODE) @@ -259,8 +248,7 @@ #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_ch_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_exactness_postcondition_code(CODE) @@ -281,8 +269,7 @@ #undef CGAL_ch_warning_msg #undef CGAL_ch_warning_code -#if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_ch_warning(EX) (static_cast(0)) # define CGAL_ch_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_warning_code(CODE) @@ -301,8 +288,7 @@ #undef CGAL_ch_exactness_warning_code #if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_ch_exactness_warning(EX) (static_cast(0)) # define CGAL_ch_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_exactness_warning_code(CODE) @@ -321,8 +307,7 @@ #undef CGAL_ch_expensive_warning_code #if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_warning(EX) (static_cast(0)) # define CGAL_ch_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_warning_code(CODE) @@ -342,8 +327,7 @@ #if defined(CGAL_CH_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_CH_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_CH_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_ch_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_ch_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_ch_expensive_exactness_warning_code(CODE) diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h index 32334e4e7f9..0959f68c4d4 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_bykat_impl.h @@ -68,8 +68,7 @@ ch_bykat(InputIterator first, InputIterator last, *result = a; ++result; return result; } - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else Tee_for_output_iterator res(result); @@ -110,8 +109,7 @@ ch_bykat(InputIterator first, InputIterator last, P.begin(), P.end(), \ res.output_so_far_begin(), res.output_so_far_end(), \ ch_traits)); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); @@ -164,8 +162,7 @@ ch_bykat_with_threshold(InputIterator first, InputIterator last, *result = a; ++result; return result; } - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else Tee_for_output_iterator res(result); @@ -234,8 +231,7 @@ ch_bykat_with_threshold(InputIterator first, InputIterator last, Pbegin, Pend, \ res.output_so_far_begin(), res.output_so_far_end(), \ ch_traits)); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h index 798e5d78449..d30fccdc8e3 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_graham_andrew_impl.h @@ -90,8 +90,7 @@ ch_graham_andrew_scan( BidirectionalIterator first, typedef typename std::vector< BidirectionalIterator >::iterator std_iterator; std_iterator stack_iter = S.begin(); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else typedef typename Traits::Point_2 Point_2; @@ -108,8 +107,7 @@ ch_graham_andrew_scan( BidirectionalIterator first, first, last, \ res.output_so_far_begin(), res.output_so_far_end(), \ ch_traits)); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); @@ -208,8 +206,7 @@ ch_graham_andrew( InputIterator first, return result; } - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else Tee_for_output_iterator res(result); @@ -225,8 +222,7 @@ ch_graham_andrew( InputIterator first, V.begin(), V.end(), \ res.output_so_far_begin(), res.output_so_far_end(), \ ch_traits)); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); @@ -254,15 +250,13 @@ ch_lower_hull_scan( InputIterator first, return result; } - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else Tee_for_output_iterator res(result); #endif // no postconditions ... ch_graham_andrew_scan( V.begin(), V.end(), res, ch_traits); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); @@ -285,15 +279,13 @@ ch_upper_hull_scan( InputIterator first, std::sort( V.begin(), V.end(), ch_traits.less_xy_2_object() ); if (equal_points( *(V.begin()), *(V.rbegin())) ) { return result; } - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else Tee_for_output_iterator res(result); #endif // no postconditions ... ch_graham_andrew_scan( V.rbegin(), V.rend(), res, ch_traits); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h index c5d3309cbd0..79f73cd664b 100644 --- a/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h +++ b/Convex_hull_2/include/CGAL/Convex_hull_2/ch_jarvis_impl.h @@ -45,8 +45,7 @@ ch_jarvis_march(ForwardIterator first, ForwardIterator last, Equal_2 equal_points = ch_traits.equal_2_object(); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else typedef typename Traits::Point_2 Point_2; @@ -91,8 +90,7 @@ ch_jarvis_march(ForwardIterator first, ForwardIterator last, first, last, \ res.output_so_far_begin(), res.output_so_far_end(), \ ch_traits)); - #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) + #if defined(CGAL_CH_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Kernel_23/include/CGAL/kernel_assertions.h b/Kernel_23/include/CGAL/kernel_assertions.h index 9673575a540..3bd9163f845 100644 --- a/Kernel_23/include/CGAL/kernel_assertions.h +++ b/Kernel_23/include/CGAL/kernel_assertions.h @@ -19,7 +19,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -32,8 +32,7 @@ #undef CGAL_kernel_assertion_msg #undef CGAL_kernel_assertion_code -#if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_kernel_assertion(EX) (static_cast(0)) # define CGAL_kernel_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_assertion_code(CODE) @@ -52,8 +51,7 @@ #undef CGAL_kernel_exactness_assertion_code #if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_kernel_exactness_assertion(EX) (static_cast(0)) # define CGAL_kernel_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_exactness_assertion_code(CODE) @@ -73,8 +71,7 @@ #if defined(CGAL_KERNEL_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_assertion(EX) (static_cast(0)) # define CGAL_kernel_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_assertion_code(CODE) @@ -94,8 +91,7 @@ #if defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_kernel_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_exactness_assertion_code(CODE) @@ -116,8 +112,7 @@ #undef CGAL_kernel_precondition_msg #undef CGAL_kernel_precondition_code -#if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_kernel_precondition(EX) (static_cast(0)) # define CGAL_kernel_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_precondition_code(CODE) @@ -136,8 +131,7 @@ #undef CGAL_kernel_exactness_precondition_code #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_kernel_exactness_precondition(EX) (static_cast(0)) # define CGAL_kernel_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_exactness_precondition_code(CODE) @@ -156,8 +150,7 @@ #undef CGAL_kernel_expensive_precondition_code #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_precondition(EX) (static_cast(0)) # define CGAL_kernel_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_precondition_code(CODE) @@ -177,8 +170,7 @@ #if defined(CGAL_KERNEL_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_kernel_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_exactness_precondition_code(CODE) @@ -199,8 +191,7 @@ #undef CGAL_kernel_postcondition_msg #undef CGAL_kernel_postcondition_code -#if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_kernel_postcondition(EX) (static_cast(0)) # define CGAL_kernel_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_postcondition_code(CODE) @@ -219,8 +210,7 @@ #undef CGAL_kernel_exactness_postcondition_code #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_kernel_exactness_postcondition(EX) (static_cast(0)) # define CGAL_kernel_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_exactness_postcondition_code(CODE) @@ -239,8 +229,7 @@ #undef CGAL_kernel_expensive_postcondition_code #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_postcondition(EX) (static_cast(0)) # define CGAL_kernel_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_postcondition_code(CODE) @@ -260,8 +249,7 @@ #if defined(CGAL_KERNEL_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_kernel_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_exactness_postcondition_code(CODE) @@ -282,8 +270,7 @@ #undef CGAL_kernel_warning_msg #undef CGAL_kernel_warning_code -#if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_kernel_warning(EX) (static_cast(0)) # define CGAL_kernel_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_warning_code(CODE) @@ -302,8 +289,7 @@ #undef CGAL_kernel_exactness_warning_code #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_kernel_exactness_warning(EX) (static_cast(0)) # define CGAL_kernel_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_exactness_warning_code(CODE) @@ -322,8 +308,7 @@ #undef CGAL_kernel_expensive_warning_code #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_warning(EX) (static_cast(0)) # define CGAL_kernel_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_warning_code(CODE) @@ -343,8 +328,7 @@ #if defined(CGAL_KERNEL_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_KERNEL_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_kernel_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_kernel_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_kernel_expensive_exactness_warning_code(CODE) diff --git a/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h index 813cc59ab5b..72e81ce0786 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_approx_convex_2.h @@ -230,7 +230,7 @@ OutputIterator partition_approx_convex_2(InputIterator first, } #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else typedef typename Traits::Polygon_2 Polygon_2; @@ -244,7 +244,7 @@ OutputIterator partition_approx_convex_2(InputIterator first, res.output_so_far_end(), traits)); #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Partition_2/include/CGAL/Partition_2/partition_assertions.h b/Partition_2/include/CGAL/Partition_2/partition_assertions.h index 41f5dfe2cf3..6d0f0288b3e 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_assertions.h +++ b/Partition_2/include/CGAL/Partition_2/partition_assertions.h @@ -15,7 +15,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -28,8 +28,7 @@ #undef CGAL_partition_assertion_msg #undef CGAL_partition_assertion_code -#if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_partition_assertion(EX) (static_cast(0)) #include @@ -51,8 +50,7 @@ #undef CGAL_partition_exactness_assertion_code #if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_partition_exactness_assertion(EX) (static_cast(0)) # define CGAL_partition_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_exactness_assertion_code(CODE) @@ -72,8 +70,7 @@ #if defined(CGAL_PARTITION_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_assertion(EX) (static_cast(0)) # define CGAL_partition_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_assertion_code(CODE) @@ -93,8 +90,7 @@ #if defined(CGAL_PARTITION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_partition_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_exactness_assertion_code(CODE) @@ -115,8 +111,7 @@ #undef CGAL_partition_precondition_msg #undef CGAL_partition_precondition_code -#if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_partition_precondition(EX) (static_cast(0)) # define CGAL_partition_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_precondition_code(CODE) @@ -135,8 +130,7 @@ #undef CGAL_partition_exactness_precondition_code #if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_partition_exactness_precondition(EX) (static_cast(0)) # define CGAL_partition_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_exactness_precondition_code(CODE) @@ -155,8 +149,7 @@ #undef CGAL_partition_expensive_precondition_code #if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_precondition(EX) (static_cast(0)) # define CGAL_partition_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_precondition_code(CODE) @@ -176,8 +169,7 @@ #if defined(CGAL_PARTITION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_partition_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_exactness_precondition_code(CODE) @@ -198,8 +190,7 @@ #undef CGAL_partition_postcondition_msg #undef CGAL_partition_postcondition_code -#if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_partition_postcondition(EX) (static_cast(0)) # define CGAL_partition_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_postcondition_code(CODE) @@ -218,8 +209,7 @@ #undef CGAL_partition_exactness_postcondition_code #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_partition_exactness_postcondition(EX) (static_cast(0)) # define CGAL_partition_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_exactness_postcondition_code(CODE) @@ -238,8 +228,7 @@ #undef CGAL_partition_expensive_postcondition_code #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_postcondition(EX) (static_cast(0)) # define CGAL_partition_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_postcondition_code(CODE) @@ -259,8 +248,7 @@ #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_partition_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_exactness_postcondition_code(CODE) @@ -281,8 +269,7 @@ #undef CGAL_partition_warning_msg #undef CGAL_partition_warning_code -#if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_partition_warning(EX) (static_cast(0)) # define CGAL_partition_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_warning_code(CODE) @@ -301,8 +288,7 @@ #undef CGAL_partition_exactness_warning_code #if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_partition_exactness_warning(EX) (static_cast(0)) # define CGAL_partition_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_exactness_warning_code(CODE) @@ -321,8 +307,7 @@ #undef CGAL_partition_expensive_warning_code #if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_warning(EX) (static_cast(0)) # define CGAL_partition_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_warning_code(CODE) @@ -342,8 +327,7 @@ #if defined(CGAL_PARTITION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_PARTITION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_PARTITION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_partition_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_partition_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_partition_expensive_exactness_warning_code(CODE) diff --git a/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h index 4e4cbce5334..e2259a19a69 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_greene_approx_convex_2.h @@ -798,7 +798,7 @@ OutputIterator partition_greene_approx_convex_2(InputIterator first, typedef typename Traits::Polygon_2 Polygon_2; #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else @@ -829,7 +829,7 @@ OutputIterator partition_greene_approx_convex_2(InputIterator first, res.output_so_far_end(), traits)); #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h b/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h index 68baffab98b..0b87e73eb84 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_optimal_convex_2.h @@ -512,7 +512,7 @@ OutputIterator partition_optimal_convex_2(InputIterator first, #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else typedef typename Traits::Polygon_2 Polygon_2; @@ -567,7 +567,7 @@ OutputIterator partition_optimal_convex_2(InputIterator first, } #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h index d6b1b92857c..a4918e5548f 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h @@ -418,7 +418,7 @@ OutputIterator partition_y_monotone_2(InputIterator first, typedef Circulator_from_iterator Circulator; #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) OutputIterator res(result); #else typedef typename Traits::Polygon_2 Polygon_2; @@ -490,7 +490,7 @@ OutputIterator partition_y_monotone_2(InputIterator first, res.output_so_far_end(), traits)); #if defined(CGAL_PARTITION_NO_POSTCONDITIONS) || \ - defined(CGAL_NO_POSTCONDITIONS) || defined(NDEBUG) + defined(CGAL_NO_POSTCONDITIONS) return res; #else return res.to_output_iterator(); diff --git a/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h b/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h index 85e5c6012cb..e5b85b5f3ef 100644 --- a/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h +++ b/Point_set_processing_3/include/CGAL/point_set_processing_assertions.h @@ -20,7 +20,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -33,8 +33,7 @@ #undef CGAL_point_set_processing_assertion_msg #undef CGAL_point_set_processing_assertion_code -#if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_point_set_processing_assertion(EX) (static_cast(0)) #include @@ -56,8 +55,7 @@ #undef CGAL_point_set_processing_exactness_assertion_code #if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_point_set_processing_exactness_assertion(EX) (static_cast(0)) # define CGAL_point_set_processing_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_exactness_assertion_code(CODE) @@ -77,8 +75,7 @@ #if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_assertion(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_assertion_code(CODE) @@ -98,8 +95,7 @@ #if defined(CGAL_POINT_SET_PROCESSING_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_assertion_code(CODE) @@ -120,8 +116,7 @@ #undef CGAL_point_set_processing_precondition_msg #undef CGAL_point_set_processing_precondition_code -#if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_point_set_processing_precondition(EX) (static_cast(0)) # define CGAL_point_set_processing_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_precondition_code(CODE) @@ -140,8 +135,7 @@ #undef CGAL_point_set_processing_exactness_precondition_code #if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_point_set_processing_exactness_precondition(EX) (static_cast(0)) # define CGAL_point_set_processing_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_exactness_precondition_code(CODE) @@ -160,8 +154,7 @@ #undef CGAL_point_set_processing_expensive_precondition_code #if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_precondition(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_precondition_code(CODE) @@ -181,8 +174,7 @@ #if defined(CGAL_POINT_SET_PROCESSING_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_precondition_code(CODE) @@ -203,8 +195,7 @@ #undef CGAL_point_set_processing_postcondition_msg #undef CGAL_point_set_processing_postcondition_code -#if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_point_set_processing_postcondition(EX) (static_cast(0)) # define CGAL_point_set_processing_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_postcondition_code(CODE) @@ -223,8 +214,7 @@ #undef CGAL_point_set_processing_exactness_postcondition_code #if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_point_set_processing_exactness_postcondition(EX) (static_cast(0)) # define CGAL_point_set_processing_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_exactness_postcondition_code(CODE) @@ -243,8 +233,7 @@ #undef CGAL_point_set_processing_expensive_postcondition_code #if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_postcondition(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_postcondition_code(CODE) @@ -264,8 +253,7 @@ #if defined(CGAL_POINT_SET_PROCESSING_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_postcondition_code(CODE) @@ -286,8 +274,7 @@ #undef CGAL_point_set_processing_warning_msg #undef CGAL_point_set_processing_warning_code -#if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_point_set_processing_warning(EX) (static_cast(0)) # define CGAL_point_set_processing_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_warning_code(CODE) @@ -306,8 +293,7 @@ #undef CGAL_point_set_processing_exactness_warning_code #if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_point_set_processing_exactness_warning(EX) (static_cast(0)) # define CGAL_point_set_processing_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_exactness_warning_code(CODE) @@ -326,8 +312,7 @@ #undef CGAL_point_set_processing_expensive_warning_code #if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_warning(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_warning_code(CODE) @@ -347,8 +332,7 @@ #if defined(CGAL_POINT_SET_PROCESSING_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POINT_SET_PROCESSING_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_point_set_processing_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_point_set_processing_expensive_exactness_warning_code(CODE) diff --git a/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h b/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h index 48dc293bb88..67bc3df7f1a 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/surface_reconstruction_points_assertions.h @@ -19,7 +19,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -32,8 +32,7 @@ #undef CGAL_surface_reconstruction_points_assertion_msg #undef CGAL_surface_reconstruction_points_assertion_code -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_surface_reconstruction_points_assertion(EX) (static_cast(0)) #include @@ -55,8 +54,7 @@ #undef CGAL_surface_reconstruction_points_exactness_assertion_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_surface_reconstruction_points_exactness_assertion(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_assertion_code(CODE) @@ -76,8 +74,7 @@ #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_assertion(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_assertion_code(CODE) @@ -97,8 +94,7 @@ #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_assertion_code(CODE) @@ -119,8 +115,7 @@ #undef CGAL_surface_reconstruction_points_precondition_msg #undef CGAL_surface_reconstruction_points_precondition_code -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_surface_reconstruction_points_precondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_precondition_code(CODE) @@ -139,8 +134,7 @@ #undef CGAL_surface_reconstruction_points_exactness_precondition_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_surface_reconstruction_points_exactness_precondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_precondition_code(CODE) @@ -159,8 +153,7 @@ #undef CGAL_surface_reconstruction_points_expensive_precondition_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_precondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_precondition_code(CODE) @@ -180,8 +173,7 @@ #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_precondition_code(CODE) @@ -202,8 +194,7 @@ #undef CGAL_surface_reconstruction_points_postcondition_msg #undef CGAL_surface_reconstruction_points_postcondition_code -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_surface_reconstruction_points_postcondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_postcondition_code(CODE) @@ -222,8 +213,7 @@ #undef CGAL_surface_reconstruction_points_exactness_postcondition_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_surface_reconstruction_points_exactness_postcondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_postcondition_code(CODE) @@ -242,8 +232,7 @@ #undef CGAL_surface_reconstruction_points_expensive_postcondition_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_postcondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_postcondition_code(CODE) @@ -263,8 +252,7 @@ #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_postcondition_code(CODE) @@ -285,8 +273,7 @@ #undef CGAL_surface_reconstruction_points_warning_msg #undef CGAL_surface_reconstruction_points_warning_code -#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_surface_reconstruction_points_warning(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_warning_code(CODE) @@ -305,8 +292,7 @@ #undef CGAL_surface_reconstruction_points_exactness_warning_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_surface_reconstruction_points_exactness_warning(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_exactness_warning_code(CODE) @@ -325,8 +311,7 @@ #undef CGAL_surface_reconstruction_points_expensive_warning_code #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_warning(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_warning_code(CODE) @@ -346,8 +331,7 @@ #if defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_SURFACE_RECONSTRUCTION_POINTS_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_surface_reconstruction_points_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_surface_reconstruction_points_expensive_exactness_warning_code(CODE) diff --git a/Polygon/include/CGAL/Polygon_2/polygon_assertions.h b/Polygon/include/CGAL/Polygon_2/polygon_assertions.h index 407cf25d25d..47711d72fef 100644 --- a/Polygon/include/CGAL/Polygon_2/polygon_assertions.h +++ b/Polygon/include/CGAL/Polygon_2/polygon_assertions.h @@ -19,7 +19,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -35,8 +35,7 @@ #ifndef CGAL_POLYGON_ASSERTIONS_H #define CGAL_POLYGON_ASSERTIONS_H -#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ -|| defined(NDEBUG) +#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) namespace CGAL{ inline void set_use_polygon_assertions(bool){} inline bool get_use_polygon_assertions(){return true;} @@ -57,8 +56,7 @@ inline void set_use_polygon_assertions(bool b) #endif #endif // CGAL_POLYGON_ASSERTIONS_H -#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_polygon_assertion(EX) (static_cast(0)) # define CGAL_polygon_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_assertion_code(CODE) @@ -77,8 +75,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_exactness_assertion_code #if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_polygon_exactness_assertion(EX) (static_cast(0)) # define CGAL_polygon_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_exactness_assertion_code(CODE) @@ -98,8 +95,7 @@ inline void set_use_polygon_assertions(bool b) #if defined(CGAL_POLYGON_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_assertion(EX) (static_cast(0)) # define CGAL_polygon_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_assertion_code(CODE) @@ -119,8 +115,7 @@ inline void set_use_polygon_assertions(bool b) #if defined(CGAL_POLYGON_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_polygon_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_exactness_assertion_code(CODE) @@ -141,8 +136,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_precondition_msg #undef CGAL_polygon_precondition_code -#if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_polygon_precondition(EX) (static_cast(0)) # define CGAL_polygon_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_precondition_code(CODE) @@ -161,8 +155,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_exactness_precondition_code #if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_polygon_exactness_precondition(EX) (static_cast(0)) # define CGAL_polygon_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_exactness_precondition_code(CODE) @@ -181,8 +174,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_expensive_precondition_code #if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_precondition(EX) (static_cast(0)) # define CGAL_polygon_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_precondition_code(CODE) @@ -202,8 +194,7 @@ inline void set_use_polygon_assertions(bool b) #if defined(CGAL_POLYGON_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_polygon_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_exactness_precondition_code(CODE) @@ -224,8 +215,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_postcondition_msg #undef CGAL_polygon_postcondition_code -#if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_polygon_postcondition(EX) (static_cast(0)) # define CGAL_polygon_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_postcondition_code(CODE) @@ -244,8 +234,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_exactness_postcondition_code #if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_polygon_exactness_postcondition(EX) (static_cast(0)) # define CGAL_polygon_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_exactness_postcondition_code(CODE) @@ -264,8 +253,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_expensive_postcondition_code #if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_postcondition(EX) (static_cast(0)) # define CGAL_polygon_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_postcondition_code(CODE) @@ -285,8 +273,7 @@ inline void set_use_polygon_assertions(bool b) #if defined(CGAL_POLYGON_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_polygon_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_exactness_postcondition_code(CODE) @@ -307,8 +294,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_warning_msg #undef CGAL_polygon_warning_code -#if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_polygon_warning(EX) (static_cast(0)) # define CGAL_polygon_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_warning_code(CODE) @@ -327,8 +313,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_exactness_warning_code #if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_polygon_exactness_warning(EX) (static_cast(0)) # define CGAL_polygon_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_exactness_warning_code(CODE) @@ -347,8 +332,7 @@ inline void set_use_polygon_assertions(bool b) #undef CGAL_polygon_expensive_warning_code #if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_warning(EX) (static_cast(0)) # define CGAL_polygon_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_warning_code(CODE) @@ -368,8 +352,7 @@ inline void set_use_polygon_assertions(bool b) #if defined(CGAL_POLYGON_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_POLYGON_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_POLYGON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_polygon_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_polygon_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_polygon_expensive_exactness_warning_code(CODE) diff --git a/Polytope_distance_d/include/CGAL/Width_3.h b/Polytope_distance_d/include/CGAL/Width_3.h index 314582a5570..b3b055379a2 100644 --- a/Polytope_distance_d/include/CGAL/Width_3.h +++ b/Polytope_distance_d/include/CGAL/Width_3.h @@ -687,8 +687,7 @@ class Width_3 { std::vector apv; #if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE))\ - || defined(NDEBUG)) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE))) typename InputDA::Vertex_iterator vtxitass = P.vertices_begin(); while(vtxitass!=P.vertices_end()) { RT px,py,pz,ph; @@ -745,8 +744,7 @@ class Width_3 { DEBUGENDL(INITIAL_VF_PAIR,"Initial Plane E2: ",A<<" "<=0); @@ -1411,14 +1408,12 @@ class Width_3 { DEBUGMSG(WIDTH_3_CONVEX,"All plane equations of all facets computed."); //ensure all flags are false -#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG)) +#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS)) int halfedgecount=0; #endif Halfedge_handle esf=P.halfedges_begin(); while(esf!=P.halfedges_end()) { -#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG)) +#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS)) ++halfedgecount; #endif DEBUGENDL(EDGE_INITIALIZING,"Edge e: " @@ -1429,8 +1424,7 @@ class Width_3 { ++esf; } -#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG)) +#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS)) CGAL_assertion(int(P.size_of_halfedges())==halfedgecount); DEBUGENDL(WIDTH_3_CONVEX,"Visited all ",halfedgecount <<" halfedges. ASSERTION OK."); @@ -1446,8 +1440,7 @@ class Width_3 { initial_VF_pair(dao,f,P,go_on); #if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE))\ - || defined(NDEBUG)) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE))) Vertex_iterator vtxass=P.vertices_begin(); while(vtxass!=P.vertices_end()) { RT px,py,pz,ph; @@ -1523,8 +1516,7 @@ class Width_3 { } } #if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE))\ - || defined(NDEBUG)) + || (!defined(CGAL_KERNEL_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE))) Facet_handle fass=P.facets_begin(); while(fass!=P.facets_end()) { std::vector apvass; diff --git a/Polytope_distance_d/include/CGAL/Width_polyhedron_3.h b/Polytope_distance_d/include/CGAL/Width_polyhedron_3.h index 24e0df725e4..4c215e1f282 100644 --- a/Polytope_distance_d/include/CGAL/Width_polyhedron_3.h +++ b/Polytope_distance_d/include/CGAL/Width_polyhedron_3.h @@ -194,8 +194,7 @@ class Data_access { res=it->second; } -#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG)) +#if !(defined(CGAL_KERNEL_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS)) int size_of_impassable() { return(int(impassable_halfedges.size())); } diff --git a/STL_Extension/include/CGAL/multiset_assertions.h b/STL_Extension/include/CGAL/multiset_assertions.h index 9d001aefa79..894accd47fc 100644 --- a/STL_Extension/include/CGAL/multiset_assertions.h +++ b/STL_Extension/include/CGAL/multiset_assertions.h @@ -14,7 +14,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -27,8 +27,7 @@ #undef CGAL_multiset_assertion_msg #undef CGAL_multiset_assertion_code -#if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_multiset_assertion(EX) (static_cast(0)) # define CGAL_multiset_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_assertion_code(CODE) @@ -47,8 +46,7 @@ #undef CGAL_multiset_exactness_assertion_code #if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_multiset_exactness_assertion(EX) (static_cast(0)) # define CGAL_multiset_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_exactness_assertion_code(CODE) @@ -68,8 +66,7 @@ #if defined(CGAL_MULTISET_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_assertion(EX) (static_cast(0)) # define CGAL_multiset_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_assertion_code(CODE) @@ -89,8 +86,7 @@ #if defined(CGAL_MULTISET_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_multiset_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_exactness_assertion_code(CODE) @@ -111,8 +107,7 @@ #undef CGAL_multiset_precondition_msg #undef CGAL_multiset_precondition_code -#if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_multiset_precondition(EX) (static_cast(0)) # define CGAL_multiset_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_precondition_code(CODE) @@ -131,8 +126,7 @@ #undef CGAL_multiset_exactness_precondition_code #if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_multiset_exactness_precondition(EX) (static_cast(0)) # define CGAL_multiset_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_exactness_precondition_code(CODE) @@ -151,8 +145,7 @@ #undef CGAL_multiset_expensive_precondition_code #if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_precondition(EX) (static_cast(0)) # define CGAL_multiset_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_precondition_code(CODE) @@ -172,8 +165,7 @@ #if defined(CGAL_MULTISET_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_multiset_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_exactness_precondition_code(CODE) @@ -194,8 +186,7 @@ #undef CGAL_multiset_postcondition_msg #undef CGAL_multiset_postcondition_code -#if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_multiset_postcondition(EX) (static_cast(0)) # define CGAL_multiset_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_postcondition_code(CODE) @@ -214,8 +205,7 @@ #undef CGAL_multiset_exactness_postcondition_code #if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_multiset_exactness_postcondition(EX) (static_cast(0)) # define CGAL_multiset_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_exactness_postcondition_code(CODE) @@ -234,8 +224,7 @@ #undef CGAL_multiset_expensive_postcondition_code #if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_postcondition(EX) (static_cast(0)) # define CGAL_multiset_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_postcondition_code(CODE) @@ -255,8 +244,7 @@ #if defined(CGAL_MULTISET_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_multiset_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_exactness_postcondition_code(CODE) @@ -277,8 +265,7 @@ #undef CGAL_multiset_warning_msg #undef CGAL_multiset_warning_code -#if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_multiset_warning(EX) (static_cast(0)) # define CGAL_multiset_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_warning_code(CODE) @@ -297,8 +284,7 @@ #undef CGAL_multiset_exactness_warning_code #if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_multiset_exactness_warning(EX) (static_cast(0)) # define CGAL_multiset_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_exactness_warning_code(CODE) @@ -317,8 +303,7 @@ #undef CGAL_multiset_expensive_warning_code #if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_warning(EX) (static_cast(0)) # define CGAL_multiset_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_warning_code(CODE) @@ -338,8 +323,7 @@ #if defined(CGAL_MULTISET_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_MULTISET_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_MULTISET_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_multiset_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_multiset_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_multiset_expensive_exactness_warning_code(CODE) diff --git a/STL_Extension/include/CGAL/triangulation_assertions.h b/STL_Extension/include/CGAL/triangulation_assertions.h index c11b20b26db..07c7c80e72f 100644 --- a/STL_Extension/include/CGAL/triangulation_assertions.h +++ b/STL_Extension/include/CGAL/triangulation_assertions.h @@ -14,7 +14,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -27,8 +27,7 @@ #undef CGAL_triangulation_assertion_msg #undef CGAL_triangulation_assertion_code -#if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_triangulation_assertion(EX) (static_cast(0)) @@ -49,8 +48,7 @@ #undef CGAL_triangulation_exactness_assertion_code #if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_triangulation_exactness_assertion(EX) (static_cast(0)) # define CGAL_triangulation_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_exactness_assertion_code(CODE) @@ -70,8 +68,7 @@ #if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_assertion(EX) (static_cast(0)) # define CGAL_triangulation_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_assertion_code(CODE) @@ -91,8 +88,7 @@ #if defined(CGAL_TRIANGULATION_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_assertion_code(CODE) @@ -113,8 +109,7 @@ #undef CGAL_triangulation_precondition_msg #undef CGAL_triangulation_precondition_code -#if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_triangulation_precondition(EX) (static_cast(0)) # define CGAL_triangulation_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_precondition_code(CODE) @@ -133,8 +128,7 @@ #undef CGAL_triangulation_exactness_precondition_code #if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_triangulation_exactness_precondition(EX) (static_cast(0)) # define CGAL_triangulation_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_exactness_precondition_code(CODE) @@ -153,8 +147,7 @@ #undef CGAL_triangulation_expensive_precondition_code #if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_precondition(EX) (static_cast(0)) # define CGAL_triangulation_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_precondition_code(CODE) @@ -174,8 +167,7 @@ #if defined(CGAL_TRIANGULATION_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_precondition_code(CODE) @@ -196,8 +188,7 @@ #undef CGAL_triangulation_postcondition_msg #undef CGAL_triangulation_postcondition_code -#if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_triangulation_postcondition(EX) (static_cast(0)) # define CGAL_triangulation_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_postcondition_code(CODE) @@ -216,8 +207,7 @@ #undef CGAL_triangulation_exactness_postcondition_code #if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_triangulation_exactness_postcondition(EX) (static_cast(0)) # define CGAL_triangulation_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_exactness_postcondition_code(CODE) @@ -236,8 +226,7 @@ #undef CGAL_triangulation_expensive_postcondition_code #if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_postcondition(EX) (static_cast(0)) # define CGAL_triangulation_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_postcondition_code(CODE) @@ -257,8 +246,7 @@ #if defined(CGAL_TRIANGULATION_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_postcondition_code(CODE) @@ -279,8 +267,7 @@ #undef CGAL_triangulation_warning_msg #undef CGAL_triangulation_warning_code -#if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_triangulation_warning(EX) (static_cast(0)) # define CGAL_triangulation_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_warning_code(CODE) @@ -299,8 +286,7 @@ #undef CGAL_triangulation_exactness_warning_code #if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_triangulation_exactness_warning(EX) (static_cast(0)) # define CGAL_triangulation_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_exactness_warning_code(CODE) @@ -319,8 +305,7 @@ #undef CGAL_triangulation_expensive_warning_code #if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_warning(EX) (static_cast(0)) # define CGAL_triangulation_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_warning_code(CODE) @@ -340,8 +325,7 @@ #if defined(CGAL_TRIANGULATION_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_TRIANGULATION_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TRIANGULATION_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_triangulation_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_triangulation_expensive_exactness_warning_code(CODE) diff --git a/Scripts/scripts/cgal_create_assertions.sh b/Scripts/scripts/cgal_create_assertions.sh index f6b391924a2..91268e9b4e9 100755 --- a/Scripts/scripts/cgal_create_assertions.sh +++ b/Scripts/scripts/cgal_create_assertions.sh @@ -48,7 +48,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -61,8 +61,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_assertion_msg #undef CGAL_xxx_assertion_code -#if defined(CGAL_XXX_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_XXX_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_xxx_assertion(EX) (static_cast(0)) # define CGAL_xxx_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_assertion_code(CODE) @@ -81,8 +80,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_exactness_assertion_code #if defined(CGAL_XXX_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_xxx_exactness_assertion(EX) (static_cast(0)) # define CGAL_xxx_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_exactness_assertion_code(CODE) @@ -102,8 +100,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #if defined(CGAL_XXX_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_assertion(EX) (static_cast(0)) # define CGAL_xxx_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_assertion_code(CODE) @@ -123,8 +120,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #if defined(CGAL_XXX_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_xxx_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_exactness_assertion_code(CODE) @@ -145,8 +141,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_precondition_msg #undef CGAL_xxx_precondition_code -#if defined(CGAL_XXX_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_XXX_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_xxx_precondition(EX) (static_cast(0)) # define CGAL_xxx_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_precondition_code(CODE) @@ -165,8 +160,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_exactness_precondition_code #if defined(CGAL_XXX_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_xxx_exactness_precondition(EX) (static_cast(0)) # define CGAL_xxx_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_exactness_precondition_code(CODE) @@ -185,8 +179,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_expensive_precondition_code #if defined(CGAL_XXX_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_precondition(EX) (static_cast(0)) # define CGAL_xxx_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_precondition_code(CODE) @@ -206,8 +199,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #if defined(CGAL_XXX_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_xxx_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_exactness_precondition_code(CODE) @@ -228,8 +220,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_postcondition_msg #undef CGAL_xxx_postcondition_code -#if defined(CGAL_XXX_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_XXX_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_xxx_postcondition(EX) (static_cast(0)) # define CGAL_xxx_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_postcondition_code(CODE) @@ -248,8 +239,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_exactness_postcondition_code #if defined(CGAL_XXX_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_xxx_exactness_postcondition(EX) (static_cast(0)) # define CGAL_xxx_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_exactness_postcondition_code(CODE) @@ -268,8 +258,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_expensive_postcondition_code #if defined(CGAL_XXX_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_postcondition(EX) (static_cast(0)) # define CGAL_xxx_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_postcondition_code(CODE) @@ -289,8 +278,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #if defined(CGAL_XXX_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_xxx_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_exactness_postcondition_code(CODE) @@ -311,8 +299,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_warning_msg #undef CGAL_xxx_warning_code -#if defined(CGAL_XXX_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_XXX_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_xxx_warning(EX) (static_cast(0)) # define CGAL_xxx_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_warning_code(CODE) @@ -331,8 +318,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_exactness_warning_code #if defined(CGAL_XXX_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_xxx_exactness_warning(EX) (static_cast(0)) # define CGAL_xxx_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_exactness_warning_code(CODE) @@ -351,8 +337,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #undef CGAL_xxx_expensive_warning_code #if defined(CGAL_XXX_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_warning(EX) (static_cast(0)) # define CGAL_xxx_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_warning_code(CODE) @@ -372,8 +357,7 @@ sed -e "s/XXX_/${nameUC}/g" -e "s/xxx_/${nameLC}/g" <<"EOF" \ #if defined(CGAL_XXX_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_XXX_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_XXX_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_xxx_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_xxx_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_xxx_expensive_exactness_warning_code(CODE) diff --git a/SearchStructures/include/CGAL/Tree_assertions.h b/SearchStructures/include/CGAL/Tree_assertions.h index 1e6db8c676e..091d35fa81b 100644 --- a/SearchStructures/include/CGAL/Tree_assertions.h +++ b/SearchStructures/include/CGAL/Tree_assertions.h @@ -15,7 +15,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -28,8 +28,7 @@ #undef CGAL_Tree_assertion_msg #undef CGAL_Tree_assertion_code -#if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_Tree_assertion(EX) (static_cast(0)) #include @@ -51,8 +50,7 @@ #undef CGAL_Tree_exactness_assertion_code #if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_Tree_exactness_assertion(EX) (static_cast(0)) # define CGAL_Tree_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_exactness_assertion_code(CODE) @@ -72,8 +70,7 @@ #if defined(CGAL_TREE_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_assertion(EX) (static_cast(0)) # define CGAL_Tree_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_assertion_code(CODE) @@ -93,8 +90,7 @@ #if defined(CGAL_TREE_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_Tree_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_exactness_assertion_code(CODE) @@ -115,8 +111,7 @@ #undef CGAL_Tree_precondition_msg #undef CGAL_Tree_precondition_code -#if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_Tree_precondition(EX) (static_cast(0)) # define CGAL_Tree_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_precondition_code(CODE) @@ -135,8 +130,7 @@ #undef CGAL_Tree_exactness_precondition_code #if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_Tree_exactness_precondition(EX) (static_cast(0)) # define CGAL_Tree_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_exactness_precondition_code(CODE) @@ -155,8 +149,7 @@ #undef CGAL_Tree_expensive_precondition_code #if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_precondition(EX) (static_cast(0)) # define CGAL_Tree_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_precondition_code(CODE) @@ -176,8 +169,7 @@ #if defined(CGAL_TREE_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_Tree_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_exactness_precondition_code(CODE) @@ -198,8 +190,7 @@ #undef CGAL_Tree_postcondition_msg #undef CGAL_Tree_postcondition_code -#if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_Tree_postcondition(EX) (static_cast(0)) # define CGAL_Tree_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_postcondition_code(CODE) @@ -218,8 +209,7 @@ #undef CGAL_Tree_exactness_postcondition_code #if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_Tree_exactness_postcondition(EX) (static_cast(0)) # define CGAL_Tree_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_exactness_postcondition_code(CODE) @@ -238,8 +228,7 @@ #undef CGAL_Tree_expensive_postcondition_code #if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_postcondition(EX) (static_cast(0)) # define CGAL_Tree_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_postcondition_code(CODE) @@ -259,8 +248,7 @@ #if defined(CGAL_TREE_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_Tree_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_exactness_postcondition_code(CODE) @@ -281,8 +269,7 @@ #undef CGAL_Tree_warning_msg #undef CGAL_Tree_warning_code -#if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_Tree_warning(EX) (static_cast(0)) # define CGAL_Tree_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_warning_code(CODE) @@ -301,8 +288,7 @@ #undef CGAL_Tree_exactness_warning_code #if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_Tree_exactness_warning(EX) (static_cast(0)) # define CGAL_Tree_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_exactness_warning_code(CODE) @@ -321,8 +307,7 @@ #undef CGAL_Tree_expensive_warning_code #if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_warning(EX) (static_cast(0)) # define CGAL_Tree_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_warning_code(CODE) @@ -342,8 +327,7 @@ #if defined(CGAL_TREE_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_TREE_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_TREE_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_Tree_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_Tree_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_Tree_expensive_exactness_warning_code(CODE) diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h index 8b5be6a81c5..6d282c45d6a 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h @@ -16,8 +16,7 @@ #if defined(CGAL_STRAIGHT_SKELETON_NO_POSTCONDITIONS) \ || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STRAIGHT_SKELETON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STRAIGHT_SKELETON_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_stskel_expensive_postcondition(EX) (static_cast(0)) # define CGAL_stskel_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_stskel_expensive_postcondition_code(CODE) diff --git a/Stream_lines_2/include/CGAL/streamlines_assertions.h b/Stream_lines_2/include/CGAL/streamlines_assertions.h index 57a22d3a955..ce5fe41b14b 100644 --- a/Stream_lines_2/include/CGAL/streamlines_assertions.h +++ b/Stream_lines_2/include/CGAL/streamlines_assertions.h @@ -15,7 +15,7 @@ // Note that this header file is intentionnaly not protected with a // macro (as ). Calling it a second time with another value -// for NDEBUG for example must make a difference. +// for CGAL_NO_ASSERTIONS for example must make a difference. #include @@ -28,8 +28,7 @@ #undef CGAL_streamlines_assertion_msg #undef CGAL_streamlines_assertion_code -#if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || defined(NDEBUG) +#if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) # define CGAL_streamlines_assertion(EX) (static_cast(0)) #include @@ -51,8 +50,7 @@ #undef CGAL_streamlines_exactness_assertion_code #if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_streamlines_exactness_assertion(EX) (static_cast(0)) # define CGAL_streamlines_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_exactness_assertion_code(CODE) @@ -72,8 +70,7 @@ #if defined(CGAL_STREAMLINES_NO_ASSERTIONS) \ || defined(CGAL_NO_ASSERTIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_assertion(EX) (static_cast(0)) # define CGAL_streamlines_expensive_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_assertion_code(CODE) @@ -93,8 +90,7 @@ #if defined(CGAL_STREAMLINES_NO_ASSERTIONS) || defined(CGAL_NO_ASSERTIONS) \ || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_exactness_assertion(EX) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_assertion_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_assertion_code(CODE) @@ -115,8 +111,7 @@ #undef CGAL_streamlines_precondition_msg #undef CGAL_streamlines_precondition_code -#if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) # define CGAL_streamlines_precondition(EX) (static_cast(0)) # define CGAL_streamlines_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_precondition_code(CODE) @@ -135,8 +130,7 @@ #undef CGAL_streamlines_exactness_precondition_code #if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_streamlines_exactness_precondition(EX) (static_cast(0)) # define CGAL_streamlines_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_exactness_precondition_code(CODE) @@ -155,8 +149,7 @@ #undef CGAL_streamlines_expensive_precondition_code #if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_precondition(EX) (static_cast(0)) # define CGAL_streamlines_expensive_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_precondition_code(CODE) @@ -176,8 +169,7 @@ #if defined(CGAL_STREAMLINES_NO_PRECONDITIONS) || defined(CGAL_NO_PRECONDITIONS) \ || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_exactness_precondition(EX) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_precondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_precondition_code(CODE) @@ -198,8 +190,7 @@ #undef CGAL_streamlines_postcondition_msg #undef CGAL_streamlines_postcondition_code -#if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || defined(NDEBUG) +#if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) # define CGAL_streamlines_postcondition(EX) (static_cast(0)) # define CGAL_streamlines_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_postcondition_code(CODE) @@ -218,8 +209,7 @@ #undef CGAL_streamlines_exactness_postcondition_code #if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_streamlines_exactness_postcondition(EX) (static_cast(0)) # define CGAL_streamlines_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_exactness_postcondition_code(CODE) @@ -238,8 +228,7 @@ #undef CGAL_streamlines_expensive_postcondition_code #if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_postcondition(EX) (static_cast(0)) # define CGAL_streamlines_expensive_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_postcondition_code(CODE) @@ -259,8 +248,7 @@ #if defined(CGAL_STREAMLINES_NO_POSTCONDITIONS) || defined(CGAL_NO_POSTCONDITIONS) \ || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_exactness_postcondition(EX) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_postcondition_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_postcondition_code(CODE) @@ -281,8 +269,7 @@ #undef CGAL_streamlines_warning_msg #undef CGAL_streamlines_warning_code -#if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || defined(NDEBUG) +#if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) # define CGAL_streamlines_warning(EX) (static_cast(0)) # define CGAL_streamlines_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_warning_code(CODE) @@ -301,8 +288,7 @@ #undef CGAL_streamlines_exactness_warning_code #if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS)) # define CGAL_streamlines_exactness_warning(EX) (static_cast(0)) # define CGAL_streamlines_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_exactness_warning_code(CODE) @@ -321,8 +307,7 @@ #undef CGAL_streamlines_expensive_warning_code #if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_warning(EX) (static_cast(0)) # define CGAL_streamlines_expensive_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_warning_code(CODE) @@ -342,8 +327,7 @@ #if defined(CGAL_STREAMLINES_NO_WARNINGS) || defined(CGAL_NO_WARNINGS) \ || (!defined(CGAL_STREAMLINES_CHECK_EXACTNESS) && !defined(CGAL_CHECK_EXACTNESS))\ - || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) \ - || defined(NDEBUG) + || (!defined(CGAL_STREAMLINES_CHECK_EXPENSIVE) && !defined(CGAL_CHECK_EXPENSIVE)) # define CGAL_streamlines_expensive_exactness_warning(EX) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_warning_msg(EX,MSG) (static_cast(0)) # define CGAL_streamlines_expensive_exactness_warning_code(CODE) From 07120b82fa8e38c29b121c59d1ae57a75d2597b4 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Fri, 4 Dec 2020 17:43:14 +0000 Subject: [PATCH 033/178] Add missing header includes --- .../include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h | 2 ++ .../include/CGAL/Straight_skeleton_2/assertions.h | 1 + 2 files changed, 3 insertions(+) diff --git a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h index 3080b586837..50380fc882e 100644 --- a/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Curved_kernel_via_analysis_2/Arc_2.h @@ -37,6 +37,8 @@ #include +#include + namespace CGAL { namespace internal { diff --git a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h index 6d282c45d6a..3916c7627c5 100644 --- a/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h +++ b/Straight_skeleton_2/include/CGAL/Straight_skeleton_2/assertions.h @@ -13,6 +13,7 @@ #include +#include #if defined(CGAL_STRAIGHT_SKELETON_NO_POSTCONDITIONS) \ || defined(CGAL_NO_POSTCONDITIONS) \ From 3127190bcf4f1b017468fa022349c6f13fa2088d Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Tue, 8 Dec 2020 12:48:04 +0100 Subject: [PATCH 034/178] marc's review --- .../include/CGAL/AABB_segment_primitive.h | 13 +++++--- .../include/CGAL/AABB_triangle_primitive.h | 15 +++++---- .../AABB_triangulation_3_cell_primitive.h | 15 +++++---- Filtered_kernel/include/CGAL/Lazy.h | 29 ++++++++++------- .../CGAL/Circular_kernel_intersections.h | 7 ++-- .../CGAL/Spherical_kernel_intersections.h | 5 ++- Kernel_23/include/CGAL/Kernel/Type_mapper.h | 1 + .../Mesh_3/Robust_intersection_traits_3.h | 32 +++++++++++-------- .../NewKernel_d/Cartesian_static_filters.h | 1 + .../CGAL/NewKernel_d/Filtered_predicate2.h | 1 + .../CGAL/NewKernel_d/Kernel_d_interface.h | 4 +-- .../CGAL/NewKernel_d/Wrapper/Point_d.h | 2 +- 12 files changed, 73 insertions(+), 52 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_segment_primitive.h b/AABB_tree/include/CGAL/AABB_segment_primitive.h index d28c681c4c3..a4627c8592e 100644 --- a/AABB_tree/include/CGAL/AABB_segment_primitive.h +++ b/AABB_tree/include/CGAL/AABB_segment_primitive.h @@ -30,14 +30,17 @@ namespace internal { //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; + // typedef decltype( + // std::declval()( + // std::declval())) reference; typedef decltype( - std::declval()( - std::declval())) reference; + typename GeomTraits::Construct_source_3()( + *std::declval())) reference; typedef boost::readable_property_map_tag category; + typedef Source_of_segment_3_iterator_property_map Self; - inline friend - typename Source_of_segment_3_iterator_property_map::reference - get(Source_of_segment_3_iterator_property_map, Iterator it) + inline friend reference + get(Self, key_type it) { return typename GeomTraits::Construct_source_3()( *it ); } diff --git a/AABB_tree/include/CGAL/AABB_triangle_primitive.h b/AABB_tree/include/CGAL/AABB_triangle_primitive.h index 89b45f940be..b1b1bd1fe79 100644 --- a/AABB_tree/include/CGAL/AABB_triangle_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangle_primitive.h @@ -30,15 +30,18 @@ namespace internal { //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) reference; typedef decltype( - std::declval()( - std::declval(), - std::declval())) reference; + typename GeomTraits::Construct_vertex_3()( + *std::declval(), 0)) reference; typedef boost::readable_property_map_tag category; + typedef Point_from_triangle_3_iterator_property_map Self; - inline friend - typename Point_from_triangle_3_iterator_property_map::reference - get(Point_from_triangle_3_iterator_property_map, Iterator it) + inline friend reference + get(Self, key_type it) { return typename GeomTraits::Construct_vertex_3()( *it, 0 ); } diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index 90d520061a4..1db91627815 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -30,15 +30,18 @@ namespace CGAL //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) reference; typedef decltype( - std::declval()( - std::declval(), - std::declval())) reference; + typename GeomTraits::Construct_vertex_3()( + *std::declval(), 0)) reference; typedef boost::readable_property_map_tag category; + typedef Point_from_cell_iterator_proprety_map Self; - inline friend - typename Point_from_cell_iterator_proprety_map::reference - get(Point_from_cell_iterator_proprety_map, Iterator it) + inline friend reference + get(Self, key_type it) { typename GeomTraits::Construct_point_3 point; return point(it->vertex(1)->point()); diff --git a/Filtered_kernel/include/CGAL/Lazy.h b/Filtered_kernel/include/CGAL/Lazy.h index 1fa84f44ceb..73c5195a330 100644 --- a/Filtered_kernel/include/CGAL/Lazy.h +++ b/Filtered_kernel/include/CGAL/Lazy.h @@ -1486,10 +1486,13 @@ struct Lazy_construction_variant { operator()(const L1& l1, const L2& l2) const { typedef typename result::type result_type; - typedef decltype(std::declval()(std::declval::type>(), - std::declval::type>())) AT; - typedef decltype(std::declval()(std::declval::type>(), - std::declval::type>())) ET; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>())) AT; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>())) ET; + + typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2))) AT; + typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2))) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; @@ -1534,15 +1537,19 @@ struct Lazy_construction_variant { operator()(const L1& l1, const L2& l2, const L3& l3) const { typedef typename result::type result_type; - typedef decltype(std::declval()(std::declval::type>(), - std::declval::type>(), - std::declval::type>())) AT; - typedef decltype(std::declval()(std::declval::type>(), - std::declval::type>(), - std::declval::type>())) ET; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>(), + // std::declval::type>())) AT; + // typedef decltype(std::declval()(std::declval::type>(), + // std::declval::type>(), + // std::declval::type>())) ET; + + typedef decltype(std::declval()(CGAL::approx(l1), CGAL::approx(l2), CGAL::approx(l3))) AT; + typedef decltype(std::declval()( CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))) ET; CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); Protect_FPU_rounding P; + try { Lazy lazy(new Lazy_rep_n(AC(), EC(), l1, l2, l3)); @@ -1594,7 +1601,7 @@ struct Lazy_construction { typedef typename boost::remove_cv< typename boost::remove_reference < typename AC::result_type >::type >::type AT; typedef typename boost::remove_cv< - typename boost::remove_reference < typename EC::result_type >::type >::type ET; + typename boost::remove_reference < typename EC::result_type >::type >::type ET; typedef typename Default::Get::type E2A; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h index 52b6131ddbc..7024d483aa1 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Circular_kernel_intersections.h @@ -46,10 +46,9 @@ the following function overloads are also available. The iterator versions of those functions can be used in conjunction with `Dispatch_output_iterator`. -Since both the number of intersections, if any, and their types, depend -on the arguments, the function expects an output iterator on -`decltype(std::declval()(std::declval(), std::declval()))`, as -presented below. +Since both the number of intersections, if any, and types of the interesection results +depend on the arguments, the function expects an output iterator on `K::Intersect_2(Type1, Type2)` +as presented below. */ /// @{ diff --git a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h index 63b75823a33..0c1a977f305 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Spherical_kernel_intersections.h @@ -57,9 +57,8 @@ the following function overloads are also available. The iterator versions of those functions can be used in conjunction with `Dispatch_output_iterator`. -Since both the number of intersections, if any, and their types, depend -on the arguments, the function expects an output iterator on -`decltype(std::declval()(std::declval(), std::declval()))`, +Since both the number of intersections, if any, and types of the interesection results +depend on the arguments, the function expects an output iterator on `Kernel::Intersect_3(Type1, Type2)` as presented below. */ /// @{ diff --git a/Kernel_23/include/CGAL/Kernel/Type_mapper.h b/Kernel_23/include/CGAL/Kernel/Type_mapper.h index 3dda35168d6..683b7fe9255 100644 --- a/Kernel_23/include/CGAL/Kernel/Type_mapper.h +++ b/Kernel_23/include/CGAL/Kernel/Type_mapper.h @@ -87,6 +87,7 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _) //}; // Then we specialize for all kernel objects. +// More details on why it is like that are here: https://github.com/CGAL/cgal/pull/4878#discussion_r459986501 #define CGAL_Kernel_obj(X) \ template < typename K1, typename K2 > \ struct Type_mapper_impl < typename K1::X, K1, K2 > \ diff --git a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h index 3178ebcbb9c..b76e75a8f04 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h @@ -266,10 +266,11 @@ ts_intersection(const typename K::Triangle_3 &t, const typename K::Segment_3 &s, const K & k) { - typedef decltype( - std::declval()( - std::declval(), - std::declval())) result_type; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) result_type; + typedef decltype(typename K::Intersect_3()(s, t)) result_type; CGAL_MESH_3_BRANCH_PROFILER(std::string("coplanar/calls in : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -409,10 +410,11 @@ tr_intersection(const typename K::Triangle_3 &t, CGAL_kernel_precondition( ! k.is_degenerate_3_object()(t) ) ; CGAL_kernel_precondition( ! k.is_degenerate_3_object()(r) ) ; - typedef decltype( - std::declval()( - std::declval(), - std::declval())) result_type; + // typedef decltype( + // std::declval()( + // std::declval(), + // std::declval())) result_type; + typedef decltype(typename K::Intersect_3()(r, t)) result_type; typedef typename K::Point_3 Point_3; @@ -485,9 +487,10 @@ public: EK::Intersect_3 exact_intersection = EK().intersect_3_object(); // Cartesian converters have an undocumented, optional< variant > operator - typedef decltype( - std::declval()( - std::declval(), std::declval())) result_type; + // typedef decltype( + // std::declval()( + // std::declval(), std::declval())) result_type; + typedef decltype(typename K_::Intersect_3()(t, s)) result_type; return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); } @@ -540,9 +543,10 @@ public: EK::Intersect_3 exact_intersection = EK().intersect_3_object(); // Cartesian converters have an undocumented, optional< variant > operator - typedef decltype( - std::declval()( - std::declval(), std::declval())) result_type; + // typedef decltype( + // std::declval()( + // std::declval(), std::declval())) result_type; + typedef decltype(typename K_::Intersect_3()(t, s)) result_type; return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s)))); } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h index 701cbff1efc..381e4e752a4 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -32,6 +32,7 @@ template struct Orientation_of_points_2 : private Store_k struct Point_2 { R_ const&r; CC const&c; Point const& p; Point_2(R_ const&r_, CC const&c_, Point const&p_):r(r_),c(c_),p(p_){} + // use result_of instead or better decltype(auto)? typename CC::result_type x()const{return c(p,0);} typename CC::result_type y()const{return c(p,1);} }; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h index 0265a9239e7..66c2029f5a6 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h @@ -58,6 +58,7 @@ public: typedef C2E To_exact_converter; typedef C2A To_approximate_converter; + // FIXME: should use result_of or decltype(auto), see emails by Nico typedef typename EP::result_type result_type; // AP::result_type must be convertible to EP::result_type. diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h index c4d0bd80e4b..96a33b33c14 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_d_interface.h @@ -127,14 +127,14 @@ template struct Kernel_d_interface : public Base_ { typedef typename Get_functor >::type CPI; typedef typename Get_functor >::type CVI; // FIXME: The following sometimes breaks compilation. The typedef below forces instantiation of this, which forces Point_d, which itself (in the wrapper) needs the derived kernel to tell it what the base kernel is, and that's a cycle. The exact circumstances are not clear, g++ and clang++ are ok in both C++03 and C++11, it is only clang in C++11 without CGAL_CXX11 that breaks. Relying on CPI::result_type is great for Epick_d but not Epeck_d. - // typedef typename CGAL::decay()(std::declval(), std::declval()))>::type result_type; + // typedef typename CGAL::decay::type>::type result_type; // typedef typename CGAL::decay::type result_type; // typedef decltype(std::declval()(std::declval(),Begin_tag{})) result_type; // HACK typedef typename Base::Point_cartesian_const_iterator result_type; // Kernel_d requires a common iterator type for points and vectors // TODO: provide this mixed functor in preKernel? - // CGAL_static_assertion((boost::is_same()(std::declval(), std::declval()))>::type, result_type>::value)); + // CGAL_static_assertion((boost::is_same::type>::type, result_type>::value)); // CGAL_static_assertion((boost::is_same::type, result_type>::value)); template auto operator()(Point_d const&p, Tag_ t)const{ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 90bb34da3de..f21a7f6b4ba 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -49,7 +49,7 @@ public: typedef Dimension_tag<0> Feature_dimension; typedef typename Get_type::type Rep; - // typedef typename CGAL::decay()(std::declval(), std::declval()))>::type Cartesian_const_iterator; + // typedef typename CGAL::decay::type>::type Cartesian_const_iterator; const Rep& rep() const noexcept { From 40197ade1ab4a394762ff22213e0956a58db0a39 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Dec 2020 16:33:01 +0100 Subject: [PATCH 035/178] add missing forward declaration --- .../internal/Intrinsic_Delaunay_triangulation_3.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index 6ce491def7b..9b71bb1e286 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -43,8 +43,6 @@ namespace CGAL { namespace Heat_method_3 { - - // forward declaration template struct IDT_vertex_point_property_map; @@ -53,6 +51,12 @@ struct IDT_vertex_point_property_map; template struct IDT_vertex_distance_property_map; +// forward declaration +namespace internal { + template + bool has_degenerate_faces(const TriangleMesh& tm, const Traits& traits); +} + template struct Intrinsic_Delaunay_triangulation_3_vertex_descriptor { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; From d29baab36307a75b0807366b713c4be8d83309c9 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 6 Dec 2020 10:27:15 +0000 Subject: [PATCH 036/178] Add a move assignment operator to Handle.h --- STL_Extension/include/CGAL/Handle.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/STL_Extension/include/CGAL/Handle.h b/STL_Extension/include/CGAL/Handle.h index 0d652ccb4cb..efe7c849587 100644 --- a/STL_Extension/include/CGAL/Handle.h +++ b/STL_Extension/include/CGAL/Handle.h @@ -68,6 +68,13 @@ class Handle return *this; } + Handle& + operator=(Handle&& x) noexcept + { + swap(*this,x); + return *this; + } + friend void swap(Handle& a, Handle& b) noexcept { std::swap(a.PTR, b.PTR); } void reset() From f5563a73d04f38b48ff806e97d23305bd568c7cc Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 6 Dec 2020 10:28:10 +0000 Subject: [PATCH 037/178] Add a move assignment operator to Nef_Polyhedron.h --- Nef_3/include/CGAL/Nef_polyhedron_3.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Nef_3/include/CGAL/Nef_polyhedron_3.h index 3eb723d37b7..457e0afdc7b 100644 --- a/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -369,11 +369,18 @@ protected: } Nef_polyhedron_3& operator=(const Nef_polyhedron_3& N1) { - Base::operator=(N1); + Base::operator=(N1); // copy the handle set_snc(snc()); return (*this); } + Nef_polyhedron_3& operator=(Nef_polyhedron_3&& N1) noexcept { + N1.set_snc(snc()); // N1.set_snc sets N1.sncp_ not N1.snc_ + Base::operator=(std::move(N1)); // swap the handles + set_snc(snc()); // snc() will return N1.snc_ + return (*this); + } + ~Nef_polyhedron_3() { CGAL_NEF_TRACEN("~Nef_polyhedron_3: destructor called for snc "<<&snc()<< ", pl "< Date: Sun, 13 Dec 2020 09:04:40 +0000 Subject: [PATCH 038/178] Add a move constructor to Handle.h --- STL_Extension/include/CGAL/Handle.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/STL_Extension/include/CGAL/Handle.h b/STL_Extension/include/CGAL/Handle.h index efe7c849587..6139c314425 100644 --- a/STL_Extension/include/CGAL/Handle.h +++ b/STL_Extension/include/CGAL/Handle.h @@ -51,6 +51,12 @@ class Handle PTR->count++; } + Handle(Handle&& x) noexcept + : PTR(x.PTR) + { + x.PTR = static_cast(0); + } + ~Handle() { if ( PTR && (--PTR->count == 0)) From c85e94243dd8bdb5946e5ff524b5e92cdf2b5f35 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 13 Dec 2020 13:49:37 +0000 Subject: [PATCH 039/178] Add move assignment operator to SHalfloop.h --- Nef_3/include/CGAL/Nef_3/SHalfloop.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Nef_3/include/CGAL/Nef_3/SHalfloop.h b/Nef_3/include/CGAL/Nef_3/SHalfloop.h index c4abb9ebcdc..e6cc98bf944 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfloop.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfloop.h @@ -75,6 +75,15 @@ class SHalfloop_base { return *this; } + SHalfloop_base& operator=(SHalfloop_base&& l) noexcept + { twin_ = std::move(l.twin_); + incident_sface_ = std::move(l.incident_sface_); + facet_ = std::move(l.facet_); + mark_ = std::move(l.mark_); + circle_ = std::move(l.circle_); + return *this; + } + Mark& mark() { return mark_;} const Mark& mark() const { return mark_; } From 70887f532d0f88c14a1a6e4211f52e0591c4374b Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 13 Dec 2020 15:30:35 +0000 Subject: [PATCH 040/178] Add move assignment operator to Halfedge.h --- Nef_3/include/CGAL/Nef_3/Halfedge.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Nef_3/include/CGAL/Nef_3/Halfedge.h b/Nef_3/include/CGAL/Nef_3/Halfedge.h index 3903477b915..21506e7db3b 100644 --- a/Nef_3/include/CGAL/Nef_3/Halfedge.h +++ b/Nef_3/include/CGAL/Nef_3/Halfedge.h @@ -100,6 +100,17 @@ class Halfedge_base return *this; } + Halfedge_base& operator=(Halfedge_base&& e) noexcept + { center_vertex_ = std::move(e.center_vertex_); + point_ = std::move(e.point_); + mark_ = std::move(e.mark_); + twin_ = std::move(e.twin_); + out_sedge_ = std::move(e.out_sedge_); + incident_sface_ = std::move(e.incident_sface_); + info_ = 0; + return *this; + } + Vertex_handle& center_vertex() { return center_vertex_; } Vertex_const_handle center_vertex() const { return center_vertex_; } From 6b9fd0c2df9714e2a7472ee14cf952b7e3624474 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 13 Dec 2020 16:07:45 +0000 Subject: [PATCH 041/178] Add move assignment operator to SHalfedge.h --- Nef_3/include/CGAL/Nef_3/SHalfedge.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Nef_3/include/CGAL/Nef_3/SHalfedge.h b/Nef_3/include/CGAL/Nef_3/SHalfedge.h index f390132078f..ddf5b382b1d 100644 --- a/Nef_3/include/CGAL/Nef_3/SHalfedge.h +++ b/Nef_3/include/CGAL/Nef_3/SHalfedge.h @@ -114,6 +114,22 @@ class SHalfedge_base { return *this; } + SHalfedge_base& operator=(SHalfedge_base&& e) noexcept + { + source_ = std::move(e.source_); + sprev_ = std::move(e.sprev_); + snext_ = std::move(e.snext_); + incident_sface_ = std::move(e.incident_sface_); + twin_ = std::move(e.twin_); + prev_ = std::move(e.prev_); + next_ = std::move(e.next_); + facet_ = std::move(e.facet_); + info_ = 0; + mark_ = std::move(e.mark_); + circle_ = std::move(e.circle_); + return *this; + } + Mark& mark() { return mark_; } const Mark& mark() const { return mark_; } From e2ea93dbc572c9d816163b5ad46ccc6510f9f104 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Tue, 19 Jan 2021 13:06:16 +0100 Subject: [PATCH 042/178] fixed wrong reference type in aabb tree --- .../CGAL/AABB_triangulation_3_cell_primitive.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h index 1db91627815..4400335e8e3 100644 --- a/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h +++ b/AABB_tree/include/CGAL/AABB_triangulation_3_cell_primitive.h @@ -30,13 +30,13 @@ namespace CGAL //classical typedefs typedef Iterator key_type; typedef typename GeomTraits::Point_3 value_type; - // typedef decltype( - // std::declval()( - // std::declval(), - // std::declval())) reference; typedef decltype( - typename GeomTraits::Construct_vertex_3()( - *std::declval(), 0)) reference; + std::declval()( + std::declval(), + std::declval())) reference; + // typedef decltype( + // typename GeomTraits::Construct_vertex_3()( + // *std::declval(), 0)) reference; // fails polyhedron demo! typedef boost::readable_property_map_tag category; typedef Point_from_cell_iterator_proprety_map Self; From fa6afe73d19ede468d43616810ca255326913cbe Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 21 Jan 2021 11:18:27 +0100 Subject: [PATCH 043/178] Add a static assert so that Parallel_tag can only be used with TBB --- TDS_3/include/CGAL/Triangulation_data_structure_3.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 7c01149ab44..65e94bad71b 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -56,6 +56,7 @@ #endif #include +#include namespace CGAL { @@ -130,6 +131,10 @@ public: >::type Cell_range; # else + CGAL_static_assertion_msg + (!(std::is_convertible::value), + "In CGAL triangulations, `Parallel_tag` can only be used with the Intel TBB library. " + "Make TBB available in the build system and then define the macro `CGAL_LINKED_WITH_TBB`."); typedef Compact_container Cell_range; #endif From 8e316f63f7dae9ee7dc15eed13b88b0dc7237a54 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 21 Jan 2021 11:19:16 +0100 Subject: [PATCH 044/178] Replace by --- TDS_3/include/CGAL/Triangulation_data_structure_3.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/TDS_3/include/CGAL/Triangulation_data_structure_3.h b/TDS_3/include/CGAL/Triangulation_data_structure_3.h index 65e94bad71b..2fa274adadc 100644 --- a/TDS_3/include/CGAL/Triangulation_data_structure_3.h +++ b/TDS_3/include/CGAL/Triangulation_data_structure_3.h @@ -55,7 +55,6 @@ # include #endif -#include #include namespace CGAL { @@ -123,9 +122,9 @@ public: // Cells // N.B.: Concurrent_compact_container requires TBB #ifdef CGAL_LINKED_WITH_TBB - typedef typename boost::mpl::if_c + typedef typename std::conditional < - boost::is_convertible::value, + std::is_convertible::value, Concurrent_compact_container >, Compact_container >::type Cell_range; @@ -141,9 +140,9 @@ public: // Vertices // N.B.: Concurrent_compact_container requires TBB #ifdef CGAL_LINKED_WITH_TBB - typedef typename boost::mpl::if_c + typedef typename std::conditional < - boost::is_convertible::value, + std::is_convertible::value, Concurrent_compact_container >, Compact_container >::type Vertex_range; From 87d114137f992a055cd0f51d720c0bec7deed633 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sun, 7 Feb 2021 09:52:45 +0000 Subject: [PATCH 045/178] Calculate indices only when required in check_integrity_and_topological_planarity --- .../include/CGAL/Nef_S2/SM_const_decorator.h | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h index 74b16be98ae..dac5514735f 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h @@ -273,36 +273,51 @@ The macros are then |CGAL_forall_svertices(v,M)|, |CGAL_forall_sfaces(f,M)|, |CGAL_forall_sface_cycles_of(fc,F)| where |M| is a sphere map and |F| is a sface.}*/ +private: +std::string get_svertex_index(SVertex_const_handle) const; +std::string get_shalfedge_index(SHalfedge_const_handle e) const; + }; // SM_const_decorator +template +std::string SM_const_decorator:: +get_svertex_index(SVertex_const_handle v) const +{ + Object_index + VI(svertices_begin(),svertices_end(),'v'); + return VI(v); +} + +template +std::string SM_const_decorator:: +get_shalfedge_index(SHalfedge_const_handle e) const +{ + Object_index + EI(shalfedges_begin(),shalfedges_end(),'e'); + return EI(e); +} + template void SM_const_decorator:: check_integrity_and_topological_planarity(bool faces) const { CGAL_NEF_TRACEN("check_integrity_and_topological_planarity:"); - using CGAL::Object_index; - Object_index - VI(svertices_begin(),svertices_end(),'v'); - Object_index - EI(shalfedges_begin(),shalfedges_end(),'e'); - Object_index - FI(sfaces_begin(),sfaces_end(),'f'); + SVertex_const_handle v; int iso_vert_num=0; /* check the source links of out edges and count isolated vertices */ CGAL_forall_svertices(v,*this) { if ( is_isolated(v) ) { if ( faces ) - CGAL_assertion_msg(v->incident_sface() != SFace_const_handle(), VI(v).c_str()); + CGAL_assertion_msg(v->incident_sface() != SFace_const_handle(), get_svertex_index(v).c_str()); ++iso_vert_num; } else { - CGAL_assertion_msg(first_out_edge(v) != SHalfedge_const_handle(), - VI(v).c_str()); - CGAL_NEF_TRACEN(v->point()<<" "<source() == v, - VI(v).c_str()); + CGAL_assertion_code(SHalfedge_const_handle e=first_out_edge(v)); + CGAL_assertion_msg(e != SHalfedge_const_handle(), get_svertex_index(v).c_str()); + CGAL_NEF_TRACEN(v->point()<<" "<source() == v, get_svertex_index(v).c_str()); } } From 9c6712c3b127478de882577229aec8d1bb2105c2 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Mon, 8 Feb 2021 19:32:33 +0000 Subject: [PATCH 046/178] Calculate indices correctly when trace enabled --- Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h index dac5514735f..fe38af9ab44 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_const_decorator.h @@ -275,7 +275,6 @@ where |M| is a sphere map and |F| is a sface.}*/ private: std::string get_svertex_index(SVertex_const_handle) const; -std::string get_shalfedge_index(SHalfedge_const_handle e) const; }; // SM_const_decorator @@ -290,21 +289,15 @@ get_svertex_index(SVertex_const_handle v) const return VI(v); } -template -std::string SM_const_decorator:: -get_shalfedge_index(SHalfedge_const_handle e) const -{ - Object_index - EI(shalfedges_begin(),shalfedges_end(),'e'); - return EI(e); -} - template void SM_const_decorator:: check_integrity_and_topological_planarity(bool faces) const { CGAL_NEF_TRACEN("check_integrity_and_topological_planarity:"); - +#ifdef CGAL_USE_TRACE + Object_index + EI(shalfedges_begin(),shalfedges_end(),'e'); +#endif SVertex_const_handle v; int iso_vert_num=0; /* check the source links of out edges and count isolated vertices */ @@ -316,7 +309,7 @@ check_integrity_and_topological_planarity(bool faces) const } else { CGAL_assertion_code(SHalfedge_const_handle e=first_out_edge(v)); CGAL_assertion_msg(e != SHalfedge_const_handle(), get_svertex_index(v).c_str()); - CGAL_NEF_TRACEN(v->point()<<" "<point()<<" "<source() == v, get_svertex_index(v).c_str()); } } From af3f6dd07fad9e8e4fc477d3a59f00b4ea7a813e Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Tue, 9 Feb 2021 17:30:06 +0100 Subject: [PATCH 047/178] fixed warnings with Intersect_3 and result_of --- Kernel_23/include/CGAL/Kernel/function_objects.h | 9 ++++----- STL_Extension/include/CGAL/result_of.h | 10 +++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 41e978b703b..21e1db34de4 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -3292,11 +3292,10 @@ namespace CommonKernelFunctors { bool operator()(const Sphere_3& s1, const Sphere_3& s2, const Point_3& a, const Point_3& b) const { - typedef typename K::Circle_3 Circle_3; - typedef typename K::Point_3 Point_3; - typedef typename K::Segment_3 Segment_3; - typedef typename K::Plane_3 Plane_3; - typedef typename K::Intersect_3 Intersect_3; + typedef typename K::Circle_3 Circle_3; + typedef typename K::Point_3 Point_3; + typedef typename K::Segment_3 Segment_3; + typedef typename K::Plane_3 Plane_3; const Has_on_bounded_side_3& has_on_bounded_side = *this; diff --git a/STL_Extension/include/CGAL/result_of.h b/STL_Extension/include/CGAL/result_of.h index 1ed20008f20..863ddb90806 100644 --- a/STL_Extension/include/CGAL/result_of.h +++ b/STL_Extension/include/CGAL/result_of.h @@ -21,7 +21,11 @@ #include #include -#if CGAL_CXX11 +#if CGAL_CXX20 || __cpp_lib_is_invocable>=201703L + + // C++>=17 + +#elif CGAL_CXX11 #include @@ -45,7 +49,7 @@ namespace CGAL { namespace cpp11 { -#if CGAL_CXX20 +#if CGAL_CXX20 || __cpp_lib_is_invocable>=201703L template class result_of; template @@ -59,7 +63,7 @@ namespace cpp11 { using boost::result_of; -#endif +#endif // end C++<11 } // end cpp11 } // end CGAL From 0f751faa24e570c437b5561dcfab48fc9f6dfaee Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Wed, 4 Nov 2020 17:57:15 +0000 Subject: [PATCH 048/178] Implement hash of halffacet_pair for ID support handler --- Nef_3/include/CGAL/Nef_3/ID_support_handler.h | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h index a62e50c78e6..33696cc9120 100644 --- a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h +++ b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h @@ -38,8 +38,23 @@ class ID_support_handler { typedef typename Decorator::SHalfloop_const_handle SHalfloop_const_handle; typedef typename Decorator::Halffacet_const_handle Halffacet_const_handle; - typedef CGAL::Unique_hash_map F2E; - CGAL::Unique_hash_map f2m; + struct Halffacet_pair + { + Halffacet_const_handle f1; + Halffacet_const_handle f2; + bool operator==(const Halffacet_pair& r) const + { return f1==r.f1 && f2==r.f2; } + }; + + struct Handle_pair_hash_function { + std::size_t operator() (const Halffacet_pair& p) const { + std::size_t hash = 53; + hash = 97 * hash + Handle_hash_function()(p.f1); + hash = 97 * hash + Handle_hash_function()(p.f2); + return hash; + } + }; + CGAL::Unique_hash_map f2m; std::map hash; public: @@ -76,17 +91,17 @@ class ID_support_handler { CGAL_NEF_TRACEN("hash_facet_pair " << sv->point() << std::endl << " " << f1->plane() << &f1 << std::endl << " " << f2->plane() << &f2); - - if(f2m[f1][f2]==0) { + int& idx=f2m[{f1,f2}]; + if(idx==0) { sv->set_index(); - f2m[f1][f2] = sv->get_index(); + idx = sv->get_index(); CGAL_NEF_TRACEN("insert " << sv->point() << &*sv - << ": " << f2m[f1][f2]); + << ": " << idx); CGAL_NEF_TRACEN("not defined, yet"); } else { CGAL_NEF_TRACEN("access " << sv->point() << &*sv); - sv->set_index(f2m[f1][f2]); + sv->set_index(idx); } } From 2718072e0f364ea3e60e26020dc869d797e26413 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Wed, 10 Feb 2021 10:20:21 +0100 Subject: [PATCH 049/178] projection traits removed result_of --- Kernel_23/include/CGAL/internal/Projection_traits_3.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_3.h index eb94a85caf6..8e20d4fd2d1 100644 --- a/Kernel_23/include/CGAL/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Projection_traits_3.h @@ -327,8 +327,7 @@ public: //compute intersection points in projected plane //We know that none of the segment is degenerate - typename CGAL::cpp11::result_of::type - o = intersection(s1_2,s2_2); + auto o = intersection(s1_2,s2_2); if(! o){ return boost::none; } From c970c4a7588a404e0f3c76a87113e5c5677e2cdd Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 11 Feb 2021 09:48:27 +0100 Subject: [PATCH 050/178] removed unused Point_3 type in PMP --- .../Polygon_mesh_processing/internal/Corefinement/predicates.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h index 49aa3ed8a57..916677bf00e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/predicates.h @@ -83,8 +83,6 @@ bool sorted_around_edge( || coplanar_orientation(o,o_prime,p2,q)==NEGATIVE ); typename Kernel::Orientation_3 orientation; - typedef typename Kernel::Point_3 Point_3; - const auto s0 = orientation(o_prime, o, p1, p2); if ( s0==COPLANAR ) { From 393b49f96d8488a55627199d63d47a9c3dd78dfc Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Thu, 11 Feb 2021 18:29:44 +0000 Subject: [PATCH 051/178] Use boost::hash_combine and std::unordered_map for ID support handler --- Nef_3/include/CGAL/Nef_3/ID_support_handler.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h index 33696cc9120..b1c64341c80 100644 --- a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h +++ b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h @@ -18,7 +18,8 @@ #include #include -#include +#include +#include #include #undef CGAL_NEF_DEBUG @@ -48,13 +49,13 @@ class ID_support_handler { struct Handle_pair_hash_function { std::size_t operator() (const Halffacet_pair& p) const { - std::size_t hash = 53; - hash = 97 * hash + Handle_hash_function()(p.f1); - hash = 97 * hash + Handle_hash_function()(p.f2); + std::size_t hash = 0; + boost::hash_combine(hash,Handle_hash_function()(p.f1)); + boost::hash_combine(hash,Handle_hash_function()(p.f2)); return hash; } }; - CGAL::Unique_hash_map f2m; + std::unordered_map f2m; std::map hash; public: From 5e86781ad8246c3cfaaeee0b54413d191d426c46 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 12 Feb 2021 10:29:14 +0100 Subject: [PATCH 052/178] add code to detect connected components in gray-level images --- ...tialize_triangulation_from_labeled_image.h | 43 +++++++++++++++---- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index 873ae27786a..f500816c00b 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -64,16 +65,41 @@ void init_tr_from_labeled_image_call_init_features(C3T3& c3t3, << " initial points on 1D-features" << std::endl; } +template +void initialize_triangulation_from_gray_image(C3T3& c3t3, + const MeshDomain& domain, + const CGAL::Image_3& image, + const MeshCriteria& criteria, + const FT& iso_value, + Image_word_type, + bool protect_features = false) +{ + typedef CGAL::Null_functor Functor; + Functor image_values_to_subdomain_indices; + + using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; + typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; + typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; + Image_values_to_subdomain_indices transform_fct = + C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); + + initialize_triangulation_from_labeled_image(c3t3, domain, image, criteria, + Image_word_type(), + protect_features, + transform_fct); +} template + typename Image_word_type, + typename TransformOperator = CGAL::Identity > void initialize_triangulation_from_labeled_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - Image_word_type, - bool protect_features = false - ) + const MeshDomain& domain, + const CGAL::Image_3& image, + const MeshCriteria& criteria, + Image_word_type, + bool protect_features = false, + TransformOperator transform = CGAL::Identity()) { typedef typename C3T3::Triangulation Tr; typedef typename Tr::Geom_traits Gt; @@ -111,11 +137,10 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, Seeds seeds; Get_point get_point(&image); std::cout << "Searching for connected components..." << std::endl; - CGAL::Identity no_transformation; search_for_connected_components_in_labeled_image(image, std::back_inserter(seeds), CGAL::Emptyset_iterator(), - no_transformation, + transform, get_point, Image_word_type()); std::cout << " " << seeds.size() << " components were found." << std::endl; From 3f4c1c4628af0f2d621878def5ca690bb1ecfb3c Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Fri, 12 Feb 2021 11:31:03 +0100 Subject: [PATCH 053/178] moved point/vertex/[] definitions of Segment_2/3 inside the class --- Kernel_23/include/CGAL/Segment_2.h | 32 ++++++------------------------ Kernel_23/include/CGAL/Segment_3.h | 11 ++-------- 2 files changed, 8 insertions(+), 35 deletions(-) diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index acb75fd5374..ba533d050d2 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -101,13 +101,16 @@ public: max BOOST_PREVENT_MACRO_SUBSTITUTION () const; decltype(auto) - vertex(int i) const; + vertex(int i) const + { return (i%2 == 0) ? source() : target(); } decltype(auto) - point(int i) const; + point(int i) const + { return vertex(i); } decltype(auto) - operator[](int i) const; + operator[](int i) const + { return vertex(i); } bool is_horizontal() const; bool is_vertical() const; @@ -187,29 +190,6 @@ Segment_2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const return less_xy(source(),target()) ? target() : source(); } -template < class R_ > -CGAL_KERNEL_INLINE -decltype(auto) -Segment_2::vertex(int i) const -{ - return (i%2 == 0) ? source() : target(); -} - -template < class R_ > -inline -decltype(auto) -Segment_2::point(int i) const -{ - return vertex(i); -} - -template < class R_ > -inline -decltype(auto) -Segment_2::operator[](int i) const -{ - return vertex(i); -} template < class R_ > CGAL_KERNEL_INLINE diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index 9bece158b35..a15d3439874 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -99,7 +99,8 @@ public: max BOOST_PREVENT_MACRO_SUBSTITUTION () const; decltype(auto) - vertex(int i) const; + vertex(int i) const + { return (i%2 == 0) ? source() : target(); } decltype(auto) point(int i) const @@ -179,14 +180,6 @@ Segment_3::max BOOST_PREVENT_MACRO_SUBSTITUTION () const return less_xyz(source(),target()) ? target() : source(); } -template < class R_ > -CGAL_KERNEL_INLINE -decltype(auto) -Segment_3::vertex(int i) const -{ - return (i%2 == 0) ? source() : target(); -} - template < class R > std::ostream & From e94c41714ad84cdeb72a3339f946656780697750 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 12 Feb 2021 14:15:56 +0100 Subject: [PATCH 054/178] Fix a compilation error The definition of `initialize_triangulation_from_gray_image` required `initialize_triangulation_from_labeled_image` to be defined, or at least declared. --- ...tialize_triangulation_from_labeled_image.h | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index f500816c00b..e50d4416d83 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -65,31 +65,6 @@ void init_tr_from_labeled_image_call_init_features(C3T3& c3t3, << " initial points on 1D-features" << std::endl; } -template -void initialize_triangulation_from_gray_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - const FT& iso_value, - Image_word_type, - bool protect_features = false) -{ - typedef CGAL::Null_functor Functor; - Functor image_values_to_subdomain_indices; - - using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; - typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; - typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; - Image_values_to_subdomain_indices transform_fct = - C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); - - initialize_triangulation_from_labeled_image(c3t3, domain, image, criteria, - Image_word_type(), - protect_features, - transform_fct); -} - template > @@ -270,4 +245,29 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, } } +template +void initialize_triangulation_from_gray_image(C3T3& c3t3, + const MeshDomain& domain, + const CGAL::Image_3& image, + const MeshCriteria& criteria, + const FT& iso_value, + Image_word_type, + bool protect_features = false) +{ + typedef CGAL::Null_functor Functor; + Functor image_values_to_subdomain_indices; + + using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; + typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; + typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; + Image_values_to_subdomain_indices transform_fct = + C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); + + initialize_triangulation_from_labeled_image(c3t3, domain, image, criteria, + Image_word_type(), + protect_features, + transform_fct); +} + #endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_LABELED_IMAGE_H From d7bc38f68399cfcae8d42671b2b9c0eeadd84a13 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 12 Feb 2021 14:16:54 +0100 Subject: [PATCH 055/178] Take the translation TX/TY/TZ into account --- .../Mesh_3/initialize_triangulation_from_labeled_image.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index e50d4416d83..67010d9ec7f 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -32,17 +32,23 @@ template struct Get_point { const double vx, vy, vz; + const double tx, ty, tz; Get_point(const CGAL::Image_3* image) : vx(image->vx()) , vy(image->vy()) , vz(image->vz()) + , tx(image->tx()) + , ty(image->ty()) + , tz(image->tz()) {} Point operator()(const std::size_t i, const std::size_t j, const std::size_t k) const { - return Point(double(i) * vx, double(j) * vy, double(k) * vz); + return Point(double(i) * vx + tx, + double(j) * vy + ty, + double(k) * vz + tz); } }; template From b1a86b749ad87e37f7ef17d3ed32d212249e50c8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 12 Feb 2021 14:44:02 +0100 Subject: [PATCH 056/178] Update CMakeLists.txt --- Installation/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 99281d11635..34acf7a3d2e 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -395,10 +395,10 @@ endif() # CGAL-3.9 : 8.0.0 (No way to check the binary compatibility.) # CGAL-4.0 : 9.0.0 (No way to check the binary compatibility.) # CGAL-4.1 : 10.0.0 (No way to check the binary compatibility.) -# CGAL-4.2 : 10.0.1 (Nothing different in CGAL compiled libraries¹.) -# CGAL-4.3 : 10.0.2 (Nothing different in CGAL compiled libraries¹.) -# CGAL-4.4 : 10.0.3 (Nothing different in CGAL compiled libraries¹.) -# CGAL-4.5 : 10.0.4 (Nothing different in CGAL compiled libraries¹.) +# CGAL-4.2 : 10.0.1 (Nothing different in CGAL compiled libraries.) +# CGAL-4.3 : 10.0.2 (Nothing different in CGAL compiled libraries.) +# CGAL-4.4 : 10.0.3 (Nothing different in CGAL compiled libraries.) +# CGAL-4.5 : 10.0.4 (Nothing different in CGAL compiled libraries.) # CGAL-4.6 : 11.0.0 (int->size_t in CGAL_ImageIO) # CGAL-4.7 : 11.0.1 (Nothing different in CGAL compiled libraries.) # CGAL-4.8 : 11.0.2 (Nothing different in CGAL compiled libraries.) @@ -409,7 +409,7 @@ endif() # CGAL-4.14 : 14.0.0 , but only for CGAL_ImageIO (ABI broken in CGAL::Image_3.) # and for CGAL_Qt5 (ABI broken in DemoMainWindow) # CGAL-4.14 : 13.0.3 , for other libraries -# ¹) According to http://upstream-tracker.org/versions/cgal.html + set(CGAL_SONAME_VERSION "13") set(CGAL_SOVERSION "13.0.3") From 8e492aa4f6352eef77891655e0e572f9ec570f1f Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 12 Feb 2021 16:53:45 +0100 Subject: [PATCH 057/178] add initialization by detection of connected components in gray level image --- ...initialize_triangulation_from_gray_image.h | 48 +++++++++++++++++++ ...tialize_triangulation_from_labeled_image.h | 20 ++++---- 2 files changed, 58 insertions(+), 10 deletions(-) create mode 100644 Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h new file mode 100644 index 00000000000..fdab4d66883 --- /dev/null +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h @@ -0,0 +1,48 @@ +// Copyright (c) 2015,2016 GeometryFactory +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau, Jane Tournois + +#ifndef CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H +#define CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H + +#include + +#include +#include + +#include + +template +void initialize_triangulation_from_gray_image(C3T3& c3t3, + const MeshDomain& domain, + const CGAL::Image_3& image, + const MeshCriteria& criteria, + const FT& iso_value, + Image_word_type, + bool protect_features = false) +{ + typedef CGAL::Null_functor Functor; + Functor image_values_to_subdomain_indices; + + using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; + typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; + typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; + Image_values_to_subdomain_indices transform_fct = + C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); + + initialize_triangulation_from_labeled_image(c3t3, domain, image, criteria, + Image_word_type(), + protect_features, + transform_fct); +} + +#endif // CGAL_MESH_3_INITIALIZE_TRIANGULATION_FROM_GRAY_IMAGE_H diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h index 19070a4c5b0..571a4171e5d 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -70,16 +71,16 @@ void init_tr_from_labeled_image_call_init_features(C3T3& c3t3, << " initial points on 1D-features" << std::endl; } - template + typename Image_word_type, + typename TransformOperator = CGAL::Identity > void initialize_triangulation_from_labeled_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - Image_word_type, - bool protect_features = false - ) + const MeshDomain& domain, + const CGAL::Image_3& image, + const MeshCriteria& criteria, + Image_word_type, + bool protect_features = false, + TransformOperator transform = CGAL::Identity()) { typedef typename C3T3::Triangulation Tr; typedef typename Tr::Geom_traits Gt; @@ -117,11 +118,10 @@ void initialize_triangulation_from_labeled_image(C3T3& c3t3, Seeds seeds; Get_point get_point(&image); std::cout << "Searching for connected components..." << std::endl; - CGAL::Identity no_transformation; search_for_connected_components_in_labeled_image(image, std::back_inserter(seeds), CGAL::Emptyset_iterator(), - no_transformation, + transform, get_point, Image_word_type()); std::cout << " " << seeds.size() << " components were found." << std::endl; From 4902b42f54786e5bf5f2d8ef78fdb74b1738e276 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 12 Feb 2021 16:56:33 +0100 Subject: [PATCH 058/178] add example to mesh gray image with custom initialization --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 5 ++ ..._gray_image_with_custom_initialization.cpp | 71 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 2f9ba7d5b27..85cbe82d4d3 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -149,6 +149,11 @@ if(TARGET CGAL::CGAL_ImageIO) target_link_libraries(mesh_3D_image_with_custom_initialization PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( + "mesh_3D_gray_image_with_custom_initialization.cpp") + target_link_libraries(mesh_3D_image_with_custom_initialization + PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen3_support) diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp new file mode 100644 index 00000000000..c51439d5852 --- /dev/null +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp @@ -0,0 +1,71 @@ + +#include + +#include +#include +#include + +#include + +#include +#include +#include +#include + +typedef float Image_word_type; + +// Domain +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Labeled_mesh_domain_3 Mesh_domain; + +// Parallel tag +#ifdef CGAL_CONCURRENT_MESH_3 +typedef CGAL::Parallel_tag Concurrency_tag; +#else +typedef CGAL::Sequential_tag Concurrency_tag; +#endif + +// Triangulation +typedef CGAL::Mesh_triangulation_3::type Tr; +typedef CGAL::Mesh_complex_3_in_triangulation_3 C3t3; + +// Criteria +typedef CGAL::Mesh_criteria_3 Mesh_criteria; + +// To avoid verbose function and named parameters call +using namespace CGAL::parameters; + +int main(int argc, char* argv[]) +{ + const char* fname = (argc > 1) ? argv[1] : "data/skull_2.9.inr"; + /// [Load image] + CGAL::Image_3 image; + if (!image.read(fname)) { + std::cerr << "Error: Cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } + /// [Domain creation] + Mesh_domain domain = + Mesh_domain::create_gray_image_mesh_domain(image, 2.9f, 0.f); + /// [Domain creation] + + /// [Mesh criteria] + Mesh_criteria criteria(facet_angle = 30, facet_size = 6, facet_distance = 2, + cell_radius_edge_ratio = 3, cell_size = 8); + + /// [Meshing] + C3t3 c3t3; + initialize_triangulation_from_gray_image(c3t3, + domain, + image, + criteria, + 2.9f, + Image_word_type(0)); + CGAL::refine_mesh_3(c3t3, domain, criteria); + /// [Meshing] + + /// Output + CGAL::dump_c3t3(c3t3, "out"); + + return 0; +} From 7c9e45206d89ae90b48e678652413bf548f88d71 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 12 Feb 2021 17:20:46 +0100 Subject: [PATCH 059/178] add image_values_to_subdomain_indices parameter --- ...initialize_triangulation_from_gray_image.h | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h index fdab4d66883..1d3a6b7601e 100644 --- a/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h +++ b/Mesh_3/include/CGAL/Mesh_3/initialize_triangulation_from_gray_image.h @@ -21,20 +21,22 @@ #include template + typename FT, + typename Image_word_type, + typename Functor = CGAL::Null_functor> void initialize_triangulation_from_gray_image(C3T3& c3t3, - const MeshDomain& domain, - const CGAL::Image_3& image, - const MeshCriteria& criteria, - const FT& iso_value, - Image_word_type, - bool protect_features = false) + const MeshDomain& domain, + const CGAL::Image_3& image, + const MeshCriteria& criteria, + const FT& iso_value, + Image_word_type, + const Functor image_values_to_subdomain_indices = CGAL::Null_functor(), + bool protect_features = false) { - typedef CGAL::Null_functor Functor; - Functor image_values_to_subdomain_indices; + typedef typename CGAL::Default::Get::type Functor_; using CGAL::Mesh_3::internal::Create_gray_image_values_to_subdomain_indices; - typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; + typedef Create_gray_image_values_to_subdomain_indices C_i_v_t_s_i; typedef typename C_i_v_t_s_i::type Image_values_to_subdomain_indices; Image_values_to_subdomain_indices transform_fct = C_i_v_t_s_i()(image_values_to_subdomain_indices, iso_value); From 2f6a9ff59917f54fd2fbdb1bf920be0ea4c90f49 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 14 Dec 2020 11:35:03 +0100 Subject: [PATCH 060/178] Allow to use CGAL as a submodule of a bigger CMake project The trick is to use - `CGAL_SOURCE_DIR` instead of `CMAKE_SOURCE_DIR`, and - `CGAL_BINARY_DIR` instead of `CMAKE_BINARY_DIR`. See https://cmake.org/cmake/help/latest/variable/PROJECT-NAME_SOURCE_DIR.html https://cmake.org/cmake/help/latest/variable/PROJECT-NAME_BINARY_DIR.html > This can be useful when add_subdirectory() is used to connect several projects. --- CMakeLists.txt | 10 ++--- Installation/CMakeLists.txt | 84 ++++++++++++++++++------------------- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16548a2000f..fc0c013e73b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,14 +12,14 @@ set(CGAL_BRANCH_BUILD ON CACHE INTERNAL "Create CGAL from a Git branch" FORCE) -include(${CMAKE_SOURCE_DIR}/CGALConfigVersion.cmake) -include(${CMAKE_SOURCE_DIR}/Installation/cmake/modules/CGAL_SCM.cmake) -cgal_detect_git(${CMAKE_SOURCE_DIR}) +include(${CMAKE_CURRENT_SOURCE_DIR}/CGALConfigVersion.cmake) +include(${CMAKE_CURRENT_SOURCE_DIR}/Installation/cmake/modules/CGAL_SCM.cmake) +cgal_detect_git(${CMAKE_CURRENT_SOURCE_DIR}) function(CGAL_error_if_detect_in_source_build) # If in a Git repository, forbid in-source builds - get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) - get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) + get_filename_component(srcdir "${CMAKE_CURRENT_SOURCE_DIR}" REALPATH) + get_filename_component(bindir "${CMAKE_CURRENT_BINARY_DIR}" REALPATH) if("${srcdir}" STREQUAL "${bindir}") message( FATAL_ERROR diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index fc18bc69bbb..c141f40b4eb 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -1,8 +1,8 @@ # Top level CMakeLists.txt for CGAL # The name of our project is "CGAL". CMakeLists files in this project can -# refer to the root source directory of the project as ${CMAKE_SOURCE_DIR} or -# ${CMAKE_SOURCE_DIR} and to the root binary directory of the project as -# ${CMAKE_BINARY_DIR} or ${CMAKE_BINARY_DIR}. +# refer to the root source directory of the project as ${CGAL_SOURCE_DIR} or +# ${CGAL_SOURCE_DIR} and to the root binary directory of the project as +# ${CGAL_BINARY_DIR} or ${CGAL_BINARY_DIR}. if(NOT PROJECT_NAME) cmake_minimum_required(VERSION 3.12...3.18) project(CGAL CXX C) @@ -32,24 +32,24 @@ if(CGAL_BRANCH_BUILD) # list packages file( GLOB CGAL_CONFIGURED_PACKAGES - RELATIVE ${CMAKE_SOURCE_DIR} - "${CMAKE_SOURCE_DIR}/*") + RELATIVE ${CGAL_SOURCE_DIR} + "${CGAL_SOURCE_DIR}/*") list(SORT CGAL_CONFIGURED_PACKAGES) list(REMOVE_ITEM CGAL_CONFIGURED_PACKAGES copyright CMakeLists.txt .svn .git) # detect and remove not existing package-directories foreach(package ${CGAL_CONFIGURED_PACKAGES}) - if(NOT IS_DIRECTORY "${CMAKE_SOURCE_DIR}/${package}") + if(NOT IS_DIRECTORY "${CGAL_SOURCE_DIR}/${package}") list(APPEND CGAL_WRONG_PACKAGES ${package}) elseif(NOT EXISTS - "${CMAKE_SOURCE_DIR}/${package}/package_info/${package}/maintainer") + "${CGAL_SOURCE_DIR}/${package}/package_info/${package}/maintainer") list(APPEND CGAL_WRONG_PACKAGES ${package}) endif() endforeach() find_program( CGAL_CREATE_CMAKE_SCRIPT cgal_create_cmake_script HINT - ${CMAKE_SOURCE_DIR}/Scripts/scripts + ${CGAL_SOURCE_DIR}/Scripts/scripts DOC "Script cgal_create_cmake_script, that creates CMakeLists.txt files" NO_DEFAULT_PATH NO_CMAKE_ENVIRONMENT_PATH) @@ -61,20 +61,20 @@ if(CGAL_BRANCH_BUILD) set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_CONFIGURED_PACKAGES}) set(CGAL_CONFIGURED_PACKAGES) foreach(package ${CGAL_CONFIGURED_PACKAGES_NAMES}) - list(APPEND CGAL_CONFIGURED_PACKAGES "${CMAKE_SOURCE_DIR}/${package}") + list(APPEND CGAL_CONFIGURED_PACKAGES "${CGAL_SOURCE_DIR}/${package}") endforeach() set(CGAL_INSTALLATION_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}/Installation" + "${CGAL_SOURCE_DIR}/Installation" CACHE INTERNAL "Directory containing the Installation package") set(CGAL_MAINTENANCE_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}/Maintenance" + "${CGAL_SOURCE_DIR}/Maintenance" CACHE INTERNAL "Directory containing the Maintenance package") set(CGAL_CORE_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}/Core" + "${CGAL_SOURCE_DIR}/Core" CACHE INTERNAL "Directory containing the Core package") set(CGAL_GRAPHICSVIEW_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}/GraphicsView" + "${CGAL_SOURCE_DIR}/GraphicsView" CACHE INTERNAL "Directory containing the GraphicsView package") message( @@ -86,7 +86,7 @@ if(CGAL_BRANCH_BUILD) else(CGAL_BRANCH_BUILD) # get release name - file(TO_CMAKE_PATH ${CMAKE_SOURCE_DIR} CMAKE_SOURCE_CDIR) + file(TO_CMAKE_PATH ${CGAL_SOURCE_DIR} CMAKE_SOURCE_CDIR) string(REGEX REPLACE "^/" "" CMAKE_SOURCE_DDIR ${CMAKE_SOURCE_CDIR}) string(REPLACE "/" ";" CMAKE_SOURCE_PDIR ${CMAKE_SOURCE_DDIR}) list(GET CMAKE_SOURCE_PDIR -1 CGAL_RELEASE_NAME) @@ -95,19 +95,19 @@ else(CGAL_BRANCH_BUILD) set(CGAL_CONFIGURED_PACKAGES_NAMES ${CGAL_RELEASE_NAME}) # list packages - set(CGAL_CONFIGURED_PACKAGES "${CMAKE_SOURCE_DIR}") + set(CGAL_CONFIGURED_PACKAGES "${CGAL_SOURCE_DIR}") set(CGAL_INSTALLATION_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}" + "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Installation package") set(CGAL_MAINTENANCE_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}" + "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Maintenance package") set(CGAL_CORE_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}" + "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Core package") set(CGAL_GRAPHICSVIEW_PACKAGE_DIR - "${CMAKE_SOURCE_DIR}" + "${CGAL_SOURCE_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package") # Enable testing with BUILD_TESTING @@ -120,7 +120,7 @@ endif(CGAL_BRANCH_BUILD) #message(STATUS "Packages found: ${CGAL_CONFIGURED_PACKAGES}") list(SORT CGAL_CONFIGURED_PACKAGES_NAMES) -if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/Documentation") +if(IS_DIRECTORY "${CGAL_SOURCE_DIR}/Documentation") # Rescope CGAL_CONFIGURED_PACKAGES_NAMES # We need this variable in the Doxygen configuration process. Reset it # and change the scope to the parent scope. @@ -141,7 +141,7 @@ if(CGAL_BRANCH_BUILD) # Create version files # - file(REMOVE ${CMAKE_BINARY_DIR}/VERSION) + file(REMOVE ${CGAL_BINARY_DIR}/VERSION) if(CGAL_BUGFIX_VERSION AND CGAL_BUGFIX_VERSION GREATER 0) set(CGAL_CREATED_VERSION_NUM "${CGAL_MAJOR_VERSION}.${CGAL_MINOR_VERSION}.${CGAL_BUGFIX_VERSION}") @@ -160,7 +160,7 @@ if(CGAL_BRANCH_BUILD) "${CGAL_CREATED_VERSION_NUM}-I-${CGAL_BUILD_VERSION}") set(CGAL_VERSION "${CGAL_CREATED_VERSION_NUM}-I-${CGAL_BUILD_VERSION}") - file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${CGAL_CREATED_VERSION_NUM}") + file(WRITE "${CGAL_BINARY_DIR}/VERSION" "${CGAL_CREATED_VERSION_NUM}") message(STATUS "CGAL_VERSION is ${CGAL_CREATED_VERSION}") set(CGAL_FULL_VERSION @@ -196,11 +196,11 @@ if(CGAL_BRANCH_BUILD) message( STATUS "CGAL_CREATED_SVN_REVISION is ${CGAL_CREATED_SVN_REVISION} (dummy)") - file(REMOVE ${CMAKE_BINARY_DIR}/include/CGAL/version.h) + file(REMOVE ${CGAL_BINARY_DIR}/include/CGAL/version.h) string(TIMESTAMP CGAL_CREATED_RELEASE_DATE "%Y%m%d") configure_file( ${CGAL_INSTALLATION_PACKAGE_DIR}/cmake/modules/config/version.h.in - ${CMAKE_BINARY_DIR}/include/CGAL/version.h @ONLY) + ${CGAL_BINARY_DIR}/include/CGAL/version.h @ONLY) # # Duplicate files @@ -265,8 +265,8 @@ if(CGAL_BRANCH_BUILD) else() - if(NOT EXISTS "${CMAKE_SOURCE_DIR}/VERSION" - OR NOT EXISTS "${CMAKE_SOURCE_DIR}/include/CGAL/version.h") + if(NOT EXISTS "${CGAL_SOURCE_DIR}/VERSION" + OR NOT EXISTS "${CGAL_SOURCE_DIR}/include/CGAL/version.h") message( FATAL_ERROR "File VERSION or include/CGAL/version.h are missing, required by release-build." @@ -277,7 +277,7 @@ else() # Read and parse CGAL version number from VERSION file # - file(READ "${CMAKE_SOURCE_DIR}/VERSION" CGAL_VERSION) + file(READ "${CGAL_SOURCE_DIR}/VERSION" CGAL_VERSION) # Comment from Laurent Rineau, 2012/06/28: # file(READ ..) should be replace by file(STRINGS ..), and then we take # the first line. That would avoid parsing errors when the VERSION file @@ -595,7 +595,7 @@ if(CGAL_DISABLE_GMP) unset(CGAL_USE_GMP) unset(CGAL_USE_GMP CACHE) # Nasty trick to make sure is not used when CGAL_DISABLE_GMP is TRUE - file(WRITE "${CMAKE_BINARY_DIR}/include/gmp.h" + file(WRITE "${CGAL_BINARY_DIR}/include/gmp.h" "#error GMP is disabled by the CMake option CGAL_DISABLE_GMP") else() list(APPEND CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES GMP MPFR) @@ -603,7 +603,7 @@ else() # When CMake is run several times, to avoid duplicates list(REMOVE_DUPLICATES CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES) - file(REMOVE "${CMAKE_BINARY_DIR}/include/gmp.h") + file(REMOVE "${CGAL_BINARY_DIR}/include/gmp.h") endif() hide_variable(CGAL_ESSENTIAL_3RD_PARTY_LIBRARIES) @@ -698,7 +698,7 @@ set(CGAL_INSTALL_MAN_DIR message("== Generating build files ==") -set(CGAL_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/include) +set(CGAL_INCLUDE_DIRS ${CGAL_BINARY_DIR}/include) foreach(package ${CGAL_CONFIGURED_PACKAGES}) if(EXISTS ${package}/include) @@ -775,9 +775,9 @@ if(CGAL_BRANCH_BUILD AND CGAL_REPORT_DUPLICATE_FILES) endif() configure_file("${CGAL_MODULES_DIR}/CGALConfig_binary_header_only.cmake.in" - "${CMAKE_BINARY_DIR}/CGALConfig.cmake" @ONLY) + "${CGAL_BINARY_DIR}/CGALConfig.cmake" @ONLY) configure_file("${CGAL_MODULES_DIR}/CGALConfigVersion_binary_header_only.cmake.in" - "${CMAKE_BINARY_DIR}/CGALConfigVersion.cmake" @ONLY) + "${CGAL_BINARY_DIR}/CGALConfigVersion.cmake" @ONLY) #-------------------------------------------------------------------------------------------------- # @@ -803,9 +803,9 @@ foreach(dir ${CGAL_CONFIGURED_PACKAGES}) PATTERN "Qt" EXCLUDE) endif() endforeach() -if(EXISTS ${CMAKE_BINARY_DIR}/include/CGAL) +if(EXISTS ${CGAL_BINARY_DIR}/include/CGAL) install( - DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL + DIRECTORY ${CGAL_BINARY_DIR}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE PATTERN "Qt" EXCLUDE) @@ -840,9 +840,9 @@ install(FILES DESTINATION ${CGAL_INSTALL_CMAKE_DIR}) if(NOT CGAL_INSTALL_CMAKE_DIR STREQUAL "${CGAL_INSTALL_LIB_DIR}/cmake/CGAL") configure_file(${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig-installation-dirs.cmake.in - ${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake) + ${CGAL_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake) install(FILES - ${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake + ${CGAL_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake DESTINATION ${CGAL_INSTALL_CMAKE_DIR}) endif() @@ -900,7 +900,7 @@ macro(add_programs subdir target ON_OFF) endmacro() # This allows programs to locate CGALConfig.cmake -set(CGAL_DIR ${CMAKE_BINARY_DIR}) +set(CGAL_DIR ${CGAL_BINARY_DIR}) if(NOT RUNNING_CGAL_AUTO_TEST) @@ -1107,13 +1107,13 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.") include_directories(SYSTEM ${CGAL_3RD_PARTY_INCLUDE_DIRS}) # Build the doc - set(DOC_DIR "${CMAKE_BINARY_DIR}/build_doc") + set(DOC_DIR "${CGAL_BINARY_DIR}/build_doc") file(MAKE_DIRECTORY "${DOC_DIR}") execute_process( COMMAND "${CMAKE_COMMAND}" -DCGAL_BUILD_THREE_DOC=TRUE -DDOXYGEN_EXECUTABLE=${DOXYGEN_EXECUTABLE} - "${CMAKE_SOURCE_DIR}/Documentation/doc" + "${CGAL_SOURCE_DIR}/Documentation/doc" WORKING_DIRECTORY "${DOC_DIR}") execute_process( COMMAND @@ -1122,7 +1122,7 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.") #Get the list of the documented headers file(GLOB html_files RELATIVE "${DOC_DIR}/doc_output/" "${DOC_DIR}/doc_output/*/*.html") - file(GLOB example_files RELATIVE "${CMAKE_SOURCE_DIR}/" "${CMAKE_SOURCE_DIR}/*/examples/*/*.cpp") + file(GLOB example_files RELATIVE "${CGAL_SOURCE_DIR}/" "${CGAL_SOURCE_DIR}/*/examples/*/*.cpp") list(SORT example_files) find_program(AWK awk) @@ -1139,7 +1139,7 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.") message("listing headers from examples files") foreach(f ${example_files}) - execute_process(COMMAND "${AWK}" "${awk_arguments}" "${CMAKE_SOURCE_DIR}/${f}" + execute_process(COMMAND "${AWK}" "${awk_arguments}" "${CGAL_SOURCE_DIR}/${f}" OUTPUT_VARIABLE tmp_list) if (NOT "${tmp_list}" STREQUAL "") string(REPLACE "\n" ";" tmp_list ${tmp_list}) @@ -1160,7 +1160,7 @@ You must disable CGAL_ENABLE_CHECK_HEADERS.") ## Loop on package and headers set(check_pkg_target_list) #get build dir for removal from deps - get_filename_component(BUILD_DIR ${CMAKE_BINARY_DIR} NAME) + get_filename_component(BUILD_DIR ${CGAL_BINARY_DIR} NAME) foreach(package ${CGAL_CONFIGURED_PACKAGES_NAMES}) if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../${package}/include) set(check_pkg_headers_depends "") From 032ad19677a18b96123950733178cbee07069b6d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 15 Feb 2021 16:27:40 +0100 Subject: [PATCH 061/178] add custom initialization of gray image to user manual and re-organize to have both custom initializations (gray level and segmented) together --- Mesh_3/doc/Mesh_3/Mesh_3.txt | 40 ++++++++++++++----- Mesh_3/doc/Mesh_3/examples.txt | 2 + ..._gray_image_with_custom_initialization.cpp | 2 +- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Mesh_3/doc/Mesh_3/Mesh_3.txt b/Mesh_3/doc/Mesh_3/Mesh_3.txt index 86a2dd81e38..45503259386 100644 --- a/Mesh_3/doc/Mesh_3/Mesh_3.txt +++ b/Mesh_3/doc/Mesh_3/Mesh_3.txt @@ -573,13 +573,6 @@ constructor of the `Mesh_criteria` instance. Cut view of a 3D mesh produced from an implicit domain \cgalFigureEnd -\subsubsection Mesh_33DDomainsGrayImageIsosurfaces 3D Domains Bounded by Isosurfaces in 3D Gray-Level Images - -The following example produces a 3D mesh for a domain whose boundary surface -is the isosurface associated to an isovalue inside the input gray-level -3D image. In the distribution you can also find the example \ref Mesh_3/mesh_3D_gray_vtk_image.cpp which can deal with DICOM files as input. - -\cgalExample{Mesh_3/mesh_3D_gray_image.cpp} \subsection Mesh_3MeshingMultipleDomains Meshing Multiple Domains @@ -682,8 +675,18 @@ This allows to remesh a surface, and is equivalent to the function `make_surface View of a remeshed surface. (Left) input mesh (Right) output mesh. Code from subsection \ref Mesh_3RemeshingPolyhedralSurface generates the file. \cgalFigureEnd -\subsection Mesh_3DomainsFromSegmented3DImages Domains From Segmented 3D Images +\subsection Mesh_3DomainsFrom3DImages Domains From 3D Images +\subsubsection Mesh_33DDomainsGrayImageIsosurfaces 3D Domains Bounded by Isosurfaces in 3D Gray-Level Images + +The following example produces a 3D mesh for a domain whose boundary surface +is the isosurface associated to an isovalue inside the input gray-level +3D image. In the distribution you can also find the example \ref Mesh_3/mesh_3D_gray_vtk_image.cpp which can deal with DICOM files as input. + +\cgalExample{Mesh_3/mesh_3D_gray_image.cpp} + + +\subsubsection Mesh_3DomainsFromSegmented3DImages Domains From Segmented 3D Images \anchor Mesh_3_subsection_examples_3d_image The following code produces a 3D mesh from a 3D image. The image is a segmented medical image in which each @@ -703,7 +706,7 @@ The resulting mesh is shown in \cgalFigureRef{figureliver_3d_image_mesh}. Cut view of a 3D mesh produced from a segmented liver image. Code from subsection \ref Mesh_3_subsection_examples_3d_image generates this file. \cgalFigureEnd -\subsubsection Mesh_3DomainsFromSegmented3DImagesWithCustomInitialization Domains From Segmented 3D Images, with a Custom Initialization +\subsubsection Mesh_3DomainsFrom3DImagesWithCustomInitialization Domains From 3D Images, with a Custom Initialization The example \ref Mesh_3/mesh_3D_image_with_custom_initialization.cpp is a modification of \ref Mesh_3/mesh_3D_image.cpp. The goal of that example is to show how @@ -788,6 +791,25 @@ create a 3D image using the undocumented API of CGAL_ImageIO. The code of the function `%random_labeled_image()` is in the header file \ref Mesh_3/random_labeled_image.h\. + +The example \ref Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp is another +custom initialization example, for meshing of 3D gray-level images. Similarly to +the segmented image example above, the code consists in: + -# the creation of an empty `%c3t3` object, + -# a call to a non-documented function + `initialize_triangulation_from_gray_image()` that inserts points in + the triangulation, + -# then the call to `refine_mesh_3()`. + +\snippet Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp Meshing + +The code of the function `initialize_triangulation_from_gray_image()` is +in the non-documented header \ref +CGAL/Mesh_3/initialize_triangulation_from_gray_image.h\. As it is +undocumented and may be removed or modified at any time, if you wish to +use it then you should copy-paste it to your user code. + + \subsection Mesh_3UsingVariableSizingField Using Variable Sizing Field \subsubsection Mesh_3SizingFieldasanAnalyticalFunction Sizing Field as an Analytical Function diff --git a/Mesh_3/doc/Mesh_3/examples.txt b/Mesh_3/doc/Mesh_3/examples.txt index eaa86c94551..c1c5e4de1a8 100644 --- a/Mesh_3/doc/Mesh_3/examples.txt +++ b/Mesh_3/doc/Mesh_3/examples.txt @@ -1,9 +1,11 @@ /*! \example Mesh_3/implicit_functions.cpp \example Mesh_3/mesh_3D_image.cpp +\example Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp \example Mesh_3/mesh_3D_image_with_features.cpp \example Mesh_3/mesh_3D_image_with_custom_initialization.cpp \example Mesh_3/random_labeled_image.h +\example CGAL/Mesh_3/initialize_triangulation_from_gray_image.h \example CGAL/Mesh_3/initialize_triangulation_from_labeled_image.h \example Mesh_3/mesh_3D_image_variable_size.cpp \example Mesh_3/mesh_hybrid_mesh_domain.cpp diff --git a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp index c51439d5852..533637a3f75 100644 --- a/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp +++ b/Mesh_3/examples/Mesh_3/mesh_3D_gray_image_with_custom_initialization.cpp @@ -59,7 +59,7 @@ int main(int argc, char* argv[]) domain, image, criteria, - 2.9f, + 2.9f,//isolevel Image_word_type(0)); CGAL::refine_mesh_3(c3t3, domain, criteria); /// [Meshing] From 662eab79d0730575ab2ba100a4615f16ad8b3eeb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 17 Feb 2021 10:06:16 +0000 Subject: [PATCH 062/178] More removal of lines as suggested by Laurent --- Installation/CMakeLists.txt | 52 ------------------------------------- 1 file changed, 52 deletions(-) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 34acf7a3d2e..ead29567974 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -368,58 +368,6 @@ if(CGAL_BUILD_VERSION LESS 1000) message(STATUS "CGAL_BUILD_VERSION=${CGAL_BUILD_VERSION}") endif() -# SONAME, SOVERSION -# -# The rule is that each new release or bug fix release should increse the soversion. -# -# SOVERSION is $(SONAME_VERSION).$(SOVERSION_MINOR).$(SOVERSION_RELEASE) -# -# - If the binary interface of libraries do not change from previous release -# (example: most bug fix releases), increase SOVERSION_RELEASE (this third number). -# - If the binary interface is changed, but remains compatible with -# previous release (example: only addition of new functions), then increase -# SOVERSION_MINOR (second number) and set SOVERSION_RELEASE to 0. -# - If the binary interface is changed in an incompatible way to previous -# release, then increase the SONAME_VERSION, and set the two other -# numbers to 0. -# -# SOVERSION history: -# CGAL<=3.5 : (unversionned) -# CGAL-3.5 : 4.0.0 -# CGAL-3.5.1 : 4.0.1 -# CGAL-3.6 : 5.0.0 -# CGAL-3.6.1 : 5.0.0 (should have been 5.0.1) -# CGAL-3.7 : 6.0.0 (certainly: some types have been turned from int to -# std::size_t, which is different on some platforms) -# CGAL-3.8 : 7.0.0 (At least CGAL::Random has changed its member fields.) -# CGAL-3.9 : 8.0.0 (No way to check the binary compatibility.) -# CGAL-4.0 : 9.0.0 (No way to check the binary compatibility.) -# CGAL-4.1 : 10.0.0 (No way to check the binary compatibility.) -# CGAL-4.2 : 10.0.1 (Nothing different in CGAL compiled libraries.) -# CGAL-4.3 : 10.0.2 (Nothing different in CGAL compiled libraries.) -# CGAL-4.4 : 10.0.3 (Nothing different in CGAL compiled libraries.) -# CGAL-4.5 : 10.0.4 (Nothing different in CGAL compiled libraries.) -# CGAL-4.6 : 11.0.0 (int->size_t in CGAL_ImageIO) -# CGAL-4.7 : 11.0.1 (Nothing different in CGAL compiled libraries.) -# CGAL-4.8 : 11.0.2 (Nothing different in CGAL compiled libraries.) -# CGAL-4.9 : 12.0.0 (Change the API/ABI in CGAL_ImageIO, but issue with 4GB images.) -# CGAL-4.10 : 13.0.0 (Change the API/ABI in CGAL_ImageIO.) -# CGAL-4.11 : 13.0.1 (Nothing different in CGAL compiled libraries.) -# CGAL-4.12 : 13.0.2 (Nothing different in CGAL compiled libraries.) -# CGAL-4.14 : 14.0.0 , but only for CGAL_ImageIO (ABI broken in CGAL::Image_3.) -# and for CGAL_Qt5 (ABI broken in DemoMainWindow) -# CGAL-4.14 : 13.0.3 , for other libraries - - -set(CGAL_SONAME_VERSION "13") -set(CGAL_SOVERSION "13.0.3") -set(CGAL_ImageIO_SONAME_VERSION "14") -set(CGAL_ImageIO_SOVERSION "14.0.0") -set(CGAL_Qt5_SONAME_VERSION "14") -set(CGAL_Qt5_SOVERSION "14.0.0") - -message(STATUS "CGAL_SONAME_VERSION=${CGAL_SONAME_VERSION}") -message(STATUS "CGAL_SOVERSION =${CGAL_SOVERSION}") set(CGAL_BUILDING_LIBS TRUE) set(CGAL_VERSION_DIR CGAL-${CGAL_VERSION}) From cc589cdc7f0d68e8d8eadab98fea9591ed3238b7 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 19 Feb 2021 10:18:19 +0100 Subject: [PATCH 063/178] fix example name Co-authored-by: Laurent Rineau --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 85cbe82d4d3..5d17d1a1dbf 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -151,7 +151,7 @@ if(TARGET CGAL::CGAL_ImageIO) create_single_source_cgal_program( "mesh_3D_gray_image_with_custom_initialization.cpp") - target_link_libraries(mesh_3D_image_with_custom_initialization + target_link_libraries(mesh_3D_gray_image_with_custom_initialization PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") From 8264096ee758ae0fbcb15baac683a990f07a09f1 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 23 Feb 2021 08:49:18 +0100 Subject: [PATCH 064/178] Remove TensorFlow support from Classification --- .../doc/Classification/Classification.txt | 35 +- .../doc/Classification/Concepts/Classifier.h | 1 - .../doc/Classification/PackageDescription.txt | 6 - .../doc/Classification/examples.txt | 1 - .../examples/Classification/CMakeLists.txt | 17 - .../example_tensorflow_neural_network.cpp | 140 --- Classification/include/CGAL/Classification.h | 4 - .../TensorFlow/Neural_network_classifier.h | 1119 ----------------- .../doc/Documentation/Third_party.txt | 21 - .../advanced/Configuration_variables.txt | 9 - .../modules/CGAL_TensorFlow_support.cmake | 7 - .../cmake/modules/FindTensorFlow.cmake | 25 - .../modules/list_of_whitelisted_headers.cmake | 1 - 13 files changed, 1 insertion(+), 1385 deletions(-) delete mode 100644 Classification/examples/Classification/example_tensorflow_neural_network.cpp delete mode 100644 Classification/include/CGAL/Classification/TensorFlow/Neural_network_classifier.h delete mode 100644 Installation/cmake/modules/CGAL_TensorFlow_support.cmake delete mode 100644 Installation/cmake/modules/FindTensorFlow.cmake diff --git a/Classification/doc/Classification/Classification.txt b/Classification/doc/Classification/Classification.txt index c1a578a8420..4ec5a7e73c8 100644 --- a/Classification/doc/Classification/Classification.txt +++ b/Classification/doc/Classification/Classification.txt @@ -199,7 +199,7 @@ Example of cluster classification mesh (left: input, middle: clusters computed f %Classification relies on a classifier: this classifier is an object that, from the set of values taken by the features at an input item, computes the probability that an input item belongs to one label or another. A model of the concept `CGAL::Classification::Classifier` must take the index of an input item and store the probability associated to each label in a vector. If a classifier returns the value 1 for a pair of label and input item, it means that this item belongs to this label with certainty; values close to 0 mean that this item is not likely to belong to this label. -\cgal provides four models for this concept, [ETHZ::Random_forest_classifier](@ref CGAL::Classification::ETHZ::Random_forest_classifier), [OpenCV::Random_forest_classifier](@ref CGAL::Classification::OpenCV::Random_forest_classifier), [TensorFlow::Neural_network_classifier](@ref CGAL::Classification::TensorFlow::Neural_network_classifier) and [Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier). +\cgal provides three models for this concept, [ETHZ::Random_forest_classifier](@ref CGAL::Classification::ETHZ::Random_forest_classifier), [OpenCV::Random_forest_classifier](@ref CGAL::Classification::OpenCV::Random_forest_classifier), and [Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier). \note Currently, [ETHZ::Random_forest_classifier](@ref CGAL::Classification::ETHZ::Random_forest_classifier) is the best classifier available in \cgal and we strongly advise users @@ -255,31 +255,6 @@ use this classifier. For more details about the algorithm, please refer to [the official documentation](https://docs.opencv.org/2.4/modules/ml/doc/random_trees.html) of OpenCV. -\subsection Classification_TensorFlow_neural_network TensorFlow Neural Network - -\cgal provides [TensorFlow::Neural_network_classifier](@ref CGAL::Classification::TensorFlow::Neural_network_classifier). - -It uses the C++ API of the \ref thirdpartyTensorFlow library. - -\warning This feature is still experimental: it may not be stable -and is likely to undergo substantial changes in future releases of -\cgal. The API changes will be announced in the release notes. - -The provided interface is a feature-based neural network: a set of -features is used as an input layer followed by a user-specified number -of hidden layers with a user-specified activation function. The output -layer is a softmax layer providing, for each label, the probability -that an input item belongs to it. - -This classifier cannot be set up by hand and requires a ground truth -training set. The training algorithm usually requires a higher number -of inliers than random forest. The quality of the results, so far, is -comparable to random forest. - -An [example](\ref Classification_example_tensorflow_neural_network) shows how to -use this classifier. For more details about the algorithm, please refer -to [the TensorFlow tutorials](https://www.tensorflow.org/tutorials/). - \subsection Classification_sowf Sum of Weighted Features This latest classifier defines the following attributes: @@ -524,14 +499,6 @@ The following example shows how to use the classifier [OpenCV::Random_forest_cla \cgalExample{Classification/example_opencv_random_forest.cpp} -\subsection Classification_example_tensorflow_neural_network TensorFlow Neural Network - -The following example shows how to use the classifier -[TensorFlow::Neural_network_classifier](@ref CGAL::Classification::TensorFlow::Neural_network_classifier) -using an input training set. - -\cgalExample{Classification/example_tensorflow_neural_network.cpp} - \subsection Classification_example_mesh Mesh Classification The following example: diff --git a/Classification/doc/Classification/Concepts/Classifier.h b/Classification/doc/Classification/Concepts/Classifier.h index 5f0059a7519..ca1f3cefc97 100644 --- a/Classification/doc/Classification/Concepts/Classifier.h +++ b/Classification/doc/Classification/Concepts/Classifier.h @@ -15,7 +15,6 @@ Concept describing a classifier used by classification functions (see \cgalHasModel `CGAL::Classification::Sum_of_weighted_features_classifier` \cgalHasModel `CGAL::Classification::ETHZ::Random_forest_classifier` \cgalHasModel `CGAL::Classification::OpenCV::Random_forest_classifier` -\cgalHasModel `CGAL::Classification::TensorFlow::Neural_network_classifier` */ class Classifier diff --git a/Classification/doc/Classification/PackageDescription.txt b/Classification/doc/Classification/PackageDescription.txt index 16c1b565b5e..32736fae273 100644 --- a/Classification/doc/Classification/PackageDescription.txt +++ b/Classification/doc/Classification/PackageDescription.txt @@ -24,11 +24,6 @@ Classifiers that use the ETHZ library. Classifiers that use the \ref thirdpartyOpenCV library. -\defgroup PkgClassificationClassifiersTensorFlow TensorFlow -\ingroup PkgClassificationClassifiers - -Classifiers that use the \ref thirdpartyTensorFlow library. - \defgroup PkgClassificationDataStructures Common Data Structures \ingroup PkgClassificationRef @@ -102,7 +97,6 @@ Data structures specialized to classify clusters. - `CGAL::Classification::ETHZ::Random_forest_classifier` - `CGAL::Classification::OpenCV::Random_forest_classifier` -- `CGAL::Classification::TensorFlow::Neural_network_classifier` - `CGAL::Classification::Sum_of_weighted_features_classifier` \cgalCRPSection{Common Data Structures} diff --git a/Classification/doc/Classification/examples.txt b/Classification/doc/Classification/examples.txt index e456d0bea17..c9a3e7bd478 100644 --- a/Classification/doc/Classification/examples.txt +++ b/Classification/doc/Classification/examples.txt @@ -5,7 +5,6 @@ \example Classification/example_ethz_random_forest.cpp \example Classification/example_deprecated_conversion.cpp \example Classification/example_opencv_random_forest.cpp -\example Classification/example_tensorflow_neural_network.cpp \example Classification/example_mesh_classification.cpp \example Classification/example_cluster_classification.cpp */ diff --git a/Classification/examples/Classification/CMakeLists.txt b/Classification/examples/Classification/CMakeLists.txt index 3d2e6ebfc28..7009bb9fa57 100644 --- a/Classification/examples/Classification/CMakeLists.txt +++ b/Classification/examples/Classification/CMakeLists.txt @@ -46,15 +46,6 @@ if(NOT TARGET CGAL::OpenCV_support) ) endif() -find_package(TensorFlow QUIET) -include(CGAL_TensorFlow_support) -if(NOT TARGET CGAL::TensorFlow_support) - message( - STATUS - "NOTICE: TensorFlow was not found. TensorFlow neural network predicate for classification won't be available." - ) -endif() - find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) include(CGAL_Eigen3_support) if(NOT TARGET CGAL::Eigen3_support) @@ -85,13 +76,6 @@ if (TARGET CGAL::OpenCV_support) PUBLIC CGAL::OpenCV_support) endif() -if(TARGET CGAL::TensorFlow_support) - create_single_source_cgal_program("example_tensorflow_neural_network.cpp") - target_link_libraries(example_opencv_random_forest - PUBLIC CGAL::TensorFlow_support) -endif() - - foreach(target example_classification example_ethz_random_forest @@ -100,7 +84,6 @@ foreach(target example_mesh_classification example_cluster_classification example_opencv_random_forest - example_tensorflow_neural_network gis_tutorial_example example_deprecated_conversion) if(TARGET ${target}) diff --git a/Classification/examples/Classification/example_tensorflow_neural_network.cpp b/Classification/examples/Classification/example_tensorflow_neural_network.cpp deleted file mode 100644 index 27df2c663f5..00000000000 --- a/Classification/examples/Classification/example_tensorflow_neural_network.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#if defined (_MSC_VER) && !defined (_WIN64) -#pragma warning(disable:4244) // boost::number_distance::distance() - // converts 64 to 32 bits integers -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -typedef CGAL::Simple_cartesian Kernel; -typedef Kernel::Point_3 Point; -typedef CGAL::Point_set_3 Point_set; -typedef Kernel::Iso_cuboid_3 Iso_cuboid_3; - -typedef Point_set::Point_map Pmap; -typedef Point_set::Property_map Imap; -typedef Point_set::Property_map UCmap; - -namespace Classification = CGAL::Classification; - -typedef Classification::Label_handle Label_handle; -typedef Classification::Feature_handle Feature_handle; -typedef Classification::Label_set Label_set; -typedef Classification::Feature_set Feature_set; - -typedef Classification::Point_set_feature_generator Feature_generator; - - -int main (int argc, char** argv) -{ - std::string filename = (argc > 1) ? argv[1] : "data/b9_training.ply"; - - std::cerr << "Reading input" << std::endl; - std::ifstream in (filename.c_str(), std::ios::binary); - Point_set pts; - in >> pts; - - Imap label_map; - bool lm_found = false; - std::tie (label_map, lm_found) = pts.property_map ("label"); - if (!lm_found) - { - std::cerr << "Error: \"label\" property not found in input file." << std::endl; - return EXIT_FAILURE; - } - - Feature_set features; - - std::cerr << "Generating features" << std::endl; - CGAL::Real_timer t; - t.start(); - Feature_generator generator (pts, pts.point_map(), - 5); // using 5 scales - - features.begin_parallel_additions(); - generator.generate_point_based_features (features); - features.end_parallel_additions(); - - t.stop(); - std::cerr << "Done in " << t.time() << " second(s)" << std::endl; - - // Add labels - Label_set labels; - Label_handle ground = labels.add ("ground"); - Label_handle vegetation = labels.add ("vegetation"); - Label_handle roof = labels.add ("roof"); - - std::vector label_indices(pts.size(), -1); - - std::cerr << "Using TensorFlow neural network Classifier" << std::endl; - Classification::TensorFlow::Neural_network_classifier<> classifier (labels, features); - - std::cerr << "Training" << std::endl; - t.reset(); - t.start(); - classifier.train (pts.range(ground_truth), - true, // restart from scratch - 100); // 100 iterations - t.stop(); - std::cerr << "Done in " << t.time() << " second(s)" << std::endl; - - t.reset(); - t.start(); - Classification::classify_with_graphcut - (pts, pts.point_map(), labels, classifier, - generator.neighborhood().k_neighbor_query(12), - 0.2f, 1, label_indices); - t.stop(); - - std::cerr << "Classification with graphcut done in " << t.time() << " second(s)" << std::endl; - - std::cerr << "Precision, recall, F1 scores and IoU:" << std::endl; - Classification::Evaluation evaluation (labels, pts.range(ground_truth), label_indices); - - for (Label_handle l : labels) - { - std::cerr << " * " << l->name() << ": " - << evaluation.precision(l) << " ; " - << evaluation.recall(l) << " ; " - << evaluation.f1_score(l) << " ; " - << evaluation.intersection_over_union(l) << std::endl; - } - - std::cerr << "Accuracy = " << evaluation.accuracy() << std::endl - << "Mean F1 score = " << evaluation.mean_f1_score() << std::endl - << "Mean IoU = " << evaluation.mean_intersection_over_union() << std::endl; - - // Color point set according to class - UCmap red = pts.add_property_map("red", 0).first; - UCmap green = pts.add_property_map("green", 0).first; - UCmap blue = pts.add_property_map("blue", 0).first; - - for (std::size_t i = 0; i < label_indices.size(); ++ i) - { - label_map[i] = label_indices[i]; // update label map with computed classification - - Label_handle label = labels[label_indices[i]]; - const CGAL::Color& color = label->color(); - red[i] = color.red(); - green[i] = color.green(); - blue[i] = color.blue(); - } - - // Write result - std::ofstream f ("classification.ply"); - f.precision(18); - f << pts; - - std::cerr << "All done" << std::endl; - - return EXIT_SUCCESS; -} diff --git a/Classification/include/CGAL/Classification.h b/Classification/include/CGAL/Classification.h index e5d761f4651..2b694d1b066 100644 --- a/Classification/include/CGAL/Classification.h +++ b/Classification/include/CGAL/Classification.h @@ -22,10 +22,6 @@ #include #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW -#include -#endif - #include #include #include diff --git a/Classification/include/CGAL/Classification/TensorFlow/Neural_network_classifier.h b/Classification/include/CGAL/Classification/TensorFlow/Neural_network_classifier.h deleted file mode 100644 index c24dba334a3..00000000000 --- a/Classification/include/CGAL/Classification/TensorFlow/Neural_network_classifier.h +++ /dev/null @@ -1,1119 +0,0 @@ -// Copyright (c) 2018 GeometryFactory Sarl (France). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// Author(s) : Simon Giraudot - -#ifndef CGAL_CLASSIFICATION_TENSORFLOW_NEURAL_NETWORK_CLASSIFIER_H -#define CGAL_CLASSIFICATION_TENSORFLOW_NEURAL_NETWORK_CLASSIFIER_H - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#define CGAL_NEURAL_NETWORK_VERSION "0.1" - -namespace CGAL { - -namespace Classification { - -namespace TensorFlow { - -namespace TF = tensorflow; -namespace TFops = tensorflow::ops; - -/*! - \ingroup PkgClassificationClassifiersTensorFlow - - \brief %Classifier based on the TensorFlow version of the neural - network algorithm. - - This class provides an interface to a feature-based neural network: - a set of features is used as an input layer followed by a - user-specified number of hidden layers with a user-specified - activation function. The output layer is a softmax layer providing, - for each label, the probability that an input item belongs to it. - - \warning This feature is still experimental: it may not be stable - and is likely to undergo substantial changes in future releases of - \cgal. The API changes will be announced in the release notes. - - \note This class requires the \ref thirdpartyTensorFlow library. - - \tparam ActivationFunction Chosen activation function for the hidden - layers. `Relu` is used as default. The following functions can be - used (please refer to the documentation of \ref thirdpartyTensorFlow - for more information): - - `tensorflow::ops::Elu` - - `tensorflow::ops::Relu6` - - `tensorflow::ops::Relu` - - `tensorflow::ops::Selu` - - `tensorflow::ops::Sigmoid` - - `tensorflow::ops::Tanh` - - \cgalModels `CGAL::Classification::Classifier` -*/ -template -class Neural_network_classifier -{ - bool m_verbose; - - const Label_set& m_labels; - const Feature_set& m_features; - std::vector m_feature_means; - std::vector m_feature_sd; - - TF::Scope* m_root; - TFops::Placeholder* m_ph_ft; - TFops::Placeholder* m_ph_gt; - - TFops::ReduceMean* m_loss; - - std::vector > m_weights; - std::vector > m_bias; - float m_learning_rate; - std::vector m_layers; - -#define CGAL_CLASSIFICATION_TENSORFLOW_USE_ADAM -#ifdef CGAL_CLASSIFICATION_TENSORFLOW_USE_ADAM - std::vector m_optimizer; -#else - std::vector m_optimizer; -#endif - - TF::ClientSession* m_session; - -public: - - /// \cond SKIP_IN_MANUAL - const Feature_set& features() const { return m_features; } - /// \endcond - - /// \name Constructor - /// @{ - - /*! - \brief instantiates the classifier using the sets of `labels` and `features`. - - */ - Neural_network_classifier (const Label_set& labels, - const Feature_set& features) - : m_verbose (true), m_labels (labels), m_features (features) - , m_root (nullptr), m_ph_ft (nullptr), m_ph_gt (nullptr), m_loss(nullptr), m_session (nullptr) - { } - - /// \cond SKIP_IN_MANUAL - ~Neural_network_classifier () - { - clear(); - } - - bool initialized() const { return (m_root != nullptr); } - - bool& verbose() { return m_verbose; } - - void clear() - { - clear (m_ph_gt); - clear (m_ph_ft); - clear (m_loss); - clear (m_session); - clear (m_root); - m_weights.clear(); - m_bias.clear(); - m_optimizer.clear(); - m_layers.clear(); - } - - template - void clear (T* t) - { - if (t != nullptr) - delete t; - t = nullptr; - } - - void compute_normalization_coefficients (const std::vector& indices) - { -//#define DO_NOT_NORMALIZE_FEATURES -#ifdef DO_NOT_NORMALIZE_FEATURES - m_feature_means.clear(); - m_feature_means.resize (m_features.size(), 0.f); - m_feature_sd.clear(); - m_feature_sd.resize (m_features.size(), 1.f); -#else - m_feature_means.clear(); - m_feature_means.resize (m_features.size(), 0.f); - - for (std::size_t i = 0; i < indices.size(); ++ i) - for (std::size_t f = 0; f < m_features.size(); ++ f) - m_feature_means[f] += m_features[f]->value(indices[i]); - for (std::size_t f = 0; f < m_features.size(); ++ f) - m_feature_means[f] /= indices.size(); - - m_feature_sd.clear(); - m_feature_sd.resize (m_features.size(), 0.f); - - for (std::size_t i = 0; i < indices.size(); ++ i) - for (std::size_t f = 0; f < m_features.size(); ++ f) - m_feature_sd[f] += - (m_features[f]->value(indices[i]) - m_feature_means[f]) * - (m_features[f]->value(indices[i]) - m_feature_means[f]); - for (std::size_t f = 0; f < m_features.size(); ++ f) - { - m_feature_sd[f] = std::sqrt (m_feature_sd[f] / indices.size()); - if (m_feature_sd[f] == 0.f) - m_feature_sd[f] = 1.f; - - if (std::isnan(m_feature_means[f])) - m_feature_means[f] = 0.f; - if (std::isnan(m_feature_sd[f])) - m_feature_sd[f] = 1.f; - - // if (m_verbose) - // std::cerr << "#" << f << ": " << m_features[f]->name() << " = " - // << m_feature_means[f] << " +/- " << m_feature_sd[f] << std::endl; - } -#endif - } - /// \endcond - - /// @} - - /// \name Training - - /// @{ - /*! - \brief runs the training algorithm. - - From the set of provided ground truth, this algorithm constructs a - neural network and applies an Adam optimizer to set up the weights - and bias that produce the most accurate result with respect to - this ground truth. - - \pre At least one ground truth item should be assigned to each - label. - - \param ground_truth vector of label indices. It should contain for - each input item, in the same order as the input set, the index of - the corresponding label in the `Label_set` provided in the - constructor. Input items that do not have a ground truth - information should be given the value `-1`. - - \param restart_from_scratch should be set to `false` if the user - wants to continue adjusting weights and bias based, and set to - `true` if the neural network should be re-created from scratch - (discarding all previous training results). - - \param number_of_iterations number of times the optimizer is - called. - - \param learning_rate describes the rate at which the optimizer - changes the weights and bias. - - \param batch_size size of the random subset of inliers used for - optimizing at each iteration. - - \param hidden_layers vector containing the consecutive sizes - (number of neurons) of the hidden layers of the network. If no - vector is given, the behavior used is the following: 2 hidden - layers are used. The first layer has as many neurons as the number - of features; the second layer has a number of neurons equal to the - average value between the number of features and the number of - labels. - */ - template - void train (const LabelIndexRange& ground_truth, - bool restart_from_scratch = true, - std::size_t number_of_iterations = 5000, - float learning_rate = 0.01, - std::size_t batch_size = 1000, - const std::vector& hidden_layers - = std::vector()) - { - CGAL_precondition (m_labels.is_valid_ground_truth (ground_truth)); - - if (restart_from_scratch) - clear(); - - std::vector > random_indices (m_labels.size()); - - std::vector indices; - std::vector raw_gt; - std::size_t i = 0; - for (const auto& gt_value : ground_truth) - { - int gc = int(gt_value); - if (gc != -1) - { - indices.push_back (i); - raw_gt.push_back (gc); - random_indices[std::size_t(gc)].push_back (indices.size() - 1); - } - ++ i; - } - - if (!initialized()) - { - m_learning_rate = learning_rate; - build_architecture (hidden_layers); - if (m_verbose) std::cerr << "II - NORMALIZING FEATURES" << std::endl; - compute_normalization_coefficients (indices); - } - - if (m_verbose) std::cerr << "III - TRAINING NEURAL NETWORK" << std::endl; - - std::vector operations; - for (std::size_t i = 0; i < m_optimizer.size(); ++ i) - operations.push_back (m_optimizer[i]); - operations.push_back (m_layers.back()); - - std::vector outputs; - - m_weights.clear(); - m_bias.clear(); - // std::ofstream log ("loss.log"); - // log.precision(18); - - for (std::size_t i = 0; i < number_of_iterations; ++ i) - { - std::size_t total_batch_size = 0; - for (std::size_t j = 0; j < random_indices.size(); ++ j) - { - if (random_indices[j].empty()) - continue; - std::size_t local_batch_size = std::min (std::size_t(batch_size / m_labels.size()), - random_indices[j].size()); - random_unique (random_indices[j].begin(), random_indices[j].end(), local_batch_size); - total_batch_size += local_batch_size; - - if (i == 0) - { - if (m_verbose) std::cerr << " * Size of batch for " << m_labels[j]->name() << ": " - << local_batch_size << std::endl; - } - } - - TF::Tensor ft - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(total_batch_size), (long long)(m_features.size())}); - TF::Tensor gt - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(total_batch_size), (long long)(m_labels.size())}); - - float* ft_data = ft.flat().data(); - float* gt_data = gt.flat().data(); - - // Fill input tensors - std::size_t current_i = 0; - for (std::size_t j = 0; j < random_indices.size(); ++ j) - { - if (random_indices[j].empty()) - continue; - std::size_t local_batch_size = std::min (std::size_t(batch_size / m_labels.size()), - random_indices[j].size()); - for (std::size_t k = 0; k < local_batch_size; ++ k) - { - std::size_t idx = indices[random_indices[j][k]]; - int g = raw_gt[random_indices[j][k]]; - - for (std::size_t f = 0; f < m_features.size(); ++ f) - ft_data[current_i * m_features.size() + f] - = (m_features[f]->value(idx) - m_feature_means[f]) / m_feature_sd[f]; - - for (std::size_t l = 0; l < m_labels.size(); ++ l) - if (std::size_t(g) == l) - gt_data[current_i * m_labels.size() + l] = 1.f; - else - gt_data[current_i * m_labels.size() + l] = 0.f; - - ++ current_i; - } - } - - TF_CHECK_OK (m_session->Run ({{*m_ph_ft, ft}, {*m_ph_gt, gt}}, {*m_loss}, &outputs)); - - if ((i+1) % (number_of_iterations / 20) == 0) - { - if (m_verbose) std::cerr << " * Step " << i+1 << "/" << number_of_iterations << ": loss = " - << outputs[0].scalar() << std::endl; - } - if (!std::isfinite(*outputs[0].scalar().data())) - { - if (m_verbose) - std::cerr << "Loss is " << outputs[0].scalar() << ", aborting" << std::endl; - return; - } - - if (i == number_of_iterations - 1) - { - TF_CHECK_OK(m_session->Run({{*m_ph_ft, ft}, {*m_ph_gt, gt}}, operations, &outputs)); - for (std::size_t o = 0; o < outputs.size() - 1; ++ o) - { - std::size_t size = outputs[o].dim_size(0) * outputs[o].dim_size(1); - if (o < outputs.size() / 2) - { - m_weights.push_back (std::vector(size)); - float* weights_data = outputs[o].flat().data(); - std::copy_n (weights_data, size, m_weights.back().begin()); - } - else - { - m_bias.push_back (std::vector(size)); - float* bias_data = outputs[o].flat().data(); - std::copy_n (bias_data, size, m_bias.back().begin()); - } - } - } - else - TF_CHECK_OK(m_session->Run({{*m_ph_ft, ft}, {*m_ph_gt, gt}}, operations, nullptr)); - } - - } - - /// \cond SKIP_IN_MANUAL - void operator() (std::size_t item_index, std::vector& out) const - { - out.resize (m_labels.size(), 0.); - - TF::Tensor ft - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(1), (long long)(m_features.size())}); - - float* ft_data = ft.flat().data(); - - // Fill input tensor - for (std::size_t f = 0; f < m_features.size(); ++ f) - ft_data[f] = (m_features[f]->value(item_index) - m_feature_means[f]) / m_feature_sd[f]; - - std::vector outputs; - TF_CHECK_OK(m_session->Run({{*m_ph_ft, ft}}, {m_layers.back()}, &outputs)); - - float* output_data = outputs[0].flat().data(); - - for (std::size_t i = 0; i < m_labels.size(); ++ i) - out[i] = output_data[i]; - } - - - void operator() (const std::vector& item_indices, - std::vector >& out) const - { - out.resize (item_indices.size(), std::vector(m_labels.size(), 0.)); - - TF::Tensor ft - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(item_indices.size()), (long long)(m_features.size())}); - - float* ft_data = ft.flat().data(); - - // Fill input tensor - for (std::size_t i = 0; i < item_indices.size(); ++ i) - for (std::size_t f = 0; f < m_features.size(); ++ f) - ft_data[i * m_features.size() + f] - = (m_features[f]->value(item_indices[i]) - m_feature_means[f]) / m_feature_sd[f]; - - std::vector outputs; - TF_CHECK_OK(m_session->Run({{*m_ph_ft, ft}}, {m_layers.back()}, &outputs)); - - float* output_data = outputs[0].flat().data(); - - for (std::size_t i = 0; i < item_indices.size(); ++ i) - for (std::size_t l = 0; l < m_labels.size(); ++ l) - out[i][l] = output_data[i * m_labels.size() + l]; - } - /// \endcond - - /// @} - - /// \name Input/Output - /// @{ - - /*! - \brief saves the current configuration in the stream `output`. - - This allows to easily save and recover a specific classification - configuration, that is to say: - - - The statistics of features (mean and standard deviation) - - The number of hiddens layers and their respectives sizes - - The weights and bias of the neurons - - The output file is written in an XML format that is readable by - the `load_configuration()` method. - */ - void save_configuration (std::ostream& output) - { - boost::property_tree::ptree tree; - - { - boost::property_tree::ptree ptr; - ptr.put("classifier_version", CGAL_NEURAL_NETWORK_VERSION); - ptr.put("number_of_features", m_features.size()); - ptr.put("number_of_labels", m_labels.size()); - ptr.put("number_of_hidden_layers", m_layers.size() - 1); - ptr.put("learning_rate", m_learning_rate); - tree.add_child("classification.metadata", ptr); - } - - for (std::size_t i = 0; i < m_features.size(); ++ i) - { - boost::property_tree::ptree ptr; - ptr.put("name", m_features[i]->name()); - ptr.put("mean", m_feature_means[i]); - ptr.put("standard_deviation", m_feature_sd[i]); - tree.add_child("classification.features.feature", ptr); - } - - for (std::size_t i = 0; i < m_labels.size(); ++ i) - { - boost::property_tree::ptree ptr; - ptr.put("name", m_labels[i]->name()); - tree.add_child("classification.labels.label", ptr); - } - - for (std::size_t i = 0; i < m_weights.size(); ++ i) - { - boost::property_tree::ptree ptr; - ptr.put("height", (m_weights[i].size() / m_bias[i].size())); - ptr.put("width", m_bias[i].size()); - - std::ostringstream oss; - oss.precision(std::numeric_limits::digits10 + 2); - for (std::size_t j = 0; j < m_weights[i].size(); ++ j) - { - oss << m_weights[i][j]; - if (j != m_weights[i].size() - 1) - oss << " "; - } - ptr.put("weights", oss.str()); - - oss = std::ostringstream(); - oss.precision(std::numeric_limits::digits10 + 2); - for (std::size_t j = 0; j < m_bias[i].size(); ++ j) - { - oss << m_bias[i][j]; - if (j != m_bias[i].size() - 1) - oss << " "; - } - ptr.put("bias", oss.str()); - - tree.add_child("classification.layers.layer", ptr); - } - - // Write property tree to XML file - boost::property_tree::write_xml(output, tree, -#if BOOST_VERSION >= 105600 - boost::property_tree::xml_writer_make_settings(' ', 3)); -#else - boost::property_tree::xml_writer_make_settings(' ', 3)); -#endif - } - - /*! - \brief loads a configuration from the stream `input`. - - The input file should be in the XML format written by the - `save_configuration()` method. The feature set of the classifier - should contain the exact same features in the exact same order as - the ones present when the file was generated using - `save_configuration()`. - */ - bool load_configuration (std::istream& input, bool verbose = false) - { - clear(); - - bool out = true; - - boost::property_tree::ptree tree; - boost::property_tree::read_xml(input, tree); - - std::string version = tree.get("classification.metadata.classifier_version"); - if (version != CGAL_NEURAL_NETWORK_VERSION) - { - if (verbose) - std::cerr << "Error: CGAL Neural Network version mismatch " << version << "/" << CGAL_NEURAL_NETWORK_VERSION << std::endl; - return false; - } - std::size_t nb_features = std::size_t(tree.get("classification.metadata.number_of_features")); - if (nb_features != m_features.size()) - { - if (verbose) - std::cerr << "Error: number of features mismatch " << nb_features << "/" << m_features.size() << std::endl; - return false; - } - - std::size_t nb_labels = std::size_t(tree.get("classification.metadata.number_of_labels")); - if (nb_labels != m_labels.size()) - { - if (verbose) - std::cerr << "Error: number of labels mismatch " << nb_labels << "/" << m_labels.size() << std::endl; - return false; - } - - std::size_t nb_layers = std::size_t(tree.get("classification.metadata.number_of_hidden_layers")) + 1; - m_learning_rate = tree.get("classification.metadata.learning_rate"); - - std::size_t idx = 0; - for(boost::property_tree::ptree::value_type& v : tree.get_child("classification.features")) - { - std::string name = v.second.get("name"); - - if (name != m_features[idx]->name()) - { - if (verbose) - std::cerr << "Warning: feature mismatch " << name << "/" << m_features[idx]->name() << std::endl; - out = false; - } - - m_feature_means.push_back(v.second.get("mean")); - m_feature_sd.push_back(v.second.get("standard_deviation")); - - ++ idx; - } - - if (idx != nb_features) - { - if (verbose) - std::cerr << "Error: number of features mismatch " << nb_features << "/" << idx << std::endl; - return false; - } - - idx = 0; - for(boost::property_tree::ptree::value_type& v : tree.get_child("classification.labels")) - { - std::string name = v.second.get("name"); - if (name != m_labels[idx]->name()) - { - if (verbose) - std::cerr << "Warning: label mismatch " << name << "/" << m_labels[idx]->name() << std::endl; - out = false; - } - ++ idx; - } - - if (idx != nb_labels) - { - if (verbose) - std::cerr << "Error: number of labels mismatch " << nb_labels << "/" << idx << std::endl; - return false; - } - - idx = 0; - m_weights.resize (nb_layers); - m_bias.resize (nb_layers); - - std::vector hidden_layers; - for(boost::property_tree::ptree::value_type& v : tree.get_child("classification.layers")) - { - if (idx >= nb_layers) - { - if (verbose) - std::cerr << "Error: number of layers mismatch " << nb_layers << "/" << idx << std::endl; - return false; - } - std::size_t height = std::size_t(v.second.get("height")); - std::size_t width = std::size_t(v.second.get("width")); - std::size_t size = height * width; - m_weights[idx].reserve (size); - m_bias[idx].reserve (width); - - std::string weights = v.second.get("weights"); - std::istringstream iss (weights); - float f; - while (iss >> f) - m_weights[idx].push_back (f); - - std::string bias = v.second.get("bias"); - iss = std::istringstream (bias); - while (iss >> f) - m_bias[idx].push_back (f); - - if (idx != nb_layers - 1) - hidden_layers.push_back (width); - - ++ idx; - } - - if (idx != nb_layers) - { - if (verbose) - std::cerr << "Error: number of layers mismatch " << nb_layers << "/" << idx << std::endl; - return false; - } - - build_architecture(hidden_layers); - - return out; - } - -/// @} - -private: - - template - BidiIter random_unique(BidiIter begin, BidiIter end, size_t num_random) { - size_t left = std::distance(begin, end); - while (num_random--) { - BidiIter r = begin; - std::advance(r, rand()%left); - std::swap(*begin, *r); - ++begin; - --left; - } - return begin; - } - - void build_architecture (const std::vector& hidden_layers) - { - m_root = new TF::Scope (TF::Scope::NewRootScope()); - - - if (m_verbose) std::cerr << "I - BUILDING NEURAL NETWORK ARCHITECTURE" << std::endl; - - // Get layers and sizes or init with default values - std::vector hl = hidden_layers; - if (hl.empty()) - { - hl.push_back (m_features.size()); - hl.push_back ((m_features.size() + m_labels.size()) / 2); - } - - if (m_verbose) std::cerr << " 1) Initializing architecture:" << std::endl - << " * Layer 0: " << m_features.size() << " neuron(s) (input features)" << std::endl; - - if (m_verbose) - for (std::size_t i = 0; i < hl.size(); ++ i) - std::cerr << " * Layer " << i+1 << ": " << hl[i] << " neuron(s)" << std::endl; - - if (m_verbose) std::cerr << " * Layer " << hl.size() + 1 << ": " - << m_labels.size() << " neuron(s) (output labels)" << std::endl; - - - - m_ph_ft = new TFops::Placeholder (*m_root, TF::DT_FLOAT); - m_ph_gt = new TFops::Placeholder (*m_root, TF::DT_FLOAT); - - if (m_verbose) std::cerr << " 2) Creating weight matrices and bias" << std::endl; - - // create weight matrices and bias for each layer transition - std::vector weights; - std::vector bias; - std::vector assign_weights; - std::vector assign_bias; - - for (std::size_t i = 0; i <= hl.size(); ++ i) - { - long long size_from = 0; - long long size_to = 0; - if (i == 0) - { - size_from = m_features.size(); - size_to = hl[0]; - } - else if (i == hl.size()) - { - size_from = hl.back(); - size_to = m_labels.size(); - } - else - { - size_from = hl[i-1]; - size_to = hl[i]; - } - - if (m_verbose) std::cerr << " * Weight matrix " << i << " [" << size_from << ";" << size_to << "]" << std::endl; - weights.push_back (TFops::Variable (*m_root, { size_from, size_to }, TF::DT_FLOAT)); - - if (m_weights.empty()) - { - if (boost::is_same::value) // Weights initialized by Xavier method - assign_weights.push_back (TFops::Assign (*m_root, weights.back(), - TFops::Mul (*m_root, TFops::Const(*m_root, - std::sqrt (1.f / (float)(size_from))), - TFops::RandomNormal (*m_root, { size_from, size_to}, TF::DT_FLOAT)))); - else if (boost::is_same::value || - boost::is_same::value) // Weights initialized by He method - assign_weights.push_back (TFops::Assign (*m_root, weights.back(), - TFops::Mul (*m_root, TFops::Const(*m_root, - std::sqrt (2.f / (float)(size_from))), - TFops::RandomNormal (*m_root, { size_from, size_to}, TF::DT_FLOAT)))); - else // Default: weights truncated normal - assign_weights.push_back (TFops::Assign (*m_root, weights.back(), - TFops::TruncatedNormal (*m_root, { size_from, size_to}, TF::DT_FLOAT))); - } - else - { - TF::Tensor init_weight - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(size_from), (long long)(size_to)}); - float* init_weight_data = init_weight.flat().data(); - std::copy_n (m_weights[i].begin(), size_from * size_to, init_weight_data); - - assign_weights.push_back (TFops::Assign (*m_root, weights.back(), init_weight)); - } - - if (m_verbose) std::cerr << " * Bias " << i << " [" << size_to << "]" << std::endl; - bias.push_back (TFops::Variable (*m_root, { (long long)(1), size_to }, TF::DT_FLOAT)); - - TF::Tensor init_bias - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(1), (long long)(size_to)}); - float* init_bias_data = init_bias.flat().data(); - if (m_bias.empty()) - for (std::size_t s = 0; s < size_to; ++ s) - init_bias_data[s] = 0.f; - else - std::copy_n (m_bias[i].begin(), size_to, init_bias_data); - - assign_bias.push_back (TFops::Assign (*m_root, bias.back(), init_bias)); - } - - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - - if (m_verbose) std::cerr << " 3) Creating layers" << std::endl; - - for (std::size_t i = 0; i < weights.size(); ++ i) - { - if (i == 0) - m_layers.push_back (ActivationFunction (*m_root, TFops::Add - (*m_root, TFops::MatMul (*m_root, *m_ph_ft, weights[0]), - bias[0]))); - else if (i == weights.size() - 1) - m_layers.push_back (TFops::Softmax (*m_root, TFops::Add - (*m_root, TFops::MatMul (*m_root, m_layers.back(), weights[i]), - bias[i]))); - else - m_layers.push_back (ActivationFunction (*m_root, TFops::Add - (*m_root, TFops::MatMul (*m_root, m_layers.back(), weights[i]), - bias[i]))); - } - - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - - if (m_verbose) std::cerr << " 4) Setting up loss calculation" << std::endl; - - // loss calculation based on cross-entropy - TFops::Maximum truncated_ypred = TFops::Maximum (*m_root, TFops::Const(*m_root, 0.0001f), m_layers.back()); - TFops::Log log_ypred = TFops::Log (*m_root, truncated_ypred); - TFops::Mul ygt_times_log_ypred = TFops::Mul (*m_root, *m_ph_gt, log_ypred); - TFops::ReduceSum sum_ygt_times_log_ypred = TFops::ReduceSum(*m_root, ygt_times_log_ypred, {1}); - TFops::Mul minus_sum_ygt_times_log_ypred = TFops::Mul (*m_root, TFops::Const(*m_root, -1.f), sum_ygt_times_log_ypred); - - m_loss = new TFops::ReduceMean (*m_root, minus_sum_ygt_times_log_ypred, {0}); - - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - - if (m_verbose) std::cerr << " 5) Setting up gradient descent" << std::endl; - - std::vector weights_and_bias; - for (std::size_t i = 0; i < weights.size(); ++ i) - weights_and_bias.push_back (TF::Output(weights[i])); - for (std::size_t i = 0; i < bias.size(); ++ i) - weights_and_bias.push_back (TF::Output(bias[i])); - - std::vector gradients; - - TF_CHECK_OK(TF::AddSymbolicGradients(*m_root, {*m_loss}, - weights_and_bias, - &gradients)); - - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - - std::vector assigners; - -#ifdef CGAL_CLASSIFICATION_TENSORFLOW_USE_ADAM - for (std::size_t i = 0; i < weights.size(); ++ i) - { - long long size_from = 0; - long long size_to = 0; - if (i == 0) - { - size_from = m_features.size(); - size_to = hl[0]; - } - else if (i == weights.size() - 1) - { - size_from = hl.back(); - size_to = m_labels.size(); - } - else - { - size_from = hl[i-1]; - size_to = hl[i]; - } - - TFops::Variable m (*m_root, { size_from, size_to}, TF::DT_FLOAT); - TF::Tensor init_m - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(size_from), (long long)(size_to)}); - float* init_m_data = init_m.flat().data(); - for (std::size_t s = 0; s < size_from; ++ s) - for (std::size_t ss = 0; ss < size_to; ++ ss) - init_m_data[ss * size_from + s] = 0.f; - assigners.push_back (TFops::Assign (*m_root, m, init_m)); - - TFops::Variable v (*m_root, { size_from, size_to}, TF::DT_FLOAT); - TF::Tensor init_v - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(size_from), (long long)(size_to)}); - float* init_v_data = init_v.flat().data(); - for (std::size_t s = 0; s < size_from; ++ s) - for (std::size_t ss = 0; ss < size_to; ++ ss) - init_v_data[ss * size_from + s] = 0.f; - assigners.push_back (TFops::Assign (*m_root, v, init_v)); - - m_optimizer.push_back (TFops::ApplyAdam - (*m_root, - weights[i], - m, - v, - TFops::Cast(*m_root, 0.9, TF::DT_FLOAT), - TFops::Cast(*m_root, 0.999, TF::DT_FLOAT), - TFops::Cast(*m_root, m_learning_rate, TF::DT_FLOAT), - TFops::Cast(*m_root, 0.9, TF::DT_FLOAT), - TFops::Cast(*m_root, 0.999, TF::DT_FLOAT), - TFops::Cast(*m_root, 1e-8, TF::DT_FLOAT), - {gradients[i]})); - } - - for (std::size_t i = 0; i < bias.size(); ++ i) - { - long long size_from = 0; - long long size_to = 0; - if (i == 0) - size_to = hl[0]; - else if (i == bias.size() - 1) - size_to = m_labels.size(); - else - size_to = hl[i]; - - TFops::Variable m (*m_root, { 1, size_to}, TF::DT_FLOAT); - TF::Tensor init_m - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(1), (long long)(size_to)}); - float* init_m_data = init_m.flat().data(); - for (std::size_t s = 0; s < size_to; ++ s) - init_m_data[s] = 0.f; - assigners.push_back (TFops::Assign (*m_root, m, init_m)); - - TFops::Variable v (*m_root, { 1, size_to}, TF::DT_FLOAT); - TF::Tensor init_v - (TF::DataTypeToEnum::v(), - TF::TensorShape {(long long)(1), (long long)(size_to)}); - float* init_v_data = init_v.flat().data(); - for (std::size_t s = 0; s < size_to; ++ s) - init_v_data[s] = 0.f; - assigners.push_back (TFops::Assign (*m_root, v, init_v)); - - m_optimizer.push_back (TFops::ApplyAdam - (*m_root, - bias[i], - m, - v, - TFops::Cast(*m_root, 0.9, TF::DT_FLOAT), - TFops::Cast(*m_root, 0.999, TF::DT_FLOAT), - TFops::Cast(*m_root, m_learning_rate, TF::DT_FLOAT), - TFops::Cast(*m_root, 0.9, TF::DT_FLOAT), - TFops::Cast(*m_root, 0.999, TF::DT_FLOAT), - TFops::Cast(*m_root, 1e-8, TF::DT_FLOAT), - {gradients[weights.size() + i]})); - } - -#else - for (std::size_t i = 0; i < weights.size(); ++ i) - m_optimizer.push_back (TFops::ApplyGradientDescent - (*m_root, weights[i], - TFops::Cast(*m_root, m_learning_rate, TF::DT_FLOAT), {gradients[i]})); - for (std::size_t i = 0; i < bias.size(); ++ i) - m_optimizer.push_back (TFops::ApplyGradientDescent - (*m_root, bias[i], - TFops::Cast(*m_root, m_learning_rate, TF::DT_FLOAT), {gradients[weights.size() + i]})); -#endif - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - - if (m_verbose) std::cerr << " 6) Starting session" << std::endl; - - TF::SessionOptions options = TF::SessionOptions(); - - options.config.mutable_gpu_options()->set_allow_growth(true); - options.config.mutable_gpu_options()->set_per_process_gpu_memory_fraction(0.8); - options.config.mutable_gpu_options()->set_force_gpu_compatible(true); - - m_session = new TF::ClientSession (*m_root, options); - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - - std::vector outputs; - - for (std::size_t i = 0; i < assign_weights.size(); ++ i) - assigners.push_back (TF::Output(assign_weights[i])); - for (std::size_t i = 0; i < assign_bias.size(); ++ i) - assigners.push_back (TF::Output(assign_bias[i])); - TF_CHECK_OK (m_session->Run(assigners, nullptr)); - - if (!m_root->status().ok()) - { - if (m_verbose) std::cerr << "Error: " << m_root->status().ToString() << std::endl; - return; - } - } -}; - - -/// \cond SKIP_IN_MANUAL -#ifdef CGAL_CLASSIFICATION_TENSORFLOW_ENABLE_GPU_SPECIALIZATION -// Specialization to use GPU parallelization -template -void classify (const ItemRange& input, - const Label_set& labels, - const TensorFlow::Neural_network_classifier& classifier, - LabelIndexRange& output, - ProbabilitiesRanges& probabilities) -{ - std::cerr << "Classify with TensorFlow classifier" << std::endl; - - output.resize(input.size()); - probabilities.resize (labels.size()); - for (std::size_t i = 0; i < probabilities.size(); ++ i) - probabilities[i].resize (input.size()); - - const std::size_t mem_allocated = sizeof(float) * input.size() * (labels.size() + classifier.features().size()); - const std::size_t size_max = 512 * 1024 * 1024; - const std::size_t nb_subdivisions = (mem_allocated / size_max) + 1; - std::cerr << nb_subdivisions << " subdivision(s) for GPU processing" << std::endl; - - std::size_t idx = 0; - for (std::size_t n = 0; n < nb_subdivisions; ++ n) - { - std::vector indices; - indices.reserve (input.size() / nb_subdivisions); - for (std::size_t i = 0; i < input.size() / nb_subdivisions && idx < input.size(); ++ i) - indices.push_back(idx ++); - - std::vector > values; - classifier (indices, values); - for(std::size_t i = 0; i < indices.size(); ++ i) - { - std::size_t nb_class_best = 0; - float val_class_best = 0.f; - - for (std::size_t j = 0; j < labels.size(); ++ j) - { - probabilities[j][indices[i]] = values[i][j]; - - if(val_class_best < values[i][j]) - { - val_class_best = values[i][j]; - nb_class_best = j; - } - } - - output[indices[i]] = nb_class_best; - } - } -} - -// Specialization to use GPU parallelization -template -void classify (const ItemRange& input, - const Label_set& labels, - const TensorFlow::Neural_network_classifier& classifier, - LabelIndexRange& output) -{ - std::cerr << "Classify with TensorFlow classifier" << std::endl; - - output.resize(input.size()); - - const std::size_t mem_allocated = sizeof(float) * input.size() * (labels.size() + classifier.features().size()); - const std::size_t size_max = 512 * 1024 * 1024; - const std::size_t nb_subdivisions = (mem_allocated / size_max) + 1; - std::cerr << nb_subdivisions << " subdivision(s) for GPU processing" << std::endl; - - std::size_t idx = 0; - for (std::size_t n = 0; n < nb_subdivisions; ++ n) - { - std::vector indices; - indices.reserve (input.size() / nb_subdivisions); - for (std::size_t i = 0; i < input.size() / nb_subdivisions && idx < input.size(); ++ i) - indices.push_back(idx ++); - - std::vector > values; - classifier (indices, values); - - for(std::size_t i = 0; i < indices.size(); ++ i) - { - std::size_t nb_class_best = 0; - float val_class_best = 0.f; - - for (std::size_t j = 0; j < labels.size(); ++ j) - { - if(val_class_best < values[i][j]) - { - val_class_best = values[i][j]; - nb_class_best = j; - } - } - - output[indices[i]] = nb_class_best; - } - } -} -#endif -/// \endcond - -} - -} - -} - -#endif // CGAL_CLASSIFICATION_TENSORFLOW_NEURAL_NETWORK_CLASSIFIER_H diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index 57422452984..af301e37d20 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -256,27 +256,6 @@ executables should be linked with the CMake imported target The \sc{OpenCV} web site is `https://opencv.org/`. -\subsection thirdpartyTensorFlow TensorFlow - -\sc{TensorFlow} is a library designed for machine learning and deep learning. - -In \cgal, the C++ API of \sc{TensorFlow} is used by the \ref -PkgClassification package for neural network. The C++ API can be -compiled using CMake: it is distributed as part of the official -package and is located in `tensorflow/contrib/cmake`. Be sure to -enable and compile the following targets: - -- `tensorflow_BUILD_ALL_KERNELS` -- `tensorflow_BUILD_PYTHON_BINDINGS` -- `tensorflow_BUILD_SHARED_LIB`. - -In order to use \sc{TensorFlow} in \cgal programs, the executables -should be linked with the CMake imported target -`CGAL::TensorFlow_support` provided in -`CGAL_TensorFlow_support.cmake`. - -The \sc{TensorFlow} web site is `https://www.tensorflow.org/`. - \subsection thirdpartyMETIS METIS Version 5.1 or later diff --git a/Documentation/doc/Documentation/advanced/Configuration_variables.txt b/Documentation/doc/Documentation/advanced/Configuration_variables.txt index 2a880f1e488..b8e2e16bb83 100644 --- a/Documentation/doc/Documentation/advanced/Configuration_variables.txt +++ b/Documentation/doc/Documentation/advanced/Configuration_variables.txt @@ -354,15 +354,6 @@ If LASLIB is not automatically found, the following variables must be set: The environment variable `OPENCV_DIR` should be set to the directory containing the file `OpenCVConfig.cmake` provided by OpenCV. -\subsection installation_TensorFlow TensorFlow library - -If TensorFlow is not automatically found, the following variables must be set: - -| Variable | Description | Type | -| :- | :- | :- | -| `TensorFlow_INCLUDE_DIR` | Directory containing the directories `tensorflow/core`, `tensorflow/cc`, etc. | CMake | -| `TensorFlow_LIBRARY` | Full pathname of the compiled TensorFlow C++ library | CMake | - \subsection installation_SCIP SCIP library The environment variable `SCIP_DIR` should be set to the directory diff --git a/Installation/cmake/modules/CGAL_TensorFlow_support.cmake b/Installation/cmake/modules/CGAL_TensorFlow_support.cmake deleted file mode 100644 index 2a910c1257e..00000000000 --- a/Installation/cmake/modules/CGAL_TensorFlow_support.cmake +++ /dev/null @@ -1,7 +0,0 @@ -if(TensorFlow_FOUND AND NOT TARGET CGAL::TensorFlow_support) - add_library(CGAL::TensorFlow_support INTERFACE IMPORTED) - set_target_properties(CGAL::TensorFlow_support PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_TENSORFLOW" - INTERFACE_INCLUDE_DIRECTORIES "${TensorFlow_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${TensorFlow_LIBRARY}") -endif() diff --git a/Installation/cmake/modules/FindTensorFlow.cmake b/Installation/cmake/modules/FindTensorFlow.cmake deleted file mode 100644 index 2d63a0ea237..00000000000 --- a/Installation/cmake/modules/FindTensorFlow.cmake +++ /dev/null @@ -1,25 +0,0 @@ -include(FindPackageHandleStandardArgs) - -unset(TENSORFLOW_FOUND) - -find_path(TensorFlow_INCLUDE_DIR - NAMES - tensorflow/core - tensorflow/cc - third_party - HINTS - /usr/include/ - /usr/local/include/) - -find_library(TensorFlow_LIBRARY NAMES tensorflow_all - HINTS - /usr/lib - /usr/local/lib) - -find_package_handle_standard_args(TensorFlow DEFAULT_MSG TensorFlow_INCLUDE_DIR TensorFlow_LIBRARY) - -if(TENSORFLOW_FOUND) - set(TensorFlow_LIBRARIES ${TensorFlow_LIBRARY}) - set(TensorFlow_INCLUDE_DIRS ${TensorFlow_INCLUDE_DIR}) -endif() - diff --git a/Installation/cmake/modules/list_of_whitelisted_headers.cmake b/Installation/cmake/modules/list_of_whitelisted_headers.cmake index cf653a08abf..5aa71d9560b 100644 --- a/Installation/cmake/modules/list_of_whitelisted_headers.cmake +++ b/Installation/cmake/modules/list_of_whitelisted_headers.cmake @@ -1,7 +1,6 @@ set(list_of_whitelisted_headers_txt [=[ CGAL/SCIP_mixed_integer_program_traits.h CGAL/GLPK_mixed_integer_program_traits.h - CGAL/Classification/TensorFlow/Neural_network_classifier.h CGAL/Linear_cell_complex_constructors.h CGAL/CGAL_Ipelet_base.h CGAL/IO/read_las_points.h From 68a4aa3947f305fbb3e5337c3e94152b2823f967 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 23 Feb 2021 09:17:44 +0100 Subject: [PATCH 065/178] Remove TensorFlow from plugin --- .../Plugins/Classification/CMakeLists.txt | 19 ----- .../Classification/Classification_plugin.cpp | 39 ----------- .../Classification/Cluster_classification.cpp | 70 ------------------- .../Classification/Item_classification_base.h | 46 +----------- .../Point_set_item_classification.cpp | 70 ------------------- .../Surface_mesh_item_classification.cpp | 70 ------------------- 6 files changed, 2 insertions(+), 312 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt index 04aff587cb9..7310bbee3b6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/CMakeLists.txt @@ -26,21 +26,6 @@ if(TARGET CGAL::Eigen3_support) ) endif() - find_package(TensorFlow QUIET) - set_package_properties( - TensorFlow PROPERTIES - DESCRIPTION "A library for machine learning." - PURPOSE - "Enables the Neural Network predicate for the classification plugin.") - - include(CGAL_TensorFlow_support) - if(NOT TARGET CGAL::TensorFlow_support) - message( - STATUS - "NOTICE: TensorFlow not found, Neural Network predicate for classification won't be available." - ) - endif() - qt5_wrap_ui(classificationUI_FILES Classification_widget.ui Classification_advanced_widget.ui) polyhedron_demo_plugin( @@ -72,10 +57,6 @@ if(TARGET CGAL::Eigen3_support) target_link_libraries(classification_plugin PUBLIC CGAL::OpenCV_support) endif() - if(TARGET CGAL::TensorFlow_support) - target_link_libraries(classification_plugin PUBLIC CGAL::TensorFlow_support) - endif() - if(TARGET CGAL::TBB_support) target_link_libraries(classification_plugin PUBLIC CGAL::TBB_support) endif() diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp index 209ced92bfe..2d410ceb0d4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Classification_plugin.cpp @@ -542,8 +542,6 @@ public Q_SLOTS: { if (classifier->text() == QString(CGAL_CLASSIFICATION_ETHZ_ID)) return CGAL_CLASSIFICATION_ETHZ_NUMBER; - if (classifier->text() == QString(CGAL_CLASSIFICATION_TENSORFLOW_ID)) - return CGAL_CLASSIFICATION_TENSORFLOW_NUMBER; if (classifier->text() == QString(CGAL_CLASSIFICATION_OPENCV_ID)) return CGAL_CLASSIFICATION_OPENCV_NUMBER; if (classifier->text() == QString(CGAL_CLASSIFICATION_SOWF_ID)) @@ -667,13 +665,6 @@ public Q_SLOTS: .arg(CV_MAJOR_VERSION) .arg(CV_MINOR_VERSION)); #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) // Neural Network (TensorFlow) - filename = QFileDialog::getSaveFileName(mw, - tr("Save classification configuration"), - tr("%1 (CGAL Neural Network config).xml").arg(classif->item()->name()), - "CGAL TensorFlow Neural Network classification configuration (*.xml);;"); -#endif if (filename == QString()) return; @@ -725,13 +716,6 @@ public Q_SLOTS: .arg(CV_MAJOR_VERSION) .arg(CV_MINOR_VERSION)); #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) // Neural Network (TensorFlow) - filename = QFileDialog::getOpenFileName(mw, - tr("Open CGAL Neural Network classification configuration"), - ".", - tr("CGAL Neural Network classification configuration (*.xml);;All Files (*)")); -#endif if (filename == QString()) return; @@ -1299,10 +1283,6 @@ public Q_SLOTS: QRadioButton* sowf = dialog.add (CGAL_CLASSIFICATION_SOWF_ID); -#ifdef CGAL_LINKED_WITH_TENSORFLOW - QRadioButton* tensorflow = dialog.add (CGAL_CLASSIFICATION_TENSORFLOW_ID); -#endif - #ifdef CGAL_LINKED_WITH_OPENCV QRadioButton* opencv = dialog.add (CGAL_CLASSIFICATION_OPENCV_ID); #endif @@ -1314,10 +1294,6 @@ public Q_SLOTS: classifier->setText(CGAL_CLASSIFICATION_ETHZ_ID); else if (sowf->isChecked()) classifier->setText(CGAL_CLASSIFICATION_SOWF_ID); -#ifdef CGAL_LINKED_WITH_TENSORFLOW - else if (tensorflow->isChecked()) - classifier->setText(CGAL_CLASSIFICATION_TENSORFLOW_ID); -#endif #ifdef CGAL_LINKED_WITH_OPENCV else if (opencv->isChecked()) classifier->setText(CGAL_CLASSIFICATION_OPENCV_ID); @@ -1361,21 +1337,6 @@ public Q_SLOTS: depth->setRange (1, 9999); depth->setValue (20); } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) // Neural Network (TensorFlow) - { - QSpinBox* trials = dialog.add ("Number of trials: ", "trials"); - trials->setRange (1, 99999); - trials->setValue (500); - DoubleEdit* rate = dialog.add ("Learning rate: ", "learning_rate"); - rate->setRange (0.00001, 10000.0); - rate->setValue (0.001); - QSpinBox* batch = dialog.add ("Batch size: ", "batch_size"); - batch->setRange (1, 2000000000); - batch->setValue (1000); - dialog.add ("Hidden layer size(s): ", "hidden_layers"); - QCheckBox* restart = dialog.add ("Restart from scratch: ", "restart"); - restart->setChecked (false); - } if (dialog.exec() != QDialog::Accepted) return; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp index cadc596ced0..f4456c791a4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Cluster_classification.cpp @@ -230,9 +230,6 @@ Cluster_classification::Cluster_classification(Scene_points_with_normal_item* po #ifdef CGAL_LINKED_WITH_OPENCV m_random_forest = NULL; #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - m_neural_network = NULL; -#endif // Compute neighborhood #if 0 @@ -288,10 +285,6 @@ Cluster_classification::~Cluster_classification() #ifdef CGAL_LINKED_WITH_OPENCV if (m_random_forest != NULL) delete m_random_forest; -#endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - delete m_neural_network; #endif if (m_points != NULL) { @@ -724,13 +717,6 @@ void Cluster_classification::compute_features (std::size_t nb_scales, float voxe m_random_forest = NULL; } #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - { - delete m_neural_network; - m_neural_network = NULL; - } -#endif std::cerr << "Features = " << m_features.size() << std::endl; } @@ -871,51 +857,6 @@ void Cluster_classification::train(int classifier, const QMultipleInputDialog& d indices, m_label_probabilities); #endif } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - { - if (m_neural_network->initialized()) - { - if (dialog.get("restart")->isChecked()) - { - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); - } - } - else - { - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); - } - } - else - m_neural_network = new Neural_network (m_labels, m_features); - - std::vector hidden_layers; - - std::string hl_input = dialog.get("hidden_layers")->text().toStdString(); - if (hl_input != "") - { - std::istringstream iss(hl_input); - int s; - while (iss >> s) - hidden_layers.push_back (std::size_t(s)); - } - - m_neural_network->train (training, - dialog.get("restart")->isChecked(), - dialog.get("trials")->value(), - dialog.get("learning_rate")->value(), - dialog.get("batch_size")->value(), - hidden_layers); - - CGAL::Classification::classify (m_clusters, - m_labels, *m_neural_network, - indices, m_label_probabilities); -#endif - } for (std::size_t i = 0; i < m_clusters.size(); ++ i) m_clusters[i].label() = indices[i]; @@ -957,17 +898,6 @@ bool Cluster_classification::run (int method, int classifier, run (method, *m_random_forest, subdivisions, smoothing); #endif } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network == NULL) - { - std::cerr << "Error: TensorFlow Neural Network must be trained or have a configuration loaded first" << std::endl; - return false; - } - run (method, *m_neural_network, subdivisions, smoothing); -#endif - } return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h b/Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h index 25fe070004d..876d73a94a4 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Item_classification_base.h @@ -15,10 +15,6 @@ #include #include -#ifdef CGAL_LINKED_WITH_TENSORFLOW -# include -#endif - #ifdef CGAL_LINKED_WITH_OPENCV # include #endif @@ -26,14 +22,11 @@ #define CGAL_CLASSIFICATION_ETHZ_ID "Random Forest (ETHZ)" #define CGAL_CLASSIFICATION_ETHZ_NUMBER 0 -#define CGAL_CLASSIFICATION_TENSORFLOW_ID "Neural Network (TensorFlow)" -#define CGAL_CLASSIFICATION_TENSORFLOW_NUMBER 1 - #define CGAL_CLASSIFICATION_OPENCV_ID "Random Forest (OpenCV)" -#define CGAL_CLASSIFICATION_OPENCV_NUMBER 2 +#define CGAL_CLASSIFICATION_OPENCV_NUMBER 1 #define CGAL_CLASSIFICATION_SOWF_ID "Sum of Weighted Features" -#define CGAL_CLASSIFICATION_SOWF_NUMBER 3 +#define CGAL_CLASSIFICATION_SOWF_NUMBER 2 class Item_classification_base @@ -49,9 +42,6 @@ public: #ifdef CGAL_LINKED_WITH_OPENCV typedef CGAL::Classification::OpenCV::Random_forest_classifier Random_forest; #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - typedef CGAL::Classification::TensorFlow::Neural_network_classifier<> Neural_network; -#endif public: @@ -113,11 +103,6 @@ public: m_random_forest = new Random_forest (m_labels, m_features); #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); -#endif - return label_qcolor (m_labels[m_labels.size() - 1]); } virtual void remove_label (std::size_t position) @@ -135,10 +120,6 @@ public: m_random_forest = new Random_forest (m_labels, m_features); #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); -#endif } virtual void clear_labels () @@ -156,10 +137,6 @@ public: m_random_forest = new Random_forest (m_labels, m_features); #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); -#endif } std::size_t number_of_labels() const { return m_labels.size(); } Label_handle label(std::size_t i) { return m_labels[i]; } @@ -206,13 +183,6 @@ public: { #ifdef CGAL_LINKED_WITH_OPENCV m_random_forest->save_configuration (filename); -#endif - } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - std::ofstream f (filename); - m_neural_network->save_configuration (f); #endif } } @@ -247,15 +217,6 @@ public: { #ifdef CGAL_LINKED_WITH_OPENCV m_random_forest->load_configuration (filename); -#endif - } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network == NULL) - m_neural_network = new Neural_network (m_labels, m_features); - std::ifstream f (filename); - m_neural_network->load_configuration (f, true); #endif } } @@ -283,9 +244,6 @@ protected: #ifdef CGAL_LINKED_WITH_OPENCV Random_forest* m_random_forest; #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - Neural_network* m_neural_network; -#endif }; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp index 6b0ef75dbfc..7fed79d5f35 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Point_set_item_classification.cpp @@ -217,9 +217,6 @@ Point_set_item_classification::Point_set_item_classification(Scene_points_with_n #ifdef CGAL_LINKED_WITH_OPENCV m_random_forest = NULL; #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - m_neural_network = NULL; -#endif } @@ -232,10 +229,6 @@ Point_set_item_classification::~Point_set_item_classification() #ifdef CGAL_LINKED_WITH_OPENCV if (m_random_forest != NULL) delete m_random_forest; -#endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - delete m_neural_network; #endif if (m_generator != NULL) delete m_generator; @@ -578,13 +571,6 @@ void Point_set_item_classification::compute_features (std::size_t nb_scales, flo m_random_forest = NULL; } #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - { - delete m_neural_network; - m_neural_network = NULL; - } -#endif t.stop(); std::cerr << m_features.size() << " feature(s) computed in " << t.time() << " second(s)" << std::endl; @@ -766,51 +752,6 @@ void Point_set_item_classification::train(int classifier, const QMultipleInputDi indices, m_label_probabilities); #endif } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - { - if (m_neural_network->initialized()) - { - if (dialog.get("restart")->isChecked()) - { - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); - } - } - else - { - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); - } - } - else - m_neural_network = new Neural_network (m_labels, m_features); - - std::vector hidden_layers; - - std::string hl_input = dialog.get("hidden_layers")->text().toStdString(); - if (hl_input != "") - { - std::istringstream iss(hl_input); - int s; - while (iss >> s) - hidden_layers.push_back (std::size_t(s)); - } - - m_neural_network->train (training, - dialog.get("restart")->isChecked(), - dialog.get("trials")->value(), - dialog.get("learning_rate")->value(), - dialog.get("batch_size")->value(), - hidden_layers); - - CGAL::Classification::classify (*(m_points->point_set()), - m_labels, *m_neural_network, - indices, m_label_probabilities); -#endif - } for (Point_set::const_iterator it = m_points->point_set()->begin(); it != m_points->point_set()->first_selected(); ++ it) @@ -853,17 +794,6 @@ bool Point_set_item_classification::run (int method, int classifier, run (method, *m_random_forest, subdivisions, smoothing); #endif } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network == NULL) - { - std::cerr << "Error: TensorFlow Neural Network must be trained or have a configuration loaded first" << std::endl; - return false; - } - run (method, *m_neural_network, subdivisions, smoothing); -#endif - } return true; } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp index a8e28ab15fb..376d767c1e9 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Classification/Surface_mesh_item_classification.cpp @@ -34,9 +34,6 @@ Surface_mesh_item_classification::Surface_mesh_item_classification(Scene_surface #ifdef CGAL_LINKED_WITH_OPENCV m_random_forest = NULL; #endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - m_neural_network = NULL; -#endif } @@ -49,10 +46,6 @@ Surface_mesh_item_classification::~Surface_mesh_item_classification() #ifdef CGAL_LINKED_WITH_OPENCV if (m_random_forest != NULL) delete m_random_forest; -#endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - delete m_neural_network; #endif if (m_generator != NULL) delete m_generator; @@ -248,13 +241,6 @@ void Surface_mesh_item_classification::compute_features (std::size_t nb_scales, delete m_random_forest; m_random_forest = NULL; } -#endif -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - { - delete m_neural_network; - m_neural_network = NULL; - } #endif std::cerr << "Features = " << m_features.size() << std::endl; } @@ -327,51 +313,6 @@ void Surface_mesh_item_classification::train (int classifier, const QMultipleInp indices, m_label_probabilities); #endif } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network != NULL) - { - if (m_neural_network->initialized()) - { - if (dialog.get("restart")->isChecked()) - { - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); - } - } - else - { - delete m_neural_network; - m_neural_network = new Neural_network (m_labels, m_features); - } - } - else - m_neural_network = new Neural_network (m_labels, m_features); - - std::vector hidden_layers; - - std::string hl_input = dialog.get("hidden_layers")->text().toStdString(); - if (hl_input != "") - { - std::istringstream iss(hl_input); - int s; - while (iss >> s) - hidden_layers.push_back (std::size_t(s)); - } - - m_neural_network->train (training, - dialog.get("restart")->isChecked(), - dialog.get("trials")->value(), - dialog.get("learning_rate")->value(), - dialog.get("batch_size")->value(), - hidden_layers); - - CGAL::Classification::classify (m_mesh->polyhedron()->faces(), - m_labels, *m_neural_network, - indices, m_label_probabilities); -#endif - } for(face_descriptor fd : faces(*(m_mesh->polyhedron()))) m_classif[fd] = indices[fd]; @@ -411,17 +352,6 @@ bool Surface_mesh_item_classification::run (int method, int classifier, run (method, *m_random_forest, subdivisions, smoothing); #endif } - else if (classifier == CGAL_CLASSIFICATION_TENSORFLOW_NUMBER) - { -#ifdef CGAL_LINKED_WITH_TENSORFLOW - if (m_neural_network == NULL) - { - std::cerr << "Error: TensorFlow Neural Network must be trained or have a configuration loaded first" << std::endl; - return false; - } - run (method, *m_neural_network, subdivisions, smoothing); -#endif - } return true; } From e2a80611ce629737f3ff54958ae27c58f36b2c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 24 Feb 2021 16:52:16 +0100 Subject: [PATCH 066/178] complete the visitor for edge creation/copies --- .../Concepts/PMPCorefinementVisitor.h | 31 +++++++++-- .../internal/Corefinement/face_graph_utils.h | 53 +++++++++++++++---- 2 files changed, 68 insertions(+), 16 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h index cd2e6ebf2eb..3dcd162f0de 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h @@ -33,28 +33,49 @@ typedef unspecified_type halfedge_descriptor; void after_subface_created(face_descriptor f_new, Triangle_mesh& tm); /// @} -/// @name Functions used by corefine() when edges are split +/// @name Functions used by corefine() when edges are split or created /// @{ /// called before the edge of `h` in `tm` is split. Each subsequent call to /// `edge_split()` until the call to `after_edge_split()` will correspond to /// the split of that edge. If `edge_split(h_i, tm)` is called for `i=1` to `n`, /// `h_1`, `h_2`, ... ,`h_n`, `h` is the sequence of halfedges representing the - /// edge split (with the same initial orientation) + /// edge split (with the same initial orientation). There is only one call per edge. void before_edge_split(halfedge_descriptor h, TriangleMesh& tm); - /// called when a new split is done. The target of `hnew` is a new split vertex. + /// called when a new split is done. The target of `hnew` is a new split vertex. There is only one call per edge. void edge_split(halfedge_descriptor hnew, TriangleMesh& tm); /// called when the split of the halfedge `h` passed at the later call to `before_edge_split()` is finished. void after_edge_split(); + /// called when a new after edge is added to triangulate a face. The face triangulated is `f_split` + /// in the last call to `before_subface_creations(f_split, tm)`. There is only one call per edge. + void add_retriangulation_edge(halfedge_descriptor h, TriangleMesh& tm); /// @} /// @name Functions used by Boolean operations functions using corefinement. /// These functions are not needed if you only call `corefine()`. /// @{ /// called before importing the face `f_src` of `tm_src` in `tm_tgt` - void before_face_copy(face_descriptor f_src, Triangle_mesh& tm_src, Triangle_mesh& tm_tgt); + void before_face_copy(face_descriptor f_src, const Triangle_mesh& tm_src, Triangle_mesh& tm_tgt); /// called after importing the face `f_src` of `tm_src` in `tm_tgt`. The new face is `f_tgt`. /// Note that the call is placed just after a call to `add_face()` so the halfedge pointer is not set yet. - void after_face_copy(face_descriptor f_src, Triangle_mesh& tm_src, + void after_face_copy(face_descriptor f_src, const Triangle_mesh& tm_src, face_descriptor f_tgt, Triangle_mesh& tm_tgt); + /// called before importing the edge of `h_src` of `tm_src` in `tm_tgt`. There is one call per edge + void before_edge_copy(halfedge_descriptor h_src/, const TriangleMesh& tm_src, TriangleMesh& tm_tgt){} + /// called after importing the edge of `h_src` of `tm_src` in `tm_tgt`. The corresponding new halfedge is `h_tgt`. + /// There is only one call per edge. + void after_edge_copy(halfedge_descriptor h_src, const TriangleMesh& tm_src, + halfedge_descriptor h_tgt, TriangleMesh& tm_tgt); + /// called before a patch boundary edge is duplicated to disconnect patches of `tm` + /// (When an in-place operation and an out-of-place are both requested) + void before_edge_duplicated(halfedge_descriptor h, TriangleMesh& tm); + /// called when the edge of `h_src` has been duplicated into `h_new` in `tm` + /// (When an in-place operation and an out-of-place are both requested) + void after_edge_duplicated(halfedge_descriptor h_src, + halfedge_descriptor h_new, TriangleMesh& tm); + /// called when an intersection edge (represented in input meshes `tm_src1` and `tm_src2` by `h_src1` and `h_src2` + /// respectively) is imported in `tm_tgt` as `h_tgt`. There is only one call per edge. + void intersection_edge_copy(halfedge_descriptor h_src1, const TriangleMesh& tm_src1, + halfedge_descriptor h_src2, const TriangleMesh& tm_src2, + halfedge_descriptor h_tgt, TriangleMesh& tm_tgt); /// @} }; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index 6c85bd8d8da..1e284c670d9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -216,18 +216,34 @@ struct Default_visitor{ typedef boost::graph_traits GT; typedef typename GT::face_descriptor face_descriptor; typedef typename GT::halfedge_descriptor halfedge_descriptor; - +// face visitor functions void before_subface_creations(face_descriptor /*f_old*/,TriangleMesh&){} void after_subface_creations(TriangleMesh&){} void before_subface_created(TriangleMesh&){} void after_subface_created(face_descriptor /*f_new*/,TriangleMesh&){} - void before_face_copy(face_descriptor /*f_old*/, TriangleMesh&, TriangleMesh&){} - void after_face_copy(face_descriptor /*f_old*/, TriangleMesh&, + void before_face_copy(face_descriptor /*f_old*/, const TriangleMesh&, TriangleMesh&){} + void after_face_copy(face_descriptor /*f_old*/, const TriangleMesh&, face_descriptor /* f_new */, TriangleMesh&){} - void before_edge_split(halfedge_descriptor /* h */, const TriangleMesh& /* tm */){} - void edge_split(halfedge_descriptor /* hnew */, const TriangleMesh& /* tm */){} +// edge visitor functions + void before_edge_split(halfedge_descriptor /* h */, TriangleMesh& /* tm */){} + void edge_split(halfedge_descriptor /* hnew */, TriangleMesh& /* tm */){} void after_edge_split(){} + void add_retriangulation_edge(halfedge_descriptor /* h */ , TriangleMesh& /* tm */) {} // edges added during split face retriangulation + + void before_edge_copy(halfedge_descriptor /*h_old*/, const TriangleMesh&, TriangleMesh&){} + void after_edge_copy(halfedge_descriptor /*h_old*/, const TriangleMesh&, + halfedge_descriptor /* f_new */, TriangleMesh&){} + + void before_edge_duplicated(halfedge_descriptor /*h_old*/, TriangleMesh&){} // called before a patch border edge is duplicated + void after_edge_duplicated(halfedge_descriptor /*h_old*/, + halfedge_descriptor /* f_new */, TriangleMesh&){} // called after a patch border edge is duplicated + + void intersection_edge_copy(halfedge_descriptor /* h_old1 */, const TriangleMesh& /* tm1 */, + halfedge_descriptor /* h_old2 */, const TriangleMesh& /* tm2 */, + halfedge_descriptor /* h_new */, TriangleMesh& /* tm_new */){} + + // calls commented in the code and probably incomplete due to the migration // see NODE_VISITOR_TAG /* @@ -311,6 +327,7 @@ triangulate_a_face( !cdt.is_infinite(cdt.mirror_vertex(it->first,it->second)) ) { edge_descriptor e=add_edge(tm); + user_visitor.add_retriangulation_edge(halfedge(e, tm), tm); halfedge_descriptor h=halfedge(e,tm), h_opp=opposite(h,tm); Node_id i0=cdt_v0->info(), i1=cdt_v1->info(); @@ -610,7 +627,8 @@ template + class IntersectionEdgeMap, + class UserVisitor> void import_polyline( PolygonMesh& output, typename boost::graph_traits::halfedge_descriptor h1, @@ -627,7 +645,8 @@ void import_polyline( const VertexPointMap2& /*vpm2*/, const VertexPointMapOut& vpm_out, std::vector - ::edge_descriptor>& output_shared_edges) + ::edge_descriptor>& output_shared_edges, + UserVisitor& user_visitor) { typedef boost::graph_traits GT; typedef typename GT::halfedge_descriptor halfedge_descriptor; @@ -687,6 +706,8 @@ void import_polyline( pm2_to_output_edges.insert( std::make_pair(edge(prev2, pm2), edge(prev_out, output)) ); + user_visitor.intersection_edge_copy(prev1, pm1, prev2, pm2, h_out, output); + src=tgt; for (std::size_t i=1; i(ed, new_edge, @@ -1086,7 +1112,8 @@ void fill_new_triangle_mesh( tm1_to_output_vertices, intersection_edges1, intersection_edges2, vpm1, vpm2, vpm_out, - output_shared_edges); + output_shared_edges, + user_visitor); //import patches of tm1 if (reverse_orientation_of_patches_from_tm1) @@ -1135,13 +1162,15 @@ void fill_new_triangle_mesh( template + class EdgeMap, + class UserVisitor> void disconnect_patches( TriangleMesh& tm1, const boost::dynamic_bitset<>& patches_to_remove, PatchContainer& patches_of_tm1, const EdgeMap& tm1_edge_to_tm2_edge, //map intersection edges of tm1 to the equivalent in tm2 - EdgeMap& new_tm1_edge_to_tm2_edge) //map the new intersection edges of tm1 to the equivalent in tm2 + EdgeMap& new_tm1_edge_to_tm2_edge, //map the new intersection edges of tm1 to the equivalent in tm2 + UserVisitor& user_visitor) { typedef boost::graph_traits GT; typedef typename GT::halfedge_descriptor halfedge_descriptor; @@ -1197,7 +1226,9 @@ void disconnect_patches( for(std::size_t k=0; k Date: Wed, 24 Feb 2021 16:57:21 +0100 Subject: [PATCH 067/178] update changes --- Installation/CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index ed91c406088..eb9992c4696 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -20,6 +20,7 @@ A comprehensive list of the supported file formats is available in the Stream_su is within a polyhedral envelope around a set of triangles. It is based on the work of Bolun Wang, Teseo Schneider, Yixin Hu, Marco Attene, and Daniele Panozzo. "Exact and efficient polyhedral envelope containment check." (ACM Trans. Graph., 39-4, July 2020). +- Added more functions in the visitor of the corefinement based methods to track all edge creations. ### [Surface Mesh Simplification](https://doc.cgal.org/5.3/Manual/packages.html#PkgSurfaceMeshSimplification) - Added a filtering mechanism so that costly tests get only applied to the next candidate for the edge collapse. From c0a90c101b546d8fe3502afd1a4cab169e31d10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 24 Feb 2021 17:05:58 +0100 Subject: [PATCH 068/178] doc update + missing renaming --- .../Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h | 1 + .../internal/Corefinement/face_graph_utils.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h index 3dcd162f0de..eddb57b7bb2 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h @@ -74,6 +74,7 @@ typedef unspecified_type halfedge_descriptor; halfedge_descriptor h_new, TriangleMesh& tm); /// called when an intersection edge (represented in input meshes `tm_src1` and `tm_src2` by `h_src1` and `h_src2` /// respectively) is imported in `tm_tgt` as `h_tgt`. There is only one call per edge. + /// (Called only when an out-of-place operation is requested) void intersection_edge_copy(halfedge_descriptor h_src1, const TriangleMesh& tm_src1, halfedge_descriptor h_src2, const TriangleMesh& tm_src2, halfedge_descriptor h_tgt, TriangleMesh& tm_tgt); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h index 1e284c670d9..f221e09efc8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/face_graph_utils.h @@ -718,7 +718,7 @@ void import_polyline( h1 = next_marked_halfedge_around_target_vertex(prev1, pm1, intersection_edges1); h2 = next_marked_halfedge_around_target_vertex(prev2, pm2, intersection_edges2); - user_visitor.edge_copy(h1, pm1, h2, pm2, h_out, output); + user_visitor.intersection_edge_copy(h1, pm1, h2, pm2, h_out, output); //if this is the final segment, only create a target vertex if it does not exist if (i+1!=nb_segments) From fed29a6b85ac2a973dccc96ac1eccff68f43c021 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 27 Feb 2021 11:58:01 +0000 Subject: [PATCH 069/178] Use SHalfedge handle instead of repeated vector lookup --- Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h | 9 ++++--- .../CGAL/Nef_3/polygon_mesh_to_nef_3.h | 26 ++++++++----------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h index 786971053d3..ee16c2402bf 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h @@ -116,7 +116,8 @@ class SNC_indexed_items { init_ifacet = sl.init_ifacet; return *this; } - + int new_index() + { index = Index_generator::get_unique_index(); return index; } void set_index(int idx = Index_generator::get_unique_index()) { index = idx; } int get_index() const { return index; } @@ -151,7 +152,8 @@ class SNC_indexed_items { init_ifacet = se.init_ifacet; return *this; } - + int new_index() + { index = index2 = Index_generator::get_unique_index(); return index; } void set_index(int idx = Index_generator::get_unique_index()) { index = index2 = idx; } int get_index() const { @@ -186,7 +188,8 @@ class SNC_indexed_items { index = sv.index; return *this; } - + int new_index() + { index = Index_generator::get_unique_index(); return index; } void set_index(int idx = Index_generator::get_unique_index()) { index = idx; } int get_index() const { return index; } diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index f7d33128ad2..b639fa6d4e1 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -148,26 +148,22 @@ public: for(face_descriptor fi : faces(P)) { Halfedge_around_facet_const_circulator fc(halfedge(fi,P),P), end(fc); - typename boost::property_traits::value_type - index = get(him,*fc); - hash[index]->set_index(); - hash[index]->twin()->set_index(); - hash[index]->twin()->source()->set_index(); - int se = hash[index]->get_index(); - int set = hash[index]->twin()->get_index(); - int sv = hash[index]->twin()->source()->get_index(); + SHalfedge_handle s = hash[get(him,*fc)]; + int se = s->new_index(); + int set = s->twin()->new_index(); + int sv = s->twin()->source()->new_index(); ++fc; CGAL_For_all(fc, end) { - index = get(him,*fc); - hash[index]->set_index(se); - hash[index]->twin()->set_index(set); - hash[index]->source()->set_index(sv); - hash[index]->twin()->source()->set_index(); - sv = hash[index]->twin()->source()->get_index(); + SHalfedge_handle n = hash[get(him,*fc)]; + n->set_index(se); + n->twin()->set_index(set); + n->source()->set_index(sv); + sv = n->twin()->source()->new_index(); } - hash[get(him,*fc)]->source()->set_index(sv); + s->source()->set_index(sv); } + } }; From a143b600402a4f95a34e8be5a1f275393d0c74ed Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 27 Feb 2021 12:31:13 +0000 Subject: [PATCH 070/178] Rename hash to SHalfedge list since its not really a hash --- .../include/CGAL/Nef_3/polygon_mesh_to_nef_3.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index b639fa6d4e1..02907ffff0e 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -126,21 +126,21 @@ class Face_graph_index_adder Halfedge_around_facet_const_circulator; - typedef std::vector Hash; + typedef std::vector SHalfedge_list; PolygonMesh& P; HalfedgeIndexMap him; - Hash hash; + SHalfedge_list shalfedges; public: Face_graph_index_adder(PolygonMesh& P_, HalfedgeIndexMap him) : P(P_), him(him) { - hash.resize(num_halfedges(P)); + shalfedges.resize(num_halfedges(P)); } - void set_hash(halfedge_descriptor evc, + void set_edge(halfedge_descriptor evc, SHalfedge_handle se) { - hash[get(him,evc)] = se; + shalfedges[get(him,evc)] = se; } void resolve_indexes() @@ -148,14 +148,14 @@ public: for(face_descriptor fi : faces(P)) { Halfedge_around_facet_const_circulator fc(halfedge(fi,P),P), end(fc); - SHalfedge_handle s = hash[get(him,*fc)]; + SHalfedge_handle s = shalfedges[get(him,*fc)]; int se = s->new_index(); int set = s->twin()->new_index(); int sv = s->twin()->source()->new_index(); ++fc; CGAL_For_all(fc, end) { - SHalfedge_handle n = hash[get(him,*fc)]; + SHalfedge_handle n = shalfedges[get(him,*fc)]; n->set_index(se); n->twin()->set_index(set); n->source()->set_index(sv); @@ -256,7 +256,7 @@ void polygon_mesh_to_nef_3(PolygonMesh& P, SNC_structure& S, FaceIndexMap fimap, e->twin()->circle() = ss_circle.opposite(); e->mark() = e->twin()->mark() = true; - index_adder.set_hash(pe_prev, e); + index_adder.set_edge(pe_prev, e); } sv_prev = sv; @@ -288,7 +288,7 @@ void polygon_mesh_to_nef_3(PolygonMesh& P, SNC_structure& S, FaceIndexMap fimap, e->twin()->circle() = ss_circle.opposite(); e->mark() = e->twin()->mark() = true; - index_adder.set_hash(pe_prev, e); + index_adder.set_edge(pe_prev, e); } // create faces From d23fca2a47f94f5af2071f1f7892fffaa18c7c2f Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 27 Feb 2021 12:32:26 +0000 Subject: [PATCH 071/178] Use new_index in several other places --- Nef_3/include/CGAL/Nef_3/SNC_constructor.h | 6 ++---- Nef_3/include/CGAL/Nef_polyhedron_3.h | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_constructor.h b/Nef_3/include/CGAL/Nef_3/SNC_constructor.h index f93e584549d..e5bf90033ff 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_constructor.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_constructor.h @@ -2129,16 +2129,14 @@ class SNC_constructor Halfedge_iterator e; CGAL_forall_edges(e, *this->sncp()) { - e->set_index(); - e->twin()->set_index(e->get_index()); + e->twin()->set_index(e->new_index()); } Halffacet_iterator f; CGAL_forall_halffacets(f, *this->sncp()) { Halffacet_cycle_iterator fci(f->facet_cycles_begin()); SHalfedge_handle se(fci); - se->set_index(); - int index(se->get_index()); + int index(se->new_index()); for(; fci != f->facet_cycles_end(); ++fci) { if(fci.is_shalfedge()) { SHalfedge_around_facet_circulator c1(fci), c2(c1); diff --git a/Nef_3/include/CGAL/Nef_polyhedron_3.h b/Nef_3/include/CGAL/Nef_polyhedron_3.h index 3eb723d37b7..ef3700f28b9 100644 --- a/Nef_3/include/CGAL/Nef_polyhedron_3.h +++ b/Nef_3/include/CGAL/Nef_polyhedron_3.h @@ -490,8 +490,7 @@ protected: SFace_handle sf(v->new_sface()); SM.link_as_isolated_vertex(sv,sf); if(first) { - sv->set_index(); - index = sv->get_index(); + index = sv->new_index(); first = false; } else sv->set_index(index); @@ -512,8 +511,7 @@ protected: SM.link_as_isolated_vertex(sv1,sf); SM.link_as_isolated_vertex(sv2,sf); sv1->set_index(index); - sv2->set_index(); - index = sv2->get_index(); + index = sv2->new_index(); } }; From 3de90de34bc5896959c85f0aef0c775256734942 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Mon, 1 Mar 2021 07:37:46 +0000 Subject: [PATCH 072/178] Correct variable name in Face_graph_index_adder --- Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index 02907ffff0e..dd294728a72 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -126,11 +126,11 @@ class Face_graph_index_adder Halfedge_around_facet_const_circulator; - typedef std::vector SHalfedge_list; + typedef std::vector SHalfedges; PolygonMesh& P; HalfedgeIndexMap him; - SHalfedge_list shalfedges; + SHalfedges shalfedges; public: Face_graph_index_adder(PolygonMesh& P_, HalfedgeIndexMap him) : P(P_), him(him) From 30e536bdf0e2b7a2179cc490dc795a7c6bf13925 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Mon, 1 Mar 2021 08:06:48 +0000 Subject: [PATCH 073/178] Remove default paramter from set_index in SNC_indexed_items --- .../Ray_hit_generator.h | 9 ++--- .../Ray_hit_generator2.h | 9 ++--- .../CGAL/Convex_decomposition_3/SM_walls.h | 6 ++-- .../Single_wall_creator.h | 12 +++---- .../Single_wall_creator2.h | 6 ++-- .../Single_wall_creator3.h | 6 ++-- Nef_3/include/CGAL/Nef_3/ID_support_handler.h | 3 +- Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h | 6 ++-- .../CGAL/Nef_3/vertex_cycle_to_nef_3.h | 36 ++----------------- 9 files changed, 22 insertions(+), 71 deletions(-) diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h index dd400adbfc0..a3b60b73293 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator.h @@ -107,8 +107,7 @@ class Ray_hit_generator : public Modifier_base { e->twin() = svb; #ifndef CGAL_NEF_NO_INDEXED_ITEMS svb->set_index(e->get_index()); - svf->set_index(); - svf->twin()->set_index(svf->get_index()); + svf->twin()->set_index(svf->new_index()); #endif } else { svf->twin() = e; @@ -117,8 +116,7 @@ class Ray_hit_generator : public Modifier_base { e->twin() = svf; #ifndef CGAL_NEF_NO_INDEXED_ITEMS svf->set_index(e->get_index()); - svb->set_index(); - svb->twin()->set_index(svb->get_index()); + svb->twin()->set_index(svb->new_index()); #endif } @@ -165,8 +163,7 @@ class Ray_hit_generator : public Modifier_base { SM_walls smw(&*v_new); sv2 = smw.add_ray_svertex(Sphere_point(-dir)); #ifndef CGAL_NEF_NO_INDEXED_ITEMS - sv1->set_index(); - sv2->set_index(sv1->get_index()); + sv2->set_index(sv1->new_index()); #endif } } diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h index a936a2a47d9..c0e8cdeb858 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Ray_hit_generator2.h @@ -112,8 +112,7 @@ class Ray_hit_generator2 : public Modifier_base { e->twin() = svb; #ifndef CGAL_NEF_NO_INDEXED_ITEMS svb->set_index(e->get_index()); - svf->set_index(); - svf->twin()->set_index(svf->get_index()); + svf->twin()->set_index(svf->new_index()); #endif } else { svf->twin() = e; @@ -122,8 +121,7 @@ class Ray_hit_generator2 : public Modifier_base { e->twin() = svf; #ifndef CGAL_NEF_NO_INDEXED_ITEMS svf->set_index(e->get_index()); - svb->set_index(); - svb->twin()->set_index(svb->get_index()); + svb->twin()->set_index(svb->new_index()); #endif } @@ -182,8 +180,7 @@ class Ray_hit_generator2 : public Modifier_base { sv1->twin() = sv2; // TODO: why is this necessary? sv2->twin() = sv1; // these edges should not go into the Edge_sorter #ifndef CGAL_NEF_NO_INDEXED_ITEMS - sv1->set_index(); - sv2->set_index(sv1->get_index()); + sv2->set_index(sv1->new_index()); #endif } } diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h index 1fac7a8a0af..27a1c4f697a 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/SM_walls.h @@ -529,10 +529,8 @@ class SM_walls : SM_decorator { #ifndef CGAL_NEF_NO_INDEXED_ITEMS CGAL_assertion(index1==0 || index1!=index2); if(index1==0) { - se_new->set_index(); - se_new->twin()->set_index(); - index1 = se_new->get_index(); - index2 = se_new->twin()->get_index(); + index1 = se_new->new_index(); + index2 = se_new->twin()->new_index(); } else { se_new->set_index(index1); se_new->twin()->set_index(index2); diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator.h index f3878fba24a..d0e8b498a59 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator.h @@ -204,8 +204,7 @@ class Single_wall_creator : public Modifier_base { opp->twin() = lateral_svertex; lateral_svertex->twin() = opp; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - opp->set_index(); - lateral_svertex->set_index(opp->get_index()); + lateral_svertex->set_index(opp->new_index()); #endif pl->add_edge(lateral_svertex); @@ -237,8 +236,7 @@ class Single_wall_creator : public Modifier_base { lateral_svertex->twin() = opp; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - opp->set_index(); - lateral_svertex->set_index(opp->get_index()); + lateral_svertex->set_index(opp->new_index()); #endif pl->add_edge(lateral_svertex); @@ -275,8 +273,7 @@ class Single_wall_creator : public Modifier_base { opp->twin() = lateral_svertex; lateral_svertex->twin() = opp; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - opp->set_index(); - lateral_svertex->set_index(opp->get_index()); + lateral_svertex->set_index(opp->new_index()); #endif pl->add_edge(lateral_svertex); @@ -308,8 +305,7 @@ class Single_wall_creator : public Modifier_base { opp->twin() = lateral_svertex; lateral_svertex->twin() = opp; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - opp->set_index(); - lateral_svertex->set_index(opp->get_index()); + lateral_svertex->set_index(opp->new_index()); #endif pl->add_edge(lateral_svertex); diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h index ca32975c940..bd4d22bac38 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator2.h @@ -163,8 +163,7 @@ class Single_wall_creator2 : public Modifier_base { lateral_sv_tgt[0]->twin() = lateral_sv_tgt[1]; lateral_sv_tgt[1]->twin() = lateral_sv_tgt[0]; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - lateral_sv_tgt[0]->set_index(); - lateral_sv_tgt[1]->set_index(lateral_sv_tgt[0]->get_index()); + lateral_sv_tgt[1]->set_index(lateral_sv_tgt[0]->new_index()); #endif return; } @@ -174,8 +173,7 @@ class Single_wall_creator2 : public Modifier_base { opp->twin() = lateral_sv_tgt[0]; lateral_sv_tgt[0]->twin() = opp; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - opp->set_index(); - lateral_sv_tgt[0]->set_index(opp->get_index()); + lateral_sv_tgt[0]->set_index(opp->new_index()); #endif lateral_sv_tgt[0] = SMW_tgt.add_lateral_svertex(Sphere_segment(lateral_sv_tgt[0]->point().antipode(), diff --git a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h index a99f84399ac..fc26c54ceb0 100644 --- a/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h +++ b/Convex_decomposition_3/include/CGAL/Convex_decomposition_3/Single_wall_creator3.h @@ -169,8 +169,7 @@ class Single_wall_creator3 : public Modifier_base { lateral_sv_tgt[0]->twin() = lateral_sv_tgt[1]; lateral_sv_tgt[1]->twin() = lateral_sv_tgt[0]; #ifndef CGAL_NEF_NO_INDEXED_ITEMS - lateral_sv_tgt[0]->set_index(); - lateral_sv_tgt[1]->set_index(lateral_sv_tgt[0]->get_index()); + lateral_sv_tgt[1]->set_index(lateral_sv_tgt[0]->new_index()); #endif pl->add_edge(lateral_sv_tgt[0]); return; @@ -182,8 +181,7 @@ class Single_wall_creator3 : public Modifier_base { lateral_sv_tgt[0]->twin() = opp; pl->add_edge(opp); #ifndef CGAL_NEF_NO_INDEXED_ITEMS - opp->set_index(); - lateral_sv_tgt[0]->set_index(opp->get_index()); + lateral_sv_tgt[0]->set_index(opp->new_index()); #endif lateral_sv_tgt[0] = SMW_tgt.add_lateral_svertex(Sphere_segment(lateral_sv_tgt[0]->point().antipode(), diff --git a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h index a62e50c78e6..ffdd1afec6e 100644 --- a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h +++ b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h @@ -78,8 +78,7 @@ class ID_support_handler { << " " << f2->plane() << &f2); if(f2m[f1][f2]==0) { - sv->set_index(); - f2m[f1][f2] = sv->get_index(); + f2m[f1][f2] = sv->new_index(); CGAL_NEF_TRACEN("insert " << sv->point() << &*sv << ": " << f2m[f1][f2]); CGAL_NEF_TRACEN("not defined, yet"); diff --git a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h index ee16c2402bf..2bee2a582e5 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_indexed_items.h @@ -118,7 +118,7 @@ class SNC_indexed_items { } int new_index() { index = Index_generator::get_unique_index(); return index; } - void set_index(int idx = Index_generator::get_unique_index()) + void set_index(int idx) { index = idx; } int get_index() const { return index; } Halffacet_const_handle get_index_facet() const { @@ -154,7 +154,7 @@ class SNC_indexed_items { } int new_index() { index = index2 = Index_generator::get_unique_index(); return index; } - void set_index(int idx = Index_generator::get_unique_index()) + void set_index(int idx) { index = index2 = idx; } int get_index() const { return index; @@ -190,7 +190,7 @@ class SNC_indexed_items { } int new_index() { index = Index_generator::get_unique_index(); return index; } - void set_index(int idx = Index_generator::get_unique_index()) + void set_index(int idx) { index = idx; } int get_index() const { return index; } }; diff --git a/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h index a291d11bb0a..1b7426fee5a 100644 --- a/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/vertex_cycle_to_nef_3.h @@ -35,37 +35,6 @@ namespace CGAL { -/* -template -class Index_assigner { - Index_assigner() {} - template - void assign_index(Handle& ) const {} - template - void assign_first_index() const {} - template - void assign_new_index() {} -}; - -template<> class Index_assigner { - int first; - int index; - public: - Index_assigner() : - first(Index_generator::get_unique_index()), index(first) {} - - template - void assign_index(Handle& h) const - { h->set_index(index); } - template - void assign_first_index(Handle& h) const - { h->set_index(first); } - template - void assign_new_index(Handle& h) - { h->set_index(); index = h->get_index(); } -}; -*/ - //template class Index_matcher; template @@ -121,11 +90,10 @@ template h->set_index(ei->second); if(plusTwin) h->twin()->set_index(h->get_index()+1); } else { - int new_index = Index_generator::get_unique_index(); + int new_index = h->new_index(); edge2int.insert(std::make_pair(e,new_index)); - h->set_index(new_index); if(plusTwin) - h->twin()->set_index(); + h->twin()->new_index(); } } }; From 2864f62ade7c81fdea871b333691083bfe686473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 1 Mar 2021 19:47:21 +0100 Subject: [PATCH 074/178] fixes after review --- .../Concepts/PMPCorefinementVisitor.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h index eddb57b7bb2..b6f59c84eb2 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h @@ -45,7 +45,7 @@ typedef unspecified_type halfedge_descriptor; void edge_split(halfedge_descriptor hnew, TriangleMesh& tm); /// called when the split of the halfedge `h` passed at the later call to `before_edge_split()` is finished. void after_edge_split(); - /// called when a new after edge is added to triangulate a face. The face triangulated is `f_split` + /// called when a new edge has been added to triangulate a face. The face triangulated is `f_split` /// in the last call to `before_subface_creations(f_split, tm)`. There is only one call per edge. void add_retriangulation_edge(halfedge_descriptor h, TriangleMesh& tm); /// @} @@ -59,7 +59,7 @@ typedef unspecified_type halfedge_descriptor; /// Note that the call is placed just after a call to `add_face()` so the halfedge pointer is not set yet. void after_face_copy(face_descriptor f_src, const Triangle_mesh& tm_src, face_descriptor f_tgt, Triangle_mesh& tm_tgt); - /// called before importing the edge of `h_src` of `tm_src` in `tm_tgt`. There is one call per edge + /// called before importing the edge of `h_src` of `tm_src` in `tm_tgt`. There is one call per edge. void before_edge_copy(halfedge_descriptor h_src/, const TriangleMesh& tm_src, TriangleMesh& tm_tgt){} /// called after importing the edge of `h_src` of `tm_src` in `tm_tgt`. The corresponding new halfedge is `h_tgt`. /// There is only one call per edge. @@ -72,7 +72,7 @@ typedef unspecified_type halfedge_descriptor; /// (When an in-place operation and an out-of-place are both requested) void after_edge_duplicated(halfedge_descriptor h_src, halfedge_descriptor h_new, TriangleMesh& tm); - /// called when an intersection edge (represented in input meshes `tm_src1` and `tm_src2` by `h_src1` and `h_src2` + /// called when an intersection edge (represented in input meshes `tm_src1` and `tm_src2` by `h_src1` and `h_src2`, /// respectively) is imported in `tm_tgt` as `h_tgt`. There is only one call per edge. /// (Called only when an out-of-place operation is requested) void intersection_edge_copy(halfedge_descriptor h_src1, const TriangleMesh& tm_src1, From 909b3a15f4a2df9cde7c89cfe229a3a044e7ec73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 1 Mar 2021 20:02:07 +0100 Subject: [PATCH 075/178] missing dots --- .../Concepts/PMPCorefinementVisitor.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h index b6f59c84eb2..450596ed64d 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPCorefinementVisitor.h @@ -24,9 +24,9 @@ typedef unspecified_type halfedge_descriptor; /// `before_subface_created()`/`after_subface_created()` will correspond to /// the creation of a new face of the triangulation of `f_split`. void before_subface_creations(face_descriptor f_split, Triangle_mesh& tm); - /// called when the triangulation of a face in `tm` is finished + /// called when the triangulation of a face in `tm` is finished. void after_subface_creations(Triangle_mesh& tm); - /// called before creating a new triangle face in `tm` to triangulate the face passed to `before_subface_creations()` + /// called before creating a new triangle face in `tm` to triangulate the face passed to `before_subface_creations()`. void before_subface_created(Triangle_mesh& tm); /// called after creating a new triangle face `f_new` in `tm` to triangulate the face passed to `before_subface_creations()`. /// Note that the call is placed just after a call to `add_face()` so the halfedge pointer is not set yet. @@ -66,10 +66,10 @@ typedef unspecified_type halfedge_descriptor; void after_edge_copy(halfedge_descriptor h_src, const TriangleMesh& tm_src, halfedge_descriptor h_tgt, TriangleMesh& tm_tgt); /// called before a patch boundary edge is duplicated to disconnect patches of `tm` - /// (When an in-place operation and an out-of-place are both requested) + /// (When an in-place operation and an out-of-place are both requested). void before_edge_duplicated(halfedge_descriptor h, TriangleMesh& tm); /// called when the edge of `h_src` has been duplicated into `h_new` in `tm` - /// (When an in-place operation and an out-of-place are both requested) + /// (When an in-place operation and an out-of-place are both requested). void after_edge_duplicated(halfedge_descriptor h_src, halfedge_descriptor h_new, TriangleMesh& tm); /// called when an intersection edge (represented in input meshes `tm_src1` and `tm_src2` by `h_src1` and `h_src2`, From 19e5e4a16e1331ade755b4c29b2b2fe8a2b4264c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 2 Mar 2021 12:25:28 +0000 Subject: [PATCH 076/178] Use flaat_set and put it outside the loop --- .../Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h index 51b6ebba683..9e704870c18 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -177,14 +178,16 @@ bool is_polygon_soup_a_polygon_mesh(const PolygonRange& polygons) //check there is no duplicated ordered edge, and //check there is no polygon with twice the same vertex std::set > edge_set; + boost::container::flat_set polygon_vertices; V_ID max_id = 0; + for(const Polygon& polygon : polygons) { std::size_t nb_edges = boost::size(polygon); if(nb_edges < 3) return false; - std::set polygon_vertices; + polygon_vertices.clear(); V_ID prev = *std::prev(boost::end(polygon)); for(V_ID id : polygon) { From 10f454d98384dfacb2cd5a06b1f7df6a7ff6ea4a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 2 Mar 2021 13:09:45 +0000 Subject: [PATCH 077/178] reserve(8) for incident faces to a vertex --- .../include/CGAL/Polygon_mesh_processing/compute_normal.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h index e31e91db8cd..7f438d4d5bf 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h @@ -506,6 +506,7 @@ compute_vertex_normal_most_visible_min_circle(typename boost::graph_traits incident_faces; + incident_faces.reserve(8); for(face_descriptor f : CGAL::faces_around_target(halfedge(v, pmesh), pmesh)) { if(f == boost::graph_traits::null_face()) From 5e2a580551527336ff8dd13357b1465ad4334d23 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 2 Mar 2021 13:17:53 +0000 Subject: [PATCH 078/178] map -> unordered_map --- .../include/CGAL/Polygon_mesh_processing/compute_normal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h index 7f438d4d5bf..bfb8f831238 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef CGAL_PMP_COMPUTE_NORMAL_DEBUG_PP # ifndef CGAL_PMP_COMPUTE_NORMAL_DEBUG @@ -670,7 +671,7 @@ compute_vertex_normal(typename boost::graph_traits::vertex_descript VPMap vpmap = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(vertex_point, pmesh)); - typedef std::map Face_vector_map; + typedef std::unordered_map Face_vector_map; typedef boost::associative_property_map Default_map; typedef typename internal_np::Lookup_named_param_def Date: Tue, 2 Mar 2021 23:28:48 +0900 Subject: [PATCH 079/178] Patch for intervals on wasm --- Number_types/include/CGAL/FPU.h | 57 ++++++++++++++++--- Number_types/include/CGAL/Interval_nt.h | 3 +- .../Polygon_mesh_processing/CMakeLists.txt | 1 + .../corefinement_polyhedron_union.cpp | 6 +- 4 files changed, 56 insertions(+), 11 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 6d5f02a3075..e4e45430f98 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -1,3 +1,8 @@ +// TODO: Remove +#ifndef CGAL_ALWAYS_ROUND_TO_NEAREST +#define CGAL_ALWAYS_ROUND_TO_NEAREST +#endif + // Copyright (c) 1998-2019 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), @@ -117,7 +122,7 @@ extern "C" { #if defined(CGAL_HAS_SSE2) && (defined(__x86_64__) || defined(_M_X64)) # define CGAL_USE_SSE2 1 #endif - +#undef CGAL_USE_SSE2 #ifdef CGAL_CFG_DENORMALS_COMPILE_BUG double& get_static_minimin(); // Defined in Interval_arithmetic_impl.h #endif @@ -347,16 +352,17 @@ inline double IA_bug_sqrt(double d) // With GCC, we can do slightly better : test with __builtin_constant_p() // that both arguments are constant before stopping one of them. // Use inline functions instead ? -#define CGAL_IA_ADD(a,b) CGAL_IA_FORCE_TO_DOUBLE((a)+CGAL_IA_STOP_CPROP(b)) -#define CGAL_IA_SUB(a,b) CGAL_IA_FORCE_TO_DOUBLE(CGAL_IA_STOP_CPROP(a)-(b)) -#define CGAL_IA_MUL(a,b) CGAL_IA_FORCE_TO_DOUBLE(CGAL_IA_STOP_CPROP(a)*CGAL_IA_STOP_CPROP(b)) -#define CGAL_IA_DIV(a,b) CGAL_IA_FORCE_TO_DOUBLE(CGAL_IA_STOP_CPROP(a)/CGAL_IA_STOP_CPROP(b)) +inline double CGAL_IA_UP(double d){return nextafter(d,std::numeric_limits::infinity());} +#define CGAL_IA_ADD(a,b) CGAL_IA_UP((a)+CGAL_IA_STOP_CPROP(b)) +#define CGAL_IA_SUB(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)-(b)) +#define CGAL_IA_MUL(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)*CGAL_IA_STOP_CPROP(b)) +#define CGAL_IA_DIV(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)/CGAL_IA_STOP_CPROP(b)) inline double CGAL_IA_SQUARE(double a){ double b = CGAL_IA_STOP_CPROP(a); // only once - return CGAL_IA_FORCE_TO_DOUBLE(b*b); + return CGAL_IA_UP(b*b); } #define CGAL_IA_SQRT(a) \ - CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) + CGAL_IA_UP(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) #if defined CGAL_SAFE_SSE2 @@ -478,6 +484,9 @@ FPU_get_cw (void) { FPU_CW_t cw; CGAL_IA_GETFPCW(cw); +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + assert(cw == CGAL_FE_TONEAREST); +#endif return cw; } @@ -487,15 +496,29 @@ inline void FPU_set_cw (FPU_CW_t cw) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + assert(cw == CGAL_FE_TONEAREST); + assert(FPU_get_cw() == CGAL_FE_TONEAREST); +#endif CGAL_IA_SETFPCW(cw); +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + assert(FPU_get_cw() == CGAL_FE_TONEAREST); +#endif } inline FPU_CW_t FPU_get_and_set_cw (FPU_CW_t cw) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + assert(cw == CGAL_FE_TONEAREST); + assert(FPU_get_cw() == CGAL_FE_TONEAREST); +#endif FPU_CW_t old = FPU_get_cw(); FPU_set_cw(cw); +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + assert(FPU_get_cw() == CGAL_FE_TONEAREST); +#endif return old; } @@ -508,7 +531,13 @@ template struct Protect_FPU_rounding; template <> struct Protect_FPU_rounding { - Protect_FPU_rounding(FPU_CW_t r = CGAL_FE_UPWARD) + Protect_FPU_rounding( +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + FPU_CW_t r = CGAL_FE_TONEAREST +#else + FPU_CW_t r = CGAL_FE_UPWARD +#endif + ) : backup( FPU_get_and_set_cw(r) ) {} ~Protect_FPU_rounding() @@ -524,7 +553,11 @@ template <> struct Protect_FPU_rounding { Protect_FPU_rounding() {} +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_TONEAREST*/) {} +#else Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_UPWARD*/) {} +#endif }; @@ -538,13 +571,21 @@ struct Checked_protect_FPU_rounding { Checked_protect_FPU_rounding() { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); +#else CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD); +#endif } Checked_protect_FPU_rounding(FPU_CW_t r) : Protect_FPU_rounding(r) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); +#else CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD); +#endif } }; diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index 8a51e7cd860..e94d1c6cb2b 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -722,6 +722,7 @@ private: Interval_nt operator/ (const Interval_nt &a, const Interval_nt & b) { + assert(FPU_get_cw() == CGAL_FE_TONEAREST); #if 0 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88626 if(CGAL_CST_TRUE(a.is_point())) @@ -1148,7 +1149,7 @@ namespace INTERN_INTERVAL_NT { // - compute y = CGAL_IA_SQUARE(x) // - if y==d.inf() use x, else use -CGAL_IA_SUB(CGAL_IA_MIN_DOUBLE,x) FPU_set_cw(CGAL_FE_DOWNWARD); - double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0; + double i = (d.inf() > 0.0) ? nextafter(std::sqrt(d.inf()), 0.) : 0.0; FPU_set_cw(CGAL_FE_UPWARD); #endif return Interval_nt(i, CGAL_IA_SQRT(d.sup())); diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index e34c91b8892..3615a74a4ef 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -76,6 +76,7 @@ create_single_source_cgal_program("corefinement_SM.cpp") create_single_source_cgal_program("corefinement_consecutive_bool_op.cpp") create_single_source_cgal_program("corefinement_difference_remeshed.cpp") create_single_source_cgal_program("corefinement_mesh_union.cpp") +create_single_source_cgal_program("cgal.cc") create_single_source_cgal_program( "corefinement_mesh_union_and_intersection.cpp") create_single_source_cgal_program("corefinement_mesh_union_with_attributes.cpp") diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp index 71bdd4cd2f7..d337bdf637a 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp @@ -1,4 +1,5 @@ -#include +// #include +#include #include #include @@ -8,7 +9,8 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +// typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Exact_predicates_exact_constructions_kernel K; typedef CGAL::Polyhedron_3 Mesh; namespace PMP = CGAL::Polygon_mesh_processing; From 95ea922de87b84f7ba2ed08d97d01f6b06048b81 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 2 Mar 2021 14:40:22 +0000 Subject: [PATCH 080/178] Important gain for Euler::add_face() --- BGL/include/CGAL/boost/graph/Euler_operations.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index 8d5268da6e0..beed0ecfb39 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -737,9 +737,9 @@ add_face(const VertexRange& vr, Graph& g) patch_start, patch_end; // cache for set_next and vertex' set_halfedge typedef std::pair NextCacheEntry; - typedef std::vector NextCache; + typedef boost::container::small_vector NextCache; NextCache next_cache; - next_cache.reserve(3 * n); + //next_cache.reserve(3 * n); Unfortunately small_vector has no reserve // re-link patches if necessary for (unsigned int i = 0, ii = 1; i Date: Wed, 3 Mar 2021 00:32:09 +0900 Subject: [PATCH 081/178] wip --- Number_types/include/CGAL/Interval_nt.h | 10 +++++++--- ...aunay_triangulation_cell_base_with_circumcenter_3.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index e94d1c6cb2b..1b7a836c14e 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -1142,16 +1142,20 @@ namespace INTERN_INTERVAL_NT { // it helps significantly, it might even hurt by introducing a // dependency. } -#else +#else // no __AVX512F__ // TODO: Alternative for computing CGAL_IA_SQRT_DOWN(d.inf()) exactly // without changing the rounding mode: // - compute x = CGAL_IA_SQRT(d.inf()) // - compute y = CGAL_IA_SQUARE(x) // - if y==d.inf() use x, else use -CGAL_IA_SUB(CGAL_IA_MIN_DOUBLE,x) - FPU_set_cw(CGAL_FE_DOWNWARD); +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST double i = (d.inf() > 0.0) ? nextafter(std::sqrt(d.inf()), 0.) : 0.0; +#else // no CGAL_ALWAYS_ROUND_TO_NEAREST + FPU_set_cw(CGAL_FE_DOWNWARD); + double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0; FPU_set_cw(CGAL_FE_UPWARD); -#endif +#endif // no CGAL_ALWAYS_ROUND_TO_NEAREST +#endif // no __AVX512F__ return Interval_nt(i, CGAL_IA_SQRT(d.sup())); } diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h index 14fc74d8490..1c437177712 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h @@ -130,7 +130,7 @@ public: circumcenter_ = new Point(this->Cb::circumcenter(gt)); } else { CGAL_expensive_assertion( - this->Cb::circumcenter(gt) == *circumcenter); + this->Cb::circumcenter(gt) == *circumcenter_); } return *circumcenter_; From a945c4f840f8ee89f4ef4f4be2c040c3e98fb8ba Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 2 Mar 2021 21:30:36 +0000 Subject: [PATCH 082/178] small_vector has reserve() --- BGL/include/CGAL/boost/graph/Euler_operations.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BGL/include/CGAL/boost/graph/Euler_operations.h b/BGL/include/CGAL/boost/graph/Euler_operations.h index beed0ecfb39..d26d6a4bceb 100644 --- a/BGL/include/CGAL/boost/graph/Euler_operations.h +++ b/BGL/include/CGAL/boost/graph/Euler_operations.h @@ -739,7 +739,7 @@ add_face(const VertexRange& vr, Graph& g) typedef std::pair NextCacheEntry; typedef boost::container::small_vector NextCache; NextCache next_cache; - //next_cache.reserve(3 * n); Unfortunately small_vector has no reserve + next_cache.reserve(3 * n); // re-link patches if necessary for (unsigned int i = 0, ii = 1; i Date: Tue, 2 Mar 2021 21:56:54 +0000 Subject: [PATCH 083/178] Replace geometric by combinatorial test --- .../internal/Isotropic_remeshing/remesh_impl.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 1a0fa1d3b8f..ce1636b62d0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -1393,6 +1393,7 @@ private: bool collapse_would_invert_face(const halfedge_descriptor& h) const { + vertex_descriptor tv = target(h, mesh_); typename boost::property_traits::reference s = get(vpmap_, source(h, mesh_)); //s for source typename boost::property_traits::reference @@ -1409,16 +1410,21 @@ private: if (face(hd, mesh_) == boost::graph_traits::null_face()) continue; + vertex_descriptor tnhd = target(next(hd, mesh_), mesh_); + vertex_descriptor tnnhd = target(next(next(hd, mesh_), mesh_), mesh_); typename boost::property_traits::reference - p = get(vpmap_, target(next(hd, mesh_), mesh_)); + p = get(vpmap_, tnhd); typename boost::property_traits::reference - q = get(vpmap_, target(next(next(hd, mesh_), mesh_), mesh_)); + q = get(vpmap_, tnnhd); #ifdef CGAL_PMP_REMESHING_DEBUG CGAL_assertion((Triangle_3(t, p, q).is_degenerate()) == GeomTraits().collinear_3_object()(t, p, q)); #endif + if((tv == tnnhd) || (tv == tnhd)) + continue; + if ( GeomTraits().collinear_3_object()(s, p, q) || GeomTraits().collinear_3_object()(t, p, q)) continue; From 5afc28348e13528b29f74e43e7aea88597622433 Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Wed, 3 Mar 2021 08:23:39 +0000 Subject: [PATCH 084/178] Rename method in both templates for Face_graph_index_adder --- Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h index dd294728a72..8f721948471 100644 --- a/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h +++ b/Nef_3/include/CGAL/Nef_3/polygon_mesh_to_nef_3.h @@ -112,7 +112,7 @@ class Face_graph_index_adder { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; public: Face_graph_index_adder(Polyhedron&, HalfedgeIndexMap ) {} - void set_hash(halfedge_descriptor, + void set_edge(halfedge_descriptor, SHalfedge_handle) {} void resolve_indexes() {} }; From d3d24faf040bb2ce7f5cee4851e03155bc8abf61 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 3 Mar 2021 19:45:40 +0900 Subject: [PATCH 085/178] Add tests --- Number_types/include/CGAL/FPU.h | 66 ++++++---------- Number_types/test/Number_types/CMakeLists.txt | 1 + .../test/Number_types/Interval_nt.cpp | 75 ++++++++++++++++++- .../test/Number_types/Interval_nt_nearest.cpp | 2 + .../Polygon_mesh_processing/CMakeLists.txt | 1 + ...t_corefinement_and_constraints_nearest.cpp | 2 + 6 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 Number_types/test/Number_types/Interval_nt_nearest.cpp create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints_nearest.cpp diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index e4e45430f98..0d7bf61e60c 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -1,8 +1,3 @@ -// TODO: Remove -#ifndef CGAL_ALWAYS_ROUND_TO_NEAREST -#define CGAL_ALWAYS_ROUND_TO_NEAREST -#endif - // Copyright (c) 1998-2019 // Utrecht University (The Netherlands), // ETH Zurich (Switzerland), @@ -122,7 +117,6 @@ extern "C" { #if defined(CGAL_HAS_SSE2) && (defined(__x86_64__) || defined(_M_X64)) # define CGAL_USE_SSE2 1 #endif -#undef CGAL_USE_SSE2 #ifdef CGAL_CFG_DENORMALS_COMPILE_BUG double& get_static_minimin(); // Defined in Interval_arithmetic_impl.h #endif @@ -352,7 +346,17 @@ inline double IA_bug_sqrt(double d) // With GCC, we can do slightly better : test with __builtin_constant_p() // that both arguments are constant before stopping one of them. // Use inline functions instead ? -inline double CGAL_IA_UP(double d){return nextafter(d,std::numeric_limits::infinity());} +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST +inline double CGAL_IA_UP(double d) +{ + return nextafter(d,std::numeric_limits::infinity()); +} +#else +inline double CGAL_IA_UP(double d) +{ + return d; +} +#endif #define CGAL_IA_ADD(a,b) CGAL_IA_UP((a)+CGAL_IA_STOP_CPROP(b)) #define CGAL_IA_SUB(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)-(b)) #define CGAL_IA_MUL(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)*CGAL_IA_STOP_CPROP(b)) @@ -496,29 +500,15 @@ inline void FPU_set_cw (FPU_CW_t cw) { -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - assert(cw == CGAL_FE_TONEAREST); - assert(FPU_get_cw() == CGAL_FE_TONEAREST); -#endif CGAL_IA_SETFPCW(cw); -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - assert(FPU_get_cw() == CGAL_FE_TONEAREST); -#endif } inline FPU_CW_t FPU_get_and_set_cw (FPU_CW_t cw) { -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - assert(cw == CGAL_FE_TONEAREST); - assert(FPU_get_cw() == CGAL_FE_TONEAREST); -#endif FPU_CW_t old = FPU_get_cw(); FPU_set_cw(cw); -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - assert(FPU_get_cw() == CGAL_FE_TONEAREST); -#endif return old; } @@ -526,18 +516,18 @@ FPU_get_and_set_cw (FPU_CW_t cw) // A class whose constructor sets the FPU mode to +inf, saves a backup of it, // and whose destructor resets it back to the saved state. +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST +#define CGAL_FE_PROTECTED CGAL_FE_TONEAREST +#else +#define CGAL_FE_PROTECTED CGAL_FE_UPWARD +#endif + template struct Protect_FPU_rounding; template <> struct Protect_FPU_rounding { - Protect_FPU_rounding( -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - FPU_CW_t r = CGAL_FE_TONEAREST -#else - FPU_CW_t r = CGAL_FE_UPWARD -#endif - ) + Protect_FPU_rounding(FPU_CW_t r = CGAL_FE_PROTECTED) : backup( FPU_get_and_set_cw(r) ) {} ~Protect_FPU_rounding() @@ -553,11 +543,7 @@ template <> struct Protect_FPU_rounding { Protect_FPU_rounding() {} -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_TONEAREST*/) {} -#else - Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_UPWARD*/) {} -#endif + Protect_FPU_rounding(FPU_CW_t /*= CGAL_FE_PROTECTED */) {} }; @@ -571,21 +557,13 @@ struct Checked_protect_FPU_rounding { Checked_protect_FPU_rounding() { -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); -#else - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD); -#endif + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_PROTECTED); } Checked_protect_FPU_rounding(FPU_CW_t r) : Protect_FPU_rounding(r) { -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST); -#else - CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_UPWARD); -#endif + CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_PROTECTED); } }; @@ -596,6 +574,8 @@ struct Checked_protect_FPU_rounding // Its destructor restores the FPU state as it was previously. // Note that this affects "long double" as well, and other potential side effects. // And note that it does not (cannot) "fix" the same problem for the exponent. +// +// (How should this interact with ALWAYS_ROUND_TO_NEAREST?) struct Set_ieee_double_precision #ifdef CGAL_FPU_HAS_EXCESS_PRECISION diff --git a/Number_types/test/Number_types/CMakeLists.txt b/Number_types/test/Number_types/CMakeLists.txt index fdc0448365e..aa51590da93 100644 --- a/Number_types/test/Number_types/CMakeLists.txt +++ b/Number_types/test/Number_types/CMakeLists.txt @@ -31,6 +31,7 @@ create_single_source_cgal_program("Gmpz.cpp") create_single_source_cgal_program("Gmpzf_new.cpp") create_single_source_cgal_program("int.cpp") create_single_source_cgal_program("Interval_nt.cpp") +create_single_source_cgal_program("Interval_nt_nearest.cpp") create_single_source_cgal_program("Interval_nt_new.cpp") create_single_source_cgal_program("ioformat.cpp") create_single_source_cgal_program("known_bit_size_integers.cpp") diff --git a/Number_types/test/Number_types/Interval_nt.cpp b/Number_types/test/Number_types/Interval_nt.cpp index d0a470c1320..4a56129d31f 100644 --- a/Number_types/test/Number_types/Interval_nt.cpp +++ b/Number_types/test/Number_types/Interval_nt.cpp @@ -36,41 +36,71 @@ bool spiral_test() // Tests for constant propagation through intervals. // This must not be performed otherwise rounding modes are ignored. -// Non-inlined operators usually stop cprop (*, /, sqrt). +// On the other hand, if we always round to nearest, then constant propagation +// is desirable. +// Note: Non-inlined operators usually stop cprop (*, /, sqrt). template < typename IA_nt > bool cprop_test() { // Testing cprop through +. IA_nt add = IA_nt(0.00001)+10.1; bool good_add = !add.is_point(); +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + if (good_add) + std::cerr << "ERROR : No constant propagation through operator+." < 2/(double(1<<30)*(1<<22))) { + return false; + } + if (-2/(double(1<<30)*(1<<22)) > a.inf()) { + return false; + } + return true; +#else DEBUG ( std::cout << "i = " << i << std::endl; std::cout << "sup = -inf : " << (a.sup() == -a.inf()) << std::endl; std::cout << "width ok ? : " << (-a.inf() == 1/(double(1<<30)*(1<<22))) << std::endl; ) // DEBUG return i==54 && a.sup() == - a.inf() && a.sup() == 1/(double(1<<30)*(1<<22)); +#endif } @@ -139,6 +189,15 @@ bool overflow_test() DEBUG( std::cout << "f = " << f << std::endl; ) } +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + return a.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + b.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + c.is_same(IA_nt(-std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + d.is_same(IA_nt(-std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + e.is_same(IA_nt(-std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + f.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + g.is_same(-f); +#else return a.is_same(IA_nt(CGAL_IA_MAX_DOUBLE, std::numeric_limits::infinity())) && b.is_same(IA_nt(CGAL_IA_MAX_DOUBLE, std::numeric_limits::infinity())) && c.is_same(IA_nt::largest()) && @@ -146,6 +205,7 @@ bool overflow_test() e.is_same(IA_nt::largest()) && f.is_same(IA_nt(CGAL_IA_MAX_DOUBLE, std::numeric_limits::infinity())) && g.is_same(-f); +#endif } @@ -164,9 +224,15 @@ bool underflow_test() for (i=0; i<20; i++) b = b * b; for (i=0; i<20; i++) c = CGAL_NTS square(c); +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + return a.is_same(IA_nt(0, 0)) + && b.is_same(IA_nt(0, 0)) + && c.is_same(IA_nt(0, 0)); +#else return a.is_same(IA_nt(0, CGAL_IA_MIN_DOUBLE)) && b.is_same(IA_nt::smallest()) && c.is_same(IA_nt(0, CGAL_IA_MIN_DOUBLE)); +#endif } @@ -432,10 +498,17 @@ bool test () int main() { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + std::cout << "Stress-testing the class Interval_nt<> always rounding to nearest.\n"; + bool ok = test >(); + std::cout << "\nStress-testing the class Interval_nt_advanced always rounding to nearest.\n"; + ok &= test(); +#else std::cout << "Stress-testing the class Interval_nt<>.\n"; bool ok = test >(); std::cout << "\nStress-testing the class Interval_nt_advanced.\n"; ok &= test(); +#endif return !ok; } diff --git a/Number_types/test/Number_types/Interval_nt_nearest.cpp b/Number_types/test/Number_types/Interval_nt_nearest.cpp new file mode 100644 index 00000000000..fe5ce657c6e --- /dev/null +++ b/Number_types/test/Number_types/Interval_nt_nearest.cpp @@ -0,0 +1,2 @@ +#define CGAL_ALWAYS_ROUND_TO_NEAREST +#include "Interval_nt.cpp" diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index 08a65b9ffc4..103d6eedb72 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -77,6 +77,7 @@ create_single_source_cgal_program("triangulate_faces_hole_filling_all_search_tes create_single_source_cgal_program("test_pmp_remove_border_edge.cpp") create_single_source_cgal_program("test_pmp_distance.cpp") create_single_source_cgal_program("test_corefinement_and_constraints.cpp") +create_single_source_cgal_program("test_corefinement_and_constraints_nearest.cpp") create_single_source_cgal_program("test_corefinement_bool_op.cpp") create_single_source_cgal_program("test_corefine.cpp") create_single_source_cgal_program("test_coref_epic_points_identity.cpp") diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints_nearest.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints_nearest.cpp new file mode 100644 index 00000000000..b3c56b5c542 --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_corefinement_and_constraints_nearest.cpp @@ -0,0 +1,2 @@ +#define CGAL_ALWAYS_ROUND_TO_NEAREST +#include "test_corefinement_and_constraints.cpp" From ecda444672c6b6922f0c96bfcd9ec655721e75b6 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 3 Mar 2021 19:51:58 +0900 Subject: [PATCH 086/178] Clean up --- Number_types/include/CGAL/FPU.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 0d7bf61e60c..501b63999a9 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -349,11 +349,16 @@ inline double IA_bug_sqrt(double d) #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST inline double CGAL_IA_UP(double d) { - return nextafter(d,std::numeric_limits::infinity()); + // In round-to-nearest mode we find the successor instead. + // This preserves the interval invariants, but is more + // expensive and conservative. + return nextafter(d, std::numeric_limits::infinity()); } #else inline double CGAL_IA_UP(double d) { + // In round-upward mode we can rely on the hardware + // to do the job. return d; } #endif @@ -488,9 +493,6 @@ FPU_get_cw (void) { FPU_CW_t cw; CGAL_IA_GETFPCW(cw); -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - assert(cw == CGAL_FE_TONEAREST); -#endif return cw; } From 605a4463631bde2851d4db7446c8b3f35e8b68fd Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 3 Mar 2021 19:55:06 +0900 Subject: [PATCH 087/178] A little bit more --- Number_types/include/CGAL/Interval_nt.h | 1 - Number_types/test/Number_types/Interval_nt.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index 1b7a836c14e..1eeb2a56e73 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -722,7 +722,6 @@ private: Interval_nt operator/ (const Interval_nt &a, const Interval_nt & b) { - assert(FPU_get_cw() == CGAL_FE_TONEAREST); #if 0 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88626 if(CGAL_CST_TRUE(a.is_point())) diff --git a/Number_types/test/Number_types/Interval_nt.cpp b/Number_types/test/Number_types/Interval_nt.cpp index 4a56129d31f..b2e9b512dfa 100644 --- a/Number_types/test/Number_types/Interval_nt.cpp +++ b/Number_types/test/Number_types/Interval_nt.cpp @@ -127,7 +127,6 @@ bool square_root_test() std::cout << "i = " << i << std::endl; std::cout << "sup : " << a.sup() << std::endl; std::cout << "inf : " << a.inf() << std::endl; - std::cout << "width ok ? : " << (-a.inf() == 1/(double(1<<30)*(1<<22))) << std::endl; ) // DEBUG if (i != 54) { return false; From 85c6b3b3b64b8a9f25419e31868581ba7ac12d2c Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 3 Mar 2021 19:57:51 +0900 Subject: [PATCH 088/178] Revert PMP example --- .../corefinement_polyhedron_union.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp index d337bdf637a..71bdd4cd2f7 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/corefinement_polyhedron_union.cpp @@ -1,5 +1,4 @@ -// #include -#include +#include #include #include @@ -9,8 +8,7 @@ #include #include -// typedef CGAL::Exact_predicates_inexact_constructions_kernel K; -typedef CGAL::Exact_predicates_exact_constructions_kernel K; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Polyhedron_3 Mesh; namespace PMP = CGAL::Polygon_mesh_processing; From 4a6706755dc3f23e9428004f774c2f882c563cb4 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 3 Mar 2021 19:58:56 +0900 Subject: [PATCH 089/178] Cleanup --- .../examples/Polygon_mesh_processing/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 3615a74a4ef..e34c91b8892 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -76,7 +76,6 @@ create_single_source_cgal_program("corefinement_SM.cpp") create_single_source_cgal_program("corefinement_consecutive_bool_op.cpp") create_single_source_cgal_program("corefinement_difference_remeshed.cpp") create_single_source_cgal_program("corefinement_mesh_union.cpp") -create_single_source_cgal_program("cgal.cc") create_single_source_cgal_program( "corefinement_mesh_union_and_intersection.cpp") create_single_source_cgal_program("corefinement_mesh_union_with_attributes.cpp") From 62d1f6b0f02397230fb3f118c8fcb8353c64c590 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 3 Mar 2021 20:29:21 +0900 Subject: [PATCH 090/178] Revert out-of-scope fix --- .../CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h index 1c437177712..14fc74d8490 100644 --- a/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h +++ b/Triangulation_3/include/CGAL/Delaunay_triangulation_cell_base_with_circumcenter_3.h @@ -130,7 +130,7 @@ public: circumcenter_ = new Point(this->Cb::circumcenter(gt)); } else { CGAL_expensive_assertion( - this->Cb::circumcenter(gt) == *circumcenter_); + this->Cb::circumcenter(gt) == *circumcenter); } return *circumcenter_; From 2ac977b7c5df414979a515033bb07c0d16cc02de Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 13:21:24 +0000 Subject: [PATCH 091/178] Early exit in do_intersect of Sphere/Bbox_3 --- .../internal/Bbox_3_Sphere_3_do_intersect.h | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h index b15270e5294..49eaf967ad5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h @@ -35,39 +35,59 @@ namespace internal { typedef typename K::Point_3 Point; FT d = FT(0); FT distance = FT(0); + FT sr = sphere.squared_radius(); + Point center = sphere.center(); if(center.x() < (FT)bbox.xmin()) { d = (FT)bbox.xmin() - center.x(); - distance += d * d; + d = square(d); + if(d > sr){ + return false; + } + distance = d; } else if(center.x() > (FT)bbox.xmax()) { d = center.x() - (FT)bbox.xmax(); - distance += d * d; + d = square(d); + if(d > sr){ + return false; + } + distance = d; } if(center.y() < (FT)bbox.ymin()) { d = (FT)bbox.ymin() - center.y(); - distance += d * d; + d = square(d); + if(d > sr){ + return false; + } + distance += d ; } else if(center.y() > (FT)bbox.ymax()) { d = center.y() - (FT)bbox.ymax(); - distance += d * d; + d = square(d); + if(d > sr){ + return false; + } + distance += d; } if(center.z() < (FT)bbox.zmin()) { d = (FT)bbox.zmin() - center.z(); - distance += d * d; + d = square(d); + distance += d; } else if(center.z() > (FT)bbox.zmax()) { d = center.z() - (FT)bbox.zmax(); - distance += d * d; + d = square(d); + distance += d; } // For unknown reason this causes a syntax error on VC2005 @@ -87,7 +107,7 @@ namespace internal { // } //} - return distance <= sphere.squared_radius(); + return distance <= sr; } template From 82e5b3a02d51ec2ce672bc00736799a80ba3c809 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 14:23:56 +0000 Subject: [PATCH 092/178] Do not collect in a vector per patch, but do the tests directly (@janetournois please double-check this commit) --- .../Isotropic_remeshing/remesh_impl.h | 39 ++++++------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index ce1636b62d0..edb6f3e0dbc 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -1885,8 +1886,8 @@ private: bool check_normals(const HalfedgeRange& hedges) const { std::size_t nb_patches = patch_id_to_index_map.size(); + std::vector > normal_per_patch(nb_patches,boost::none); - std::vector< std::vector > normals_per_patch(nb_patches); for(halfedge_descriptor hd : hedges) { Halfedge_status s = status(hd); @@ -1898,18 +1899,15 @@ private: if (n == CGAL::NULL_VECTOR) //for degenerate faces continue; Patch_id pid = get_patch_id(face(hd, mesh_)); - normals_per_patch[patch_id_to_index_map.at(pid)].push_back(n); - } - - //on each surface patch, - //check all normals have same orientation - for (std::size_t i=0; i < nb_patches; ++i) - { - const std::vector& normals = normals_per_patch[i]; - if (normals.empty()) continue; - - if (!check_orientation(normals)) - return false; + std::size_t index = patch_id_to_index_map.at(pid); + if(normal_per_patch[index]){ + const Vector_3& vec = *normal_per_patch[index]; + double dot = to_double(n * vec); + if (dot <= 0.){ + return false; + } + } + normal_per_patch[index] = boost::make_optional(n); } return true; } @@ -1922,20 +1920,7 @@ private: Vector_3 no = compute_normal(face(opposite(h, mesh_), mesh_)); return n * no > 0.; } - - bool check_orientation(const std::vector& normals) const - { - if (normals.size() < 2) - return true; - for (std::size_t i = 1; i < normals.size(); ++i)/*start at 1 on purpose*/ - { - double dot = to_double(normals[i - 1] * normals[i]); - if (dot <= 0.) - return false; - } - return true; - } - + public: const Triangle_list& input_triangles() const { return input_triangles_; From dad0287b69b5b347b1c687f8fc363b343bc42f73 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 14:34:56 +0000 Subject: [PATCH 093/178] Remove trailing whitespace --- .../internal/Isotropic_remeshing/remesh_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index edb6f3e0dbc..d0bd9bf2a00 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -1920,7 +1920,7 @@ private: Vector_3 no = compute_normal(face(opposite(h, mesh_), mesh_)); return n * no > 0.; } - + public: const Triangle_list& input_triangles() const { return input_triangles_; From e7f18dff56952c7a3e4999eac4ae0fd14fff3eaa Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 15:00:59 +0000 Subject: [PATCH 094/178] No need for calling abs for a squared distance --- .../include/CGAL/internal/Static_filters/Do_intersect_3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index 92cbd3ebf3f..88875d6d311 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -245,18 +245,17 @@ public: } double double_tmp_result = (distance - ssr); - double max2 = CGAL::abs(ssr); - if ((max1 < 3.33558365626356687717e-147) || (max2 < 1.11261183279326254436e-293)){ + if ((max1 < 3.33558365626356687717e-147) || (ssr < 1.11261183279326254436e-293)){ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - if ((max1 > 1.67597599124282407923e+153) || (max2 > 2.80889552322236673473e+306)){ + if ((max1 > 1.67597599124282407923e+153) || (ssr > 2.80889552322236673473e+306)){ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - double eps = 1.99986535548615598560e-15 * (std::max) (max2, (max1 * max1)); + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); if (double_tmp_result > eps) return false; @@ -265,6 +264,7 @@ public: if (double_tmp_result < -eps) return true; else { + return true; // AF: just to test conservative approach CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } From 431c5b81322801ad6740c68987d65d2bca1a7e3a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 15:02:13 +0000 Subject: [PATCH 095/178] Comment something experimental that sneaked in --- .../include/CGAL/internal/Static_filters/Do_intersect_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index 88875d6d311..9c09fe2ecb3 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -264,7 +264,7 @@ public: if (double_tmp_result < -eps) return true; else { - return true; // AF: just to test conservative approach + // return true; // AF: just to test conservative approach CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } From 7785a9c2b142e2034811b7bd8a47ae2864581ef0 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 15:25:30 +0000 Subject: [PATCH 096/178] Use certainly() --- .../internal/Bbox_3_Sphere_3_do_intersect.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h index 49eaf967ad5..7f74ddf1c8e 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h @@ -43,7 +43,7 @@ namespace internal { { d = (FT)bbox.xmin() - center.x(); d = square(d); - if(d > sr){ + if(certainly(d > sr)){ return false; } distance = d; @@ -52,7 +52,7 @@ namespace internal { { d = center.x() - (FT)bbox.xmax(); d = square(d); - if(d > sr){ + if(certainly(d > sr)){ return false; } distance = d; @@ -62,7 +62,7 @@ namespace internal { { d = (FT)bbox.ymin() - center.y(); d = square(d); - if(d > sr){ + if(certainly(d > sr)){ return false; } distance += d ; @@ -71,7 +71,7 @@ namespace internal { { d = center.y() - (FT)bbox.ymax(); d = square(d); - if(d > sr){ + if(certainly(d > sr)){ return false; } distance += d; From 71bfcce226bab9ab8bcdcdabe20723a338fd25a4 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Thu, 4 Mar 2021 00:26:36 +0900 Subject: [PATCH 097/178] Keep CGAL_IA_FORCE_TO_DOUBLE for the normal case --- Number_types/include/CGAL/FPU.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 501b63999a9..8d610586960 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -359,7 +359,7 @@ inline double CGAL_IA_UP(double d) { // In round-upward mode we can rely on the hardware // to do the job. - return d; + return CGAL_IA_FORCE_TO_DOUBLE(d); } #endif #define CGAL_IA_ADD(a,b) CGAL_IA_UP((a)+CGAL_IA_STOP_CPROP(b)) From 4fab8430dad1506bc6c7eb36c0f4dbb993a81e55 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 3 Mar 2021 21:14:39 +0000 Subject: [PATCH 098/178] Add static filter for Equal_3::operator()(Vector_3, Null_vector) --- .../CGAL/internal/Static_filters/Equal_3.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Equal_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Equal_3.h index 102199d5633..d4e3c3099ed 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Equal_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Equal_3.h @@ -82,6 +82,24 @@ public: return Base::operator()(p, q); } + + result_type operator()(const Vector_3 &p, const Null_vector &q) const + { + CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") + + std::string(CGAL_PRETTY_FUNCTION), tmp); + + Get_approx get_approx; // Identity functor for all points + // but lazy points + double px, py, pz; + + if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) && + fit_in_double(get_approx(p).z(), pz) ) + { + CGAL_BRANCH_PROFILER_BRANCH(tmp); + return px == 0 && py == 0 && pz == 0; + } + return Base::operator()(p, q); + } }; // end class Equal_3 } // end namespace Static_filters_predicates From e545fcf624a9489c8a609c01bcdb19000b72f700 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Thu, 4 Mar 2021 09:51:04 +0900 Subject: [PATCH 099/178] Clean up sqrt. --- Number_types/include/CGAL/FPU.h | 40 +++++++++++++++---------- Number_types/include/CGAL/Interval_nt.h | 10 ++----- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 8d610586960..85d03e09c10 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -346,34 +346,27 @@ inline double IA_bug_sqrt(double d) // With GCC, we can do slightly better : test with __builtin_constant_p() // that both arguments are constant before stopping one of them. // Use inline functions instead ? -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST -inline double CGAL_IA_UP(double d) +inline double IA_up(double d) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST // In round-to-nearest mode we find the successor instead. // This preserves the interval invariants, but is more // expensive and conservative. return nextafter(d, std::numeric_limits::infinity()); -} #else -inline double CGAL_IA_UP(double d) -{ // In round-upward mode we can rely on the hardware // to do the job. return CGAL_IA_FORCE_TO_DOUBLE(d); -} #endif -#define CGAL_IA_ADD(a,b) CGAL_IA_UP((a)+CGAL_IA_STOP_CPROP(b)) -#define CGAL_IA_SUB(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)-(b)) -#define CGAL_IA_MUL(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)*CGAL_IA_STOP_CPROP(b)) -#define CGAL_IA_DIV(a,b) CGAL_IA_UP(CGAL_IA_STOP_CPROP(a)/CGAL_IA_STOP_CPROP(b)) +} +#define CGAL_IA_ADD(a,b) IA_up((a)+CGAL_IA_STOP_CPROP(b)) +#define CGAL_IA_SUB(a,b) IA_up(CGAL_IA_STOP_CPROP(a)-(b)) +#define CGAL_IA_MUL(a,b) IA_up(CGAL_IA_STOP_CPROP(a)*CGAL_IA_STOP_CPROP(b)) +#define CGAL_IA_DIV(a,b) IA_up(CGAL_IA_STOP_CPROP(a)/CGAL_IA_STOP_CPROP(b)) inline double CGAL_IA_SQUARE(double a){ double b = CGAL_IA_STOP_CPROP(a); // only once - return CGAL_IA_UP(b*b); + return IA_up(b*b); } -#define CGAL_IA_SQRT(a) \ - CGAL_IA_UP(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) - - #if defined CGAL_SAFE_SSE2 #define CGAL_IA_SETFPCW(CW) _MM_SET_ROUNDING_MODE(CW) @@ -602,6 +595,23 @@ inline void force_ieee_double_precision() #endif } +// Implementation (not part of the user interface) + +inline double IA_sqrt_up(double a) { + return IA_up(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))); +} + +inline double IA_sqrt_toward_zero(double d) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + return (d > 0.0) ? nextafter(std::sqrt(d), 0.) : 0.0; +#else + FPU_set_cw(CGAL_FE_DOWNWARD); + double i = (d > 0.0) ? CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(d)) : 0.0; + FPU_set_cw(CGAL_FE_UPWARD); + return i; +#endif +} + } //namespace CGAL #ifdef CGAL_HEADER_ONLY diff --git a/Number_types/include/CGAL/Interval_nt.h b/Number_types/include/CGAL/Interval_nt.h index 1eeb2a56e73..690f1cc4c74 100644 --- a/Number_types/include/CGAL/Interval_nt.h +++ b/Number_types/include/CGAL/Interval_nt.h @@ -1147,15 +1147,9 @@ namespace INTERN_INTERVAL_NT { // - compute x = CGAL_IA_SQRT(d.inf()) // - compute y = CGAL_IA_SQUARE(x) // - if y==d.inf() use x, else use -CGAL_IA_SUB(CGAL_IA_MIN_DOUBLE,x) -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - double i = (d.inf() > 0.0) ? nextafter(std::sqrt(d.inf()), 0.) : 0.0; -#else // no CGAL_ALWAYS_ROUND_TO_NEAREST - FPU_set_cw(CGAL_FE_DOWNWARD); - double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0; - FPU_set_cw(CGAL_FE_UPWARD); -#endif // no CGAL_ALWAYS_ROUND_TO_NEAREST + double i = IA_sqrt_toward_zero(d.inf()); #endif // no __AVX512F__ - return Interval_nt(i, CGAL_IA_SQRT(d.sup())); + return Interval_nt(i, IA_sqrt_up(d.sup())); } template From 2e3bfa8743a9721abd4be13f3e271af5f2f0eb7c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 4 Mar 2021 09:27:05 +0000 Subject: [PATCH 100/178] Reduce calls to target @sloriot please double check the correctness --- .../CGAL/Polygon_mesh_processing/compute_normal.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h index bfb8f831238..0f5840f6667 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/compute_normal.h @@ -91,12 +91,16 @@ void sum_normals(const PM& pmesh, halfedge_descriptor he = halfedge(f, pmesh); vertex_descriptor v = source(he, pmesh); + vertex_descriptor the = target(he,pmesh); + he = next(he, pmesh); + vertex_descriptor tnhe = target(he,pmesh); + const Point_ref pv = get(vpmap, v); - while(v != target(next(he, pmesh), pmesh)) + while(v != tnhe) { - const Point_ref pvn = get(vpmap, target(he, pmesh)); - const Point_ref pvnn = get(vpmap, target(next(he, pmesh), pmesh)); + const Point_ref pvn = get(vpmap, the); + const Point_ref pvnn = get(vpmap, tnhe); const Vector n = internal::triangle_normal(pv, pvn, pvnn, traits); @@ -107,7 +111,9 @@ void sum_normals(const PM& pmesh, sum = traits.construct_sum_of_vectors_3_object()(sum, n); + the = tnhe; he = next(he, pmesh); + tnhe = target(he,pmesh); } } From 45265a7e342955f498a062ffb9845c532efd119b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 4 Mar 2021 10:46:46 +0000 Subject: [PATCH 101/178] Replace vector with optional by two vectors. No idea what is better yet --- .../internal/Isotropic_remeshing/remesh_impl.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index d0bd9bf2a00..e2399b115e7 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -1886,7 +1886,9 @@ private: bool check_normals(const HalfedgeRange& hedges) const { std::size_t nb_patches = patch_id_to_index_map.size(); - std::vector > normal_per_patch(nb_patches,boost::none); + //std::vector > normal_per_patch(nb_patches,boost::none); + std::vector initialized(nb_patches,false); + std::vector normal_per_patch(nb_patches); for(halfedge_descriptor hd : hedges) { @@ -1900,14 +1902,17 @@ private: continue; Patch_id pid = get_patch_id(face(hd, mesh_)); std::size_t index = patch_id_to_index_map.at(pid); - if(normal_per_patch[index]){ - const Vector_3& vec = *normal_per_patch[index]; + //if(normal_per_patch[index]){ + if(initialized[index]){ + const Vector_3& vec = normal_per_patch[index]; double dot = to_double(n * vec); if (dot <= 0.){ return false; } } - normal_per_patch[index] = boost::make_optional(n); + //normal_per_patch[index] = boost::make_optional(n); + normal_per_patch[index] = n; + initialized[index] = true; } return true; } From 04e7d8281d82b7da9d1370d2bc3f7be226c1648e Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 4 Mar 2021 12:08:45 +0100 Subject: [PATCH 102/178] link with TBB --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 5d17d1a1dbf..9bfe5fd85a0 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -177,6 +177,7 @@ if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) mesh_3D_image mesh_3D_image_variable_size mesh_3D_image_with_custom_initialization + mesh_3D_gray_image_with_custom_initialization mesh_3D_image_with_features mesh_implicit_domains mesh_implicit_sphere From 0f573cd1806dca324146d3001852a234fe4c7159 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Fri, 5 Mar 2021 23:46:24 +0900 Subject: [PATCH 103/178] Prevent CGAL_USE_SSE2 with CGAL_ALWAYS_ROUND_TO_NEAREST --- Number_types/include/CGAL/FPU.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 85d03e09c10..f876ac3c46b 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -114,9 +114,13 @@ extern "C" { // Only define CGAL_USE_SSE2 for 64 bits where malloc has a suitable // alignment, 32 bits is too dangerous. -#if defined(CGAL_HAS_SSE2) && (defined(__x86_64__) || defined(_M_X64)) +#if defined CGAL_HAS_SSE2 +#if defined __x86_64__ || defined _M_X64 +#if !defined CGAL_ALWAYS_ROUND_TO_NEAREST # define CGAL_USE_SSE2 1 #endif +#endif +#endif #ifdef CGAL_CFG_DENORMALS_COMPILE_BUG double& get_static_minimin(); // Defined in Interval_arithmetic_impl.h #endif From bb67237b5b7dea9df81d52a26ec0943b45050e8f Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Sat, 6 Mar 2021 00:22:52 +0900 Subject: [PATCH 104/178] Style --- Number_types/include/CGAL/FPU.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index f876ac3c46b..36e458bc969 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -114,13 +114,11 @@ extern "C" { // Only define CGAL_USE_SSE2 for 64 bits where malloc has a suitable // alignment, 32 bits is too dangerous. -#if defined CGAL_HAS_SSE2 -#if defined __x86_64__ || defined _M_X64 -#if !defined CGAL_ALWAYS_ROUND_TO_NEAREST +#if defined CGAL_HAS_SSE2 && \ + (defined __x86_64__ || defined _M_X64) && \ + !defined CGAL_ALWAYS_ROUND_TO_NEAREST # define CGAL_USE_SSE2 1 #endif -#endif -#endif #ifdef CGAL_CFG_DENORMALS_COMPILE_BUG double& get_static_minimin(); // Defined in Interval_arithmetic_impl.h #endif From b1c2dd8db67f5149c6080a91359ad3a81d38b5bc Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Sun, 7 Mar 2021 18:25:18 +0000 Subject: [PATCH 105/178] WIP: early exit in the static filter --- AABB_tree/include/CGAL/AABB_traits.h | 20 +++ .../internal/Static_filters/Do_intersect_3.h | 132 +++++++++++++++++- .../isotropic_remeshing_example.cpp | 23 ++- 3 files changed, 169 insertions(+), 6 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 613d08c174b..1a3fdde1055 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -423,6 +423,26 @@ public: CGAL::SMALLER : CGAL::LARGER; } + /* + template <> + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& pr, const Point& bound) const + { + return GeomTraits().do_intersect_3_object() + (GeomTraits().construct_sphere_3_object() + (p, GeomTraits().compute_squared_distance_3_object()(p, bound)).bbox(), pr)? + CGAL::SMALLER : CGAL::LARGER; + } + + template <> + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& pr, const FT& sq_distance) const + { + return GeomTraits().do_intersect_3_object() + (GeomTraits().construct_sphere_3_object()(p, sq_distance).bbox(), + pr) ? + CGAL::SMALLER : + CGAL::LARGER; + } + */ }; Closest_point closest_point_object() const {return Closest_point(*this);} diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index 9c09fe2ecb3..8c899a32c18 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -192,6 +192,10 @@ public: { CGAL_BRANCH_PROFILER_BRANCH_1(tmp); + if ((ssr < 1.11261183279326254436e-293) || (ssr > 2.80889552322236673473e+306)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } double distance = 0; double max1 = 0; @@ -201,6 +205,25 @@ public: max1 = bxmin_scx; distance = square(bxmin_scx); +#ifdef EARLY + { + double double_tmp_result = (distance - ssr); + + if (max1 < 3.33558365626356687717e-147){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + if (max1 > 1.67597599124282407923e+153){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps) + return false; + } +#endif } else if(scx > bxmax) { @@ -208,8 +231,31 @@ public: max1 = scx_bxmax; distance = square(scx_bxmax); +#ifdef EARLY + { + double double_tmp_result = (distance - ssr); + + if (max1 < 3.33558365626356687717e-147){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + if (max1 > 1.67597599124282407923e+153){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps) + return false; + } +#endif } + + + + if(scy < bymin) { double bymin_scy = bymin - scy; @@ -217,6 +263,25 @@ public: max1 = bymin_scy; distance += square(bymin_scy); +#ifdef EARLY + { + double double_tmp_result = (distance - ssr); + + if (max1 < 3.33558365626356687717e-147){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + if ((max1 > 1.67597599124282407923e+153)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps) + return false; + } +#endif } else if(scy > bymax) { @@ -225,6 +290,26 @@ public: max1 = scy_bymax; distance += square(scy_bymax); +#ifdef EARLY + + { + double double_tmp_result = (distance - ssr); + + if ((max1 < 3.33558365626356687717e-147)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + if ((max1 > 1.67597599124282407923e+153)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps) + return false; + } +#endif } if(scz < bzmin) @@ -234,6 +319,25 @@ public: max1 = bzmin_scz; distance += square(bzmin_scz); +#ifdef EARLY + { + double double_tmp_result = (distance - ssr); + + if ((max1 < 3.33558365626356687717e-147)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + if ((max1 > 1.67597599124282407923e+153)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps) + return false; + } +#endif } else if(scz > bzmax) { @@ -242,19 +346,39 @@ public: max1 = scz_bzmax; distance += square(scz_bzmax); +#ifdef EARLY + { + double double_tmp_result = (distance - ssr); + + if ((max1 < 3.33558365626356687717e-147)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + if ((max1 > 1.67597599124282407923e+153)){ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + + double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps) + return false; + } +#endif } double double_tmp_result = (distance - ssr); - if ((max1 < 3.33558365626356687717e-147) || (ssr < 1.11261183279326254436e-293)){ +#ifndef EARLY + if (max1 < 3.33558365626356687717e-147){ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - if ((max1 > 1.67597599124282407923e+153) || (ssr > 2.80889552322236673473e+306)){ + if (max1 > 1.67597599124282407923e+153){ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - +#endif double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); if (double_tmp_result > eps) @@ -264,7 +388,7 @@ public: if (double_tmp_result < -eps) return true; else { - // return true; // AF: just to test conservative approach + return true; // AF: just to test conservative approach CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp index c5811a87d2b..bb246a9393c 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp @@ -1,6 +1,7 @@ +#define EARLY #include #include - +#include #include #include #include @@ -9,6 +10,7 @@ #include #include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Surface_mesh Mesh; @@ -35,6 +37,9 @@ int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/pig.off"; + CGAL::Timer t; + t.start(); + Mesh mesh; if(!PMP::read_polygon_mesh(filename, mesh) || !CGAL::is_triangle_mesh(mesh)) { @@ -42,7 +47,10 @@ int main(int argc, char* argv[]) return 1; } - double target_edge_length = 0.04; + std::cout << "Read: " << t.time() << " sec" << std::endl; + t.reset(); + + double target_edge_length = (argc > 2) ? std::stod(std::string(argv[2])) : 1.0; unsigned int nb_iter = 3; std::cout << "Split border..."; @@ -53,6 +61,9 @@ int main(int argc, char* argv[]) std::cout << "done." << std::endl; + std::cout << "took " << t.time() << " sec" << std::endl; + t.reset(); + std::cout << "Start remeshing of " << filename << " (" << num_faces(mesh) << " faces)..." << std::endl; @@ -62,5 +73,13 @@ int main(int argc, char* argv[]) std::cout << "Remeshing done." << std::endl; + std::cout << "took " << t.time() << " sec" << std::endl; + t.reset(); + + std::ofstream out("out.off"); + out.precision(17); + //out << mesh << std::endl; + out.close(); + return 0; } From 5b7a78d84c929b0b7a8f50b4364176cb21a8426c Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Tue, 9 Mar 2021 18:20:23 +0900 Subject: [PATCH 106/178] Assert mode instead of setting & update tests --- Number_types/include/CGAL/FPU.h | 15 ++++++ .../test/Number_types/Interval_nt.cpp | 50 +++++-------------- .../test/Number_types/Interval_nt_nearest.cpp | 2 + 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 36e458bc969..68ad6a98a47 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -486,9 +486,15 @@ inline FPU_CW_t FPU_get_cw (void) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + FPU_CW_t cw; + CGAL_assertion((CGAL_IA_GETFPCW(cw), cw == CGAL_FE_TONEAREST)); + return CGAL_FE_TONEAREST; +#else FPU_CW_t cw; CGAL_IA_GETFPCW(cw); return cw; +#endif } // User interface (cont): @@ -497,16 +503,25 @@ inline void FPU_set_cw (FPU_CW_t cw) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_assertion(cw == CGAL_FE_TONEAREST); +#else CGAL_IA_SETFPCW(cw); +#endif } inline FPU_CW_t FPU_get_and_set_cw (FPU_CW_t cw) { +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + CGAL_assertion(cw == CGAL_FE_TONEAREST); + return CGAL_FE_TONEAREST; +#else FPU_CW_t old = FPU_get_cw(); FPU_set_cw(cw); return old; +#endif } diff --git a/Number_types/test/Number_types/Interval_nt.cpp b/Number_types/test/Number_types/Interval_nt.cpp index b2e9b512dfa..0d771f8b6cf 100644 --- a/Number_types/test/Number_types/Interval_nt.cpp +++ b/Number_types/test/Number_types/Interval_nt.cpp @@ -31,7 +31,11 @@ bool spiral_test() break; }; +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST + return i == 365; +#else return i == 396; +#endif } // Tests for constant propagation through intervals. @@ -45,62 +49,34 @@ bool cprop_test() // Testing cprop through +. IA_nt add = IA_nt(0.00001)+10.1; bool good_add = !add.is_point(); -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - if (good_add) - std::cerr << "ERROR : No constant propagation through operator+." < 2/(double(1<<30)*(1<<22))) { + if (a.sup() > 3/(double(1<<30)*(1<<22))) { return false; } - if (-2/(double(1<<30)*(1<<22)) > a.inf()) { + if (-3/(double(1<<30)*(1<<22)) > a.inf()) { return false; } return true; @@ -188,12 +164,12 @@ bool overflow_test() DEBUG( std::cout << "f = " << f << std::endl; ) } -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST +#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST_XX return a.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && b.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && - c.is_same(IA_nt(-std::numeric_limits::infinity(), std::numeric_limits::infinity())) && - d.is_same(IA_nt(-std::numeric_limits::infinity(), std::numeric_limits::infinity())) && - e.is_same(IA_nt(-std::numeric_limits::infinity(), std::numeric_limits::infinity())) && + c.is_same(IA_nt::largest()) && + d.is_same(IA_nt::largest()) && + e.is_same(IA_nt::largest()) && f.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && g.is_same(-f); #else @@ -224,9 +200,9 @@ bool underflow_test() for (i=0; i<20; i++) c = CGAL_NTS square(c); #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - return a.is_same(IA_nt(0, 0)) - && b.is_same(IA_nt(0, 0)) - && c.is_same(IA_nt(0, 0)); + return a.is_same(IA_nt(-CGAL_IA_MIN_DOUBLE, CGAL_IA_MIN_DOUBLE)) + && b.is_same(IA_nt::smallest()) + && c.is_same(IA_nt(0, CGAL_IA_MIN_DOUBLE)); #else return a.is_same(IA_nt(0, CGAL_IA_MIN_DOUBLE)) && b.is_same(IA_nt::smallest()) diff --git a/Number_types/test/Number_types/Interval_nt_nearest.cpp b/Number_types/test/Number_types/Interval_nt_nearest.cpp index fe5ce657c6e..c2ae592c57f 100644 --- a/Number_types/test/Number_types/Interval_nt_nearest.cpp +++ b/Number_types/test/Number_types/Interval_nt_nearest.cpp @@ -1,2 +1,4 @@ #define CGAL_ALWAYS_ROUND_TO_NEAREST +#define CGAL_DEBUG +#define CGAL_CHECK_EXPENSIVE #include "Interval_nt.cpp" From a3a610ba511a50cfa645d00f59ab3e812fea57d2 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Tue, 9 Mar 2021 19:43:47 +0900 Subject: [PATCH 107/178] Avoid warnings with NDEBUG --- Number_types/include/CGAL/FPU.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 68ad6a98a47..8e724756917 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -487,8 +487,8 @@ FPU_CW_t FPU_get_cw (void) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST - FPU_CW_t cw; - CGAL_assertion((CGAL_IA_GETFPCW(cw), cw == CGAL_FE_TONEAREST)); + CGAL_assertion_code(FPU_CW_t cw; CGAL_IA_GETFPCW(cw);) + CGAL_assertion(cw == CGAL_FE_TONEAREST); return CGAL_FE_TONEAREST; #else FPU_CW_t cw; From 643810f310f4df42c48b68fe410560866f8db006 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 9 Mar 2021 13:15:49 +0000 Subject: [PATCH 108/178] WIP for not hard coding conservative. Todo: Use of Has_filtered --- AABB_tree/include/CGAL/AABB_traits.h | 27 ++++++------------- .../internal/Static_filters/Do_intersect_3.h | 8 ++++-- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 1a3fdde1055..6bcf44a18af 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -414,6 +414,14 @@ public: CGAL::SMALLER : CGAL::LARGER; } + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const + { + return GeomTraits().do_intersect_3_object() + (GeomTraits().construct_sphere_3_object() + (p, GeomTraits().compute_squared_distance_3_object()(p, bound)), bb,true)? + CGAL::SMALLER : CGAL::LARGER; + } + template CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const { @@ -423,26 +431,7 @@ public: CGAL::SMALLER : CGAL::LARGER; } - /* - template <> - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& pr, const Point& bound) const - { - return GeomTraits().do_intersect_3_object() - (GeomTraits().construct_sphere_3_object() - (p, GeomTraits().compute_squared_distance_3_object()(p, bound)).bbox(), pr)? - CGAL::SMALLER : CGAL::LARGER; - } - template <> - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& pr, const FT& sq_distance) const - { - return GeomTraits().do_intersect_3_object() - (GeomTraits().construct_sphere_3_object()(p, sq_distance).bbox(), - pr) ? - CGAL::SMALLER : - CGAL::LARGER; - } - */ }; Closest_point closest_point_object() const {return Closest_point(*this);} diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index 8c899a32c18..d09972a871a 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -168,9 +168,11 @@ public: return this->operator()(s, b); } + // The parameter overestimate is used to avoid a filter failure in AABB_tree::closest_point() result_type - operator()(const Sphere_3 &s, const Bbox_3& b) const + operator()(const Sphere_3 &s, const Bbox_3& b, bool overestimate = false) const { + std::cout << "." << std::flush; CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); @@ -388,7 +390,9 @@ public: if (double_tmp_result < -eps) return true; else { - return true; // AF: just to test conservative approach + if(overestimate){ + return true; + } CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } From 9274503f125ad0082ca101e0f2055a9ce19b9276 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 9 Mar 2021 13:18:50 +0000 Subject: [PATCH 109/178] remove debug code --- .../include/CGAL/internal/Static_filters/Do_intersect_3.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index d09972a871a..f5149d93f15 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -172,7 +172,6 @@ public: result_type operator()(const Sphere_3 &s, const Bbox_3& b, bool overestimate = false) const { - std::cout << "." << std::flush; CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); From cea8cca6af0be8e1bfc8974b6540a78a008fe02f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 9 Mar 2021 15:45:18 +0000 Subject: [PATCH 110/178] WIP: less computations of degree --- .../Isotropic_remeshing/remesh_impl.h | 50 +++++++++++++++++-- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index e2399b115e7..551c1294cfa 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -826,6 +827,22 @@ namespace internal { #ifdef CGAL_PMP_REMESHING_VERBOSE std::cout << "Equalize valences..." << std::endl; #endif + +#define VALE +#ifdef VALE + typedef typename boost::property_map >::type Vertex_degree; + Vertex_degree degree = get(CGAL::dynamic_vertex_property_t(), mesh_); + + for(vertex_descriptor v : vertices(mesh_)){ + put(degree,v,0); + } + for(halfedge_descriptor h : halfedges(mesh_)) + { + vertex_descriptor t = target(h, mesh_); + put(degree, t, get(degree,t)+1); + } +#endif + unsigned int nb_flips = 0; for(edge_descriptor e : edges(mesh_)) { @@ -838,11 +855,17 @@ namespace internal { vertex_descriptor vb = target(he, mesh_); vertex_descriptor vc = target(next(he, mesh_), mesh_); vertex_descriptor vd = target(next(opposite(he, mesh_), mesh_), mesh_); - - int vva = valence(va), tvva = target_valence(va); - int vvb = valence(vb), tvvb = target_valence(vb); - int vvc = valence(vc), tvvc = target_valence(vc); - int vvd = valence(vd), tvvd = target_valence(vd); +#ifdef VALE + int vva = get(degree,va), tvva = target_valence(va); + int vvb = get(degree, vb), tvvb = target_valence(vb); + int vvc = get(degree,vc), tvvc = target_valence(vc); + int vvd = get(degree,vd), tvvd = target_valence(vd); +#else + int vva = valence(va), tvva = target_valence(va); + int vvb = valence( vb), tvvb = target_valence(vb); + int vvc = valence(vc), tvvc = target_valence(vc); + int vvd = valence(vd), tvvd = target_valence(vd); +#endif int deviation_pre = CGAL::abs(vva - tvva) + CGAL::abs(vvb - tvvb) + CGAL::abs(vvc - tvvc) @@ -860,6 +883,12 @@ namespace internal { vvb -= 1; vvc += 1; vvd += 1; +#ifdef VALE + put(degree, va, vva); + put(degree, vb, vvb); + put(degree, vc, vvc); + put(degree, vd, vvd); +#endif ++nb_flips; #ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS @@ -895,6 +924,17 @@ namespace internal { CGAL_assertion( is_flip_topologically_allowed(edge(he, mesh_)) ); CGAL_assertion( !get(ecmap_, edge(he, mesh_)) ); CGAL::Euler::flip_edge(he, mesh_); +#ifdef VALE + vva += 1; + vvb += 1; + vvc -= 1; + vvd -= 1; + + put(degree, va, vva); + put(degree, vb, vvb); + put(degree, vc, vvc); + put(degree, vd, vvd); +#endif --nb_flips; CGAL_assertion_code(Halfedge_status s3 = status(he)); From d6d5fd26054250adf81441d0b2af2107c250b8c2 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Wed, 10 Mar 2021 09:11:44 +0900 Subject: [PATCH 111/178] Clean up test code --- Number_types/test/Number_types/Interval_nt.cpp | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Number_types/test/Number_types/Interval_nt.cpp b/Number_types/test/Number_types/Interval_nt.cpp index 0d771f8b6cf..7af20f02874 100644 --- a/Number_types/test/Number_types/Interval_nt.cpp +++ b/Number_types/test/Number_types/Interval_nt.cpp @@ -164,15 +164,6 @@ bool overflow_test() DEBUG( std::cout << "f = " << f << std::endl; ) } -#ifdef CGAL_ALWAYS_ROUND_TO_NEAREST_XX - return a.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && - b.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && - c.is_same(IA_nt::largest()) && - d.is_same(IA_nt::largest()) && - e.is_same(IA_nt::largest()) && - f.is_same(IA_nt(std::numeric_limits::infinity(), std::numeric_limits::infinity())) && - g.is_same(-f); -#else return a.is_same(IA_nt(CGAL_IA_MAX_DOUBLE, std::numeric_limits::infinity())) && b.is_same(IA_nt(CGAL_IA_MAX_DOUBLE, std::numeric_limits::infinity())) && c.is_same(IA_nt::largest()) && @@ -180,7 +171,6 @@ bool overflow_test() e.is_same(IA_nt::largest()) && f.is_same(IA_nt(CGAL_IA_MAX_DOUBLE, std::numeric_limits::infinity())) && g.is_same(-f); -#endif } From b5239161c46576daccc7d37b991c43974c656f27 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 10 Mar 2021 10:51:24 +0000 Subject: [PATCH 112/178] Check that the kernel has static filters --- AABB_tree/include/CGAL/AABB_traits.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 6bcf44a18af..78959df857b 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -414,7 +414,7 @@ public: CGAL::SMALLER : CGAL::LARGER; } - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true&) const { return GeomTraits().do_intersect_3_object() (GeomTraits().construct_sphere_3_object() @@ -422,6 +422,19 @@ public: CGAL::SMALLER : CGAL::LARGER; } + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_false&) const + { + return GeomTraits().do_intersect_3_object() + (GeomTraits().construct_sphere_3_object() + (p, GeomTraits().compute_squared_distance_3_object()(p, bound)), bb)? + CGAL::SMALLER : CGAL::LARGER; + } + + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const + { + return (*this)(p, bb, bound, typename GeomTraits::Has_filtered_predicates_tag()); + } + template CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const { From ae7559442ad43c682e459d153c4eef0b2425a6ff Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 13:54:09 +0100 Subject: [PATCH 113/178] Remove operator>> and << from `File_header_OFF_extended`. --- .../CGAL/IO/OFF/File_header_OFF_impl.h | 9 +-- .../IO/OFF/File_header_extended_OFF_impl.h | 67 ------------------- 2 files changed, 2 insertions(+), 74 deletions(-) diff --git a/Stream_support/include/CGAL/IO/OFF/File_header_OFF_impl.h b/Stream_support/include/CGAL/IO/OFF/File_header_OFF_impl.h index 520e6abe76d..4e5d776b261 100644 --- a/Stream_support/include/CGAL/IO/OFF/File_header_OFF_impl.h +++ b/Stream_support/include/CGAL/IO/OFF/File_header_OFF_impl.h @@ -210,7 +210,6 @@ CGAL_INLINE_FUNCTION std::ostream& operator<<( std::ostream& out, const File_header_OFF& h) { if ( h.comments()) { out << "# Output of a CGAL tool\n"; - out << static_cast( h); } if ( h.has_textures()) out << "ST"; @@ -250,12 +249,8 @@ std::istream& operator>>( std::istream& in, File_header_OFF& h) { h.set_off_header( false); char c; while ( (in >> c) && c == '#') { - if ( in.get(c) && c == 'C' && - in.get(c) && c == 'B' && - in.get(c) && c == 'P') { - in >> static_cast( h); - } else if ( c != '\n') - in >> skip_until_EOL; + if ( c != '\n') + in >> skip_until_EOL; } if ( ! in ) return in; diff --git a/Stream_support/include/CGAL/IO/OFF/File_header_extended_OFF_impl.h b/Stream_support/include/CGAL/IO/OFF/File_header_extended_OFF_impl.h index 2405be2d337..5b47cdab293 100644 --- a/Stream_support/include/CGAL/IO/OFF/File_header_extended_OFF_impl.h +++ b/Stream_support/include/CGAL/IO/OFF/File_header_extended_OFF_impl.h @@ -133,72 +133,5 @@ operator+=( const File_header_extended_OFF& header) { return *this; } -#define CGAL_OUT(item) out << "# " #item " " << h.item() << '\n' -#define CGAL_OUTBOOL(item) out << "# " #item " " <<(h.item() ? '1':'0') << '\n' - -// Write extended header incl. CGAL/ENDCBP keywords. -CGAL_INLINE_FUNCTION -std::ostream& operator<<( std::ostream& out, - const File_header_extended_OFF& h) { - out << "#CBP\n"; - CGAL_OUTBOOL( polyhedral_surface); - CGAL_OUT( halfedges); - CGAL_OUTBOOL( triangulated); - CGAL_OUTBOOL( non_empty_facets); - CGAL_OUTBOOL( terrain); - CGAL_OUTBOOL( normalized_to_sphere); - CGAL_OUT( radius); - CGAL_OUTBOOL( rounded); - CGAL_OUT( rounded_bits); - out << "# ENDCBP\n" << std::endl; - return out; -} -#undef CGAL_OUT -#undef OUTBOOL - -#define CGAL_IN(item,type) \ - else if ( std::strcmp( keyword, #item) == 0) { \ - type t; \ - in >> t; \ - h.set_##item( t); \ - } - -#define CGAL_INBOOL(item) \ - else if ( std::strcmp( keyword, #item) == 0) { \ - in >> c; \ - h.set_##item( c == '1'); \ - } - -// Scan extended header. The CBP keyword must be read already. -CGAL_INLINE_FUNCTION -std::istream& operator>>( std::istream& in, File_header_extended_OFF& h) { - const int max_keyword = 42; - char c; - char keyword[max_keyword] = ""; - in >> keyword; - while ( in && std::strcmp( keyword, "ENDCBP") != 0) { - if ( std::strcmp( keyword, "#") == 0) - ; - CGAL_INBOOL( polyhedral_surface) - CGAL_IN( halfedges, int) - CGAL_INBOOL( triangulated) - CGAL_INBOOL( non_empty_facets) - CGAL_INBOOL( terrain) - CGAL_INBOOL( normalized_to_sphere) - CGAL_IN( radius, double) - CGAL_INBOOL( rounded) - CGAL_IN( rounded_bits, int) - else if ( h.verbose()) { - std::cerr << "warning: File_header_extended_OFF: unknown key '" - << keyword << "'." << std::endl; - } - in >> keyword; - } - in >> skip_until_EOL >> skip_comment_OFF; - return in; -} -#undef CGAL_IN -#undef CGAL_INBOOL - } //namespace CGAL // EOF // From ac708f6625e4a6448f88ac414cbf3c0fcc917c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 10 Mar 2021 13:59:00 +0100 Subject: [PATCH 114/178] use nested class for dispatch --- AABB_tree/include/CGAL/AABB_traits.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 78959df857b..a022070a654 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -24,6 +24,8 @@ #include #include #include +#include + #include @@ -414,7 +416,7 @@ public: CGAL::SMALLER : CGAL::LARGER; } - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true&) const + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, const Tag_true&) const { return GeomTraits().do_intersect_3_object() (GeomTraits().construct_sphere_3_object() @@ -422,7 +424,7 @@ public: CGAL::SMALLER : CGAL::LARGER; } - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_false&) const + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, const Tag_false&) const { return GeomTraits().do_intersect_3_object() (GeomTraits().construct_sphere_3_object() @@ -430,10 +432,22 @@ public: CGAL::SMALLER : CGAL::LARGER; } - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const - { - return (*this)(p, bb, bound, typename GeomTraits::Has_filtered_predicates_tag()); - } + template ::value> + struct Use_conservative_static_filters + { + typedef CGAL::Tag_false type; + }; + + template + struct Use_conservative_static_filters + { + typedef CGAL::Boolean_tag type; + }; + + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const + { + return (*this)(p, bb, bound, typename Use_conservative_static_filters::type()); + } template CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const From 3614dee0fbe1fd4b414b32aef8c4b82f060d3756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 10 Mar 2021 14:01:55 +0100 Subject: [PATCH 115/178] don't reinvent the wheel --- AABB_tree/include/CGAL/AABB_traits.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index a022070a654..85c86355c57 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -432,21 +432,9 @@ public: CGAL::SMALLER : CGAL::LARGER; } - template ::value> - struct Use_conservative_static_filters - { - typedef CGAL::Tag_false type; - }; - - template - struct Use_conservative_static_filters - { - typedef CGAL::Boolean_tag type; - }; - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const { - return (*this)(p, bb, bound, typename Use_conservative_static_filters::type()); + return (*this)(p, bb, bound, CGAL::Boolean_tag::value>()); } template From 2b5cb2da9f08cc1fdbed23886c227dac16e5eaad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 10 Mar 2021 14:23:58 +0100 Subject: [PATCH 116/178] copy tags --- AABB_tree/include/CGAL/AABB_traits.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 85c86355c57..7cabbdae1df 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -416,7 +416,7 @@ public: CGAL::SMALLER : CGAL::LARGER; } - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, const Tag_true&) const + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true) const { return GeomTraits().do_intersect_3_object() (GeomTraits().construct_sphere_3_object() @@ -424,7 +424,7 @@ public: CGAL::SMALLER : CGAL::LARGER; } - CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, const Tag_false&) const + CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_false) const { return GeomTraits().do_intersect_3_object() (GeomTraits().construct_sphere_3_object() @@ -434,7 +434,7 @@ public: CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const { - return (*this)(p, bb, bound, CGAL::Boolean_tag::value>()); + return (*this)(p, bb, bound, Boolean_tag::value>()); } template From e6c2e5c9499c4c94fb994e1de15f9daca51ce8af Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 10 Mar 2021 13:23:01 +0000 Subject: [PATCH 117/178] Simplify. todo: tighter bounds per case or factorization with a lambda --- .../internal/Static_filters/Do_intersect_3.h | 245 ++++++++---------- 1 file changed, 103 insertions(+), 142 deletions(-) diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index f5149d93f15..8f755a05965 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -178,18 +178,14 @@ public: Get_approx get_approx; // Identity functor for all points const Point_3& c = s.center(); - double scx, scy, scz, ssr, bxmin, bymin, bzmin, bxmax, bymax, bzmax; + double scx, scy, scz, ssr; + double bxmin = b.xmin() , bymin = b.ymin() , bzmin = b.zmin() , + bxmax = b.xmax() , bymax = b.ymax() , bzmax = b.zmax() ; if (fit_in_double(get_approx(c).x(), scx) && fit_in_double(get_approx(c).y(), scy) && fit_in_double(get_approx(c).z(), scz) && - fit_in_double(s.squared_radius(), ssr) && - fit_in_double(b.xmin(), bxmin) && - fit_in_double(b.ymin(), bymin) && - fit_in_double(b.zmin(), bzmin) && - fit_in_double(b.xmax(), bxmax) && - fit_in_double(b.ymax(), bymax) && - fit_in_double(b.zmax(), bzmax)) + fit_in_double(s.squared_radius(), ssr)) { CGAL_BRANCH_PROFILER_BRANCH_1(tmp); @@ -199,32 +195,30 @@ public: } double distance = 0; double max1 = 0; - + double double_tmp_result = 0; + double eps = 0; if(scx < bxmin) { double bxmin_scx = bxmin - scx; max1 = bxmin_scx; distance = square(bxmin_scx); -#ifdef EARLY - { - double double_tmp_result = (distance - ssr); + double_tmp_result = (distance - ssr); - if (max1 < 3.33558365626356687717e-147){ + if( (max1 < 3.33558365626356687717e-147) || (max1 > 1.67597599124282407923e+153) ){ + if(overestimate){ + return true; + }else{ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - if (max1 > 1.67597599124282407923e+153){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; } -#endif + + eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps){ + return false; + } } else if(scx > bxmax) { @@ -232,169 +226,136 @@ public: max1 = scx_bxmax; distance = square(scx_bxmax); -#ifdef EARLY - { - double double_tmp_result = (distance - ssr); + double_tmp_result = (distance - ssr); - if (max1 < 3.33558365626356687717e-147){ + if( (max1 < 3.33558365626356687717e-147) || (max1 > 1.67597599124282407923e+153)){ + if(overestimate){ + return true; + }else{ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - if (max1 > 1.67597599124282407923e+153){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; } -#endif + + eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps){ + return false; + } } - - - if(scy < bymin) { double bymin_scy = bymin - scy; - if(max1 < bymin_scy) + if(max1 < bymin_scy){ max1 = bymin_scy; + } distance += square(bymin_scy); -#ifdef EARLY - { - double double_tmp_result = (distance - ssr); + double_tmp_result = (distance - ssr); - if (max1 < 3.33558365626356687717e-147){ + if( (max1 < 3.33558365626356687717e-147) || ((max1 > 1.67597599124282407923e+153)) ){ + if(overestimate){ + return true; + }else{ CGAL_BRANCH_PROFILER_BRANCH_2(tmp); return Base::operator()(s,b); } - if ((max1 > 1.67597599124282407923e+153)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; } -#endif + + eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps){ + return false; + } } else if(scy > bymax) { double scy_bymax = scy - bymax; - if(max1 < scy_bymax) + if(max1 < scy_bymax){ max1 = scy_bymax; - - distance += square(scy_bymax); -#ifdef EARLY - - { - double double_tmp_result = (distance - ssr); - - if ((max1 < 3.33558365626356687717e-147)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - if ((max1 > 1.67597599124282407923e+153)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; } -#endif + distance += square(scy_bymax); + double_tmp_result = (distance - ssr); + + if( ((max1 < 3.33558365626356687717e-147)) || ((max1 > 1.67597599124282407923e+153)) ){ + if(overestimate){ + return true; + }else{ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + } + + eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps){ + return false; + } } + if(scz < bzmin) { double bzmin_scz = bzmin - scz; - if(max1 < bzmin_scz) + if(max1 < bzmin_scz){ max1 = bzmin_scz; - - distance += square(bzmin_scz); -#ifdef EARLY - { - double double_tmp_result = (distance - ssr); - - if ((max1 < 3.33558365626356687717e-147)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - if ((max1 > 1.67597599124282407923e+153)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; } -#endif + distance += square(bzmin_scz); + double_tmp_result = (distance - ssr); + + if( ((max1 < 3.33558365626356687717e-147)) || ((max1 > 1.67597599124282407923e+153))){ + if(overestimate){ + return true; + }else{ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); + } + } + + eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps){ + return false; + } } else if(scz > bzmax) { double scz_bzmax = scz - bzmax; - if(max1 < scz_bzmax) + if(max1 < scz_bzmax){ max1 = scz_bzmax; + } distance += square(scz_bzmax); -#ifdef EARLY - { - double double_tmp_result = (distance - ssr); + double_tmp_result = (distance - ssr); - if ((max1 < 3.33558365626356687717e-147)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - if ((max1 > 1.67597599124282407923e+153)){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; - } -#endif - } - - double double_tmp_result = (distance - ssr); - -#ifndef EARLY - if (max1 < 3.33558365626356687717e-147){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } - if (max1 > 1.67597599124282407923e+153){ - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); - } -#endif - double eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); - - if (double_tmp_result > eps) - return false; - else - { - if (double_tmp_result < -eps) - return true; - else { + if( ((max1 < 3.33558365626356687717e-147)) || ((max1 > 1.67597599124282407923e+153)) ){ if(overestimate){ return true; + }else{ + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); } - CGAL_BRANCH_PROFILER_BRANCH_2(tmp); - return Base::operator()(s,b); } + + eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1)); + + if (double_tmp_result > eps){ + return false; + } + } + + // double_tmp_result and eps were growing all the time + // no need to test for > eps as done earlier in at least one case + if (double_tmp_result < -eps){ + return true; + } else { + if(overestimate){ + return true; + } + CGAL_BRANCH_PROFILER_BRANCH_2(tmp); + return Base::operator()(s,b); } CGAL_BRANCH_PROFILER_BRANCH_2(tmp); From da17681a0630c01e2e1fa458117919c082bded89 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 10 Mar 2021 13:26:32 +0000 Subject: [PATCH 118/178] Avoid computing degree several times --- .../internal/Isotropic_remeshing/remesh_impl.h | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 551c1294cfa..16f46e7cb7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -828,8 +828,6 @@ namespace internal { std::cout << "Equalize valences..." << std::endl; #endif -#define VALE -#ifdef VALE typedef typename boost::property_map >::type Vertex_degree; Vertex_degree degree = get(CGAL::dynamic_vertex_property_t(), mesh_); @@ -841,7 +839,6 @@ namespace internal { vertex_descriptor t = target(h, mesh_); put(degree, t, get(degree,t)+1); } -#endif unsigned int nb_flips = 0; for(edge_descriptor e : edges(mesh_)) @@ -855,17 +852,12 @@ namespace internal { vertex_descriptor vb = target(he, mesh_); vertex_descriptor vc = target(next(he, mesh_), mesh_); vertex_descriptor vd = target(next(opposite(he, mesh_), mesh_), mesh_); -#ifdef VALE + int vva = get(degree,va), tvva = target_valence(va); int vvb = get(degree, vb), tvvb = target_valence(vb); int vvc = get(degree,vc), tvvc = target_valence(vc); int vvd = get(degree,vd), tvvd = target_valence(vd); -#else - int vva = valence(va), tvva = target_valence(va); - int vvb = valence( vb), tvvb = target_valence(vb); - int vvc = valence(vc), tvvc = target_valence(vc); - int vvd = valence(vd), tvvd = target_valence(vd); -#endif + int deviation_pre = CGAL::abs(vva - tvva) + CGAL::abs(vvb - tvvb) + CGAL::abs(vvc - tvvc) @@ -1227,11 +1219,6 @@ private: out.close(); } - int valence(const vertex_descriptor& v) const - { - return static_cast(degree(v, mesh_)); - } - int target_valence(const vertex_descriptor& v) const { return (has_border_ && is_border(v, mesh_)) ? 4 : 6; From 6d9ff5978ee6993b8e4b4f23e16a226d861741c2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 10 Mar 2021 16:19:32 +0000 Subject: [PATCH 119/178] Do not test has_on for a constructed point where we know that it will be true --- Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h b/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h index 7823c2a99f7..d9404603373 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h +++ b/Nef_S2/include/CGAL/Nef_S2/Sphere_segment.h @@ -210,7 +210,7 @@ bool has_on(const Sphere_point& p) const; /*{\Mop return true iff |\Mvar| contains |p|.}*/ bool has_on_after_intersection(const Sphere_point& p) const; -bool has_in_relative_interior(const Sphere_point& p) const; + bool has_in_relative_interior(const Sphere_point& p, bool check_has_on = true) const; /*{\Mop return true iff |\Mvar| contains |p| in its relative interior.}*/ @@ -315,8 +315,8 @@ has_on_after_intersection(const CGAL::Sphere_point& p) const { template bool Sphere_segment:: -has_in_relative_interior(const CGAL::Sphere_point& p) const -{ if ( !sphere_circle().has_on(p) ) return false; +has_in_relative_interior(const CGAL::Sphere_point& p, bool check_has_on) const +{ if (check_has_on &&( !sphere_circle().has_on(p) ) ) return false; if ( !is_long() ) { return orientation(Point_3(0,0,0), CGAL::ORIGIN + sphere_circle().orthogonal_vector(), @@ -360,11 +360,11 @@ bool do_intersect_internally(const Sphere_segment& s1, if ( equal_as_sets(s1.sphere_circle(),s2.sphere_circle()) ) return false; p = CGAL::intersection(s1.sphere_circle(),s2.sphere_circle()); - if ( s1.has_in_relative_interior(p) && - s2.has_in_relative_interior(p) ) return true; + if ( s1.has_in_relative_interior(p, false) && + s2.has_in_relative_interior(p, false) ) return true; p = p.antipode(); - if ( s1.has_in_relative_interior(p) && - s2.has_in_relative_interior(p) ) return true; + if ( s1.has_in_relative_interior(p, false) && + s2.has_in_relative_interior(p, false) ) return true; return false; } @@ -377,9 +377,9 @@ bool do_intersect_internally(const Sphere_circle& c1, if ( equal_as_sets(c1,s2.sphere_circle()) ) return false; p = CGAL::intersection(c1,s2.sphere_circle()); - if ( s2.has_in_relative_interior(p) ) return true; + if ( s2.has_in_relative_interior(p, false) ) return true; p = p.antipode(); - if ( s2.has_in_relative_interior(p) ) return true; + if ( s2.has_in_relative_interior(p, false) ) return true; return false; } From 2334ec5f4b70d42372c74037921fddc6803d7f15 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 10 Mar 2021 18:40:03 +0000 Subject: [PATCH 120/178] s gets constructed from a vertex some lines above --- Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h b/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h index c26d0ad7bae..8dbce0ced5e 100644 --- a/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h +++ b/Nef_S2/include/CGAL/Nef_S2/SM_point_locator.h @@ -257,7 +257,7 @@ public: Unique_hash_map visited(false); CGAL_forall_svertices(v,*this) { Sphere_point vp = v->point(); - if ( s.has_on(vp) ) { + if ( (v == v_res) || s.has_on(vp) ) { CGAL_NEF_TRACEN(" location via vertex at "< Date: Thu, 11 Mar 2021 13:32:46 +0000 Subject: [PATCH 121/178] Avoid a geometric test --- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index 3b81b1119c0..b11861428cb 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -849,7 +849,24 @@ public: _CGAL_NEF_TRACEN("found on facet..."); return make_object(f); } - if( is.does_intersect_internally(s,f,ip)) { + + // We next check if v is a vertex on the face to avoid a geometric test + bool v_vertex_of_f = false; + Halffacet_cycle_iterator fci; + for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) { + if(fci.is_shalfedge()) { + SHalfedge_around_facet_circulator sfc(fci), send(sfc); + CGAL_For_all(sfc,send) { + if(sfc->source()->center_vertex() == v){ + v_vertex_of_f = true; + break; + } + } + } + } + + + if( (! v_vertex_of_f) && is.does_intersect_internally(s,f,ip) ) { s = Segment_3(p, normalized(ip)); result = make_object(f); } From 6b50fb2f10d137fa0abb03ad900e01bebba7f3a8 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 11 Mar 2021 15:14:34 +0100 Subject: [PATCH 122/178] disable nbSmoothing_spinbox when splitEdgesOnly_checkbox is checked --- .../Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index 5bcf30de208..6fbf8082fef 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -954,9 +954,11 @@ private: ui.nbIterations_spinbox, SLOT(setDisabled(bool))); connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), ui.protect_checkbox, SLOT(setDisabled(bool))); - connect(ui.protect_checkbox, SIGNAL(toggled(bool)), + connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), ui.smooth1D_checkbox, SLOT(setDisabled(bool))); connect(ui.splitEdgesOnly_checkbox, SIGNAL(toggled(bool)), + ui.nbSmoothing_spinbox, SLOT(setDisabled(bool))); + connect(ui.protect_checkbox, SIGNAL(toggled(bool)), ui.smooth1D_checkbox, SLOT(setDisabled(bool))); connect(ui.preserveDuplicates_checkbox, SIGNAL(toggled(bool)), ui.protect_checkbox, SLOT(setChecked(bool))); From b0d871bf8f4df1b67453bb8cbe29bf2755556ef2 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 11 Mar 2021 15:21:08 +0100 Subject: [PATCH 123/178] change the tab-order for options in UI --- .../demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui index 68b8ee3a92f..a35ec28d966 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_dialog.ui @@ -245,12 +245,12 @@ splitEdgesOnly_checkbox + edgeLength_dspinbox nbIterations_spinbox nbSmoothing_spinbox protect_checkbox smooth1D_checkbox preserveDuplicates_checkbox - buttonBox From bd1b96e73b62ff8f2849cded6c3b6a4d1a73174a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 11 Mar 2021 16:27:37 +0000 Subject: [PATCH 124/178] Do not compute a scalar product to determine best projection direction --- Nef_3/include/CGAL/Nef_3/bounded_side_3.h | 39 +++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index e8d575d5582..549c1b47d3a 100644 --- a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -30,17 +30,17 @@ namespace CGAL { template -Point_2 point_3_get_x_y_point_2(Point_3 p) { +Point_2 point_3_get_x_y_point_2(const Point_3& p) { return( Point_2(p.hx(), p.hy(), p.hw()) ); } template -Point_2 point_3_get_y_z_point_2(Point_3 p) { +Point_2 point_3_get_y_z_point_2(const Point_3& p) { return( Point_2(p.hy(), p.hz(), p.hw()) ); } template -Point_2 point_3_get_z_x_point_2(Point_3 p) { +Point_2 point_3_get_z_x_point_2(const Point_3& p) { return( Point_2(p.hz(), p.hx(), p.hw()) ); } @@ -70,21 +70,27 @@ Bounded_side bounded_side_3(IteratorForward first, + auto apv = approx(plane.orthogonal_vector()); + + int dir = 0; + auto max = CGAL::abs(apv.x()); + if(CGAL::abs(apv.y()) > max){ + dir = 1; + max = CGAL::abs(apv.y()); + } + if(CGAL::abs(apv.z()) > max){ + dir = 2; + } + + CGAL_assertion(!plane.is_degenerate()); - Point_2 (*t)(Point_3); - Vector_3 pv(plane.orthogonal_vector()), pxy(0,0,1), pyz(1,0,0), pzx(0,1,0); - CGAL_NEF_TRACEN("pv*pxz: "<; - else if( !CGAL_NTS is_zero(pv*pyz) ) - /* the plane is not perpendicular to the YZ plane */ + Point_2 (*t)(const Point_3&); + + if(dir == 0){ t = &point_3_get_y_z_point_2< Point_2, Point_3>; - else { - CGAL_assertion( !CGAL_NTS is_zero(pv*pxy) ); - /* the plane is not perpendicular to the XY plane */ + }else if(dir == 1){ + t = &point_3_get_z_x_point_2< Point_2, Point_3>; + }else{ t = &point_3_get_x_y_point_2< Point_2, Point_3>; } @@ -95,7 +101,6 @@ Bounded_side bounded_side_3(IteratorForward first, points.push_back( t(*first)); } Bounded_side side = bounded_side_2( points.begin(), points.end(), t(point)); - points.clear(); return side; } From 54b55e0a48f824c4f4b5a04b23647728aa5f51ef Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Sat, 13 Mar 2021 16:55:32 +0000 Subject: [PATCH 125/178] Stupid me, after even have explained how interval arithmetic sometimes does not work --- Nef_3/include/CGAL/Nef_3/bounded_side_3.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index 549c1b47d3a..a20ac42f948 100644 --- a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -73,12 +73,12 @@ Bounded_side bounded_side_3(IteratorForward first, auto apv = approx(plane.orthogonal_vector()); int dir = 0; - auto max = CGAL::abs(apv.x()); - if(CGAL::abs(apv.y()) > max){ + double max = CGAL::abs(apv.x().sup()); + if(CGAL::abs(apv.y().sup()) > max){ dir = 1; - max = CGAL::abs(apv.y()); + max = CGAL::abs(apv.y().sup()); } - if(CGAL::abs(apv.z()) > max){ + if(CGAL::abs(apv.z().sup()) > max){ dir = 2; } From 6a27761f4fae07fcfd9f2e98fa868c3f09e84a5f Mon Sep 17 00:00:00 2001 From: Giles Bathgate Date: Sat, 13 Mar 2021 16:52:11 +0000 Subject: [PATCH 126/178] Add homogeneous/cartesian specialisations --- Nef_3/include/CGAL/Nef_3/bounded_side_3.h | 43 +++++++++++++++++++---- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index a20ac42f948..a34ed350fd4 100644 --- a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #undef CGAL_NEF_DEBUG @@ -30,20 +31,50 @@ namespace CGAL { template -Point_2 point_3_get_x_y_point_2(const Point_3& p) { +Point_2 point_3_get_x_y_point_2(const Point_3& p, const Homogeneous_tag&) { return( Point_2(p.hx(), p.hy(), p.hw()) ); } template -Point_2 point_3_get_y_z_point_2(const Point_3& p) { +Point_2 point_3_get_y_z_point_2(const Point_3& p, const Homogeneous_tag&) { return( Point_2(p.hy(), p.hz(), p.hw()) ); } template -Point_2 point_3_get_z_x_point_2(const Point_3& p) { +Point_2 point_3_get_z_x_point_2(const Point_3& p, const Homogeneous_tag&) { return( Point_2(p.hz(), p.hx(), p.hw()) ); } +template +Point_2 point_3_get_x_y_point_2(const Point_3& p, const Cartesian_tag&) { + return( Point_2(p.x(), p.y()) ); +} + +template +Point_2 point_3_get_y_z_point_2(const Point_3& p, const Cartesian_tag&) { + return( Point_2(p.y(), p.z()) ); +} + +template +Point_2 point_3_get_z_x_point_2(const Point_3& p, const Cartesian_tag&) { + return( Point_2(p.z(), p.x()) ); +} + +template +Point_2 point_3_get_x_y_point_2(const Point_3& p) { + return point_3_get_x_y_point_2(p,typename R::Kernel_tag()); +} + +template +Point_2 point_3_get_y_z_point_2(const Point_3& p) { + return point_3_get_y_z_point_2(p,typename R::Kernel_tag()); +} + +template +Point_2 point_3_get_z_x_point_2(const Point_3& p) { + return point_3_get_z_x_point_2(p,typename R::Kernel_tag()); +} + template Bounded_side bounded_side_3(IteratorForward first, IteratorForward last, @@ -87,11 +118,11 @@ Bounded_side bounded_side_3(IteratorForward first, Point_2 (*t)(const Point_3&); if(dir == 0){ - t = &point_3_get_y_z_point_2< Point_2, Point_3>; + t = &point_3_get_y_z_point_2< Point_2, Point_3, R>; }else if(dir == 1){ - t = &point_3_get_z_x_point_2< Point_2, Point_3>; + t = &point_3_get_z_x_point_2< Point_2, Point_3, R>; }else{ - t = &point_3_get_x_y_point_2< Point_2, Point_3>; + t = &point_3_get_x_y_point_2< Point_2, Point_3, R>; } std::vector< Point_2> points; From 5235fd6d2ccbe5447172cb30308a0219f7603cee Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Mon, 15 Mar 2021 10:50:14 +0100 Subject: [PATCH 127/178] moved min/max definitions of Segment_2/3 inside the class --- Kernel_23/include/CGAL/Segment_2.h | 31 +++++++++--------------------- Kernel_23/include/CGAL/Segment_3.h | 28 ++++++++------------------- 2 files changed, 17 insertions(+), 42 deletions(-) diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index ba533d050d2..8143beeb5c0 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -93,12 +93,17 @@ public: return target(); } + decltype(auto) + min BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xy_2 less_xy; + return less_xy(source(), target()) ? source() : target(); + } decltype(auto) - min BOOST_PREVENT_MACRO_SUBSTITUTION() const; - - decltype(auto) - max BOOST_PREVENT_MACRO_SUBSTITUTION () const; + max BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xy_2 less_xy; + return less_xy(source(), target()) ? target() : source(); + } decltype(auto) vertex(int i) const @@ -172,24 +177,6 @@ public: } }; -template < class R_ > -CGAL_KERNEL_INLINE -decltype(auto) -Segment_2::min BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ - typename R_::Less_xy_2 less_xy; - return less_xy(source(),target()) ? source() : target(); -} - -template < class R_ > -CGAL_KERNEL_INLINE -decltype(auto) -Segment_2::max BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ - typename R_::Less_xy_2 less_xy; - return less_xy(source(),target()) ? target() : source(); -} - template < class R_ > CGAL_KERNEL_INLINE diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index a15d3439874..fa0e4e7569d 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -93,10 +93,16 @@ public: } decltype(auto) - min BOOST_PREVENT_MACRO_SUBSTITUTION () const; + min BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xyz_3 less_xyz; + return less_xyz(source(), target()) ? source() : target(); + } decltype(auto) - max BOOST_PREVENT_MACRO_SUBSTITUTION () const; + max BOOST_PREVENT_MACRO_SUBSTITUTION() const { + typename R_::Less_xyz_3 less_xyz; + return less_xyz(source(), target()) ? target() : source(); + } decltype(auto) vertex(int i) const @@ -162,24 +168,6 @@ public: }; -template < class R_ > -CGAL_KERNEL_INLINE -decltype(auto) -Segment_3::min BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ - typename R_::Less_xyz_3 less_xyz; - return less_xyz(source(),target()) ? source() : target(); -} - -template < class R_ > -CGAL_KERNEL_INLINE -decltype(auto) -Segment_3::max BOOST_PREVENT_MACRO_SUBSTITUTION () const -{ - typename R_::Less_xyz_3 less_xyz; - return less_xyz(source(),target()) ? target() : source(); -} - template < class R > std::ostream & From 6346767cb27528f4be575a4cb70adfe05bc910af Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Tue, 16 Mar 2021 12:12:49 +0100 Subject: [PATCH 128/178] added = default to the Lipschitz sizing field --- .../include/CGAL/Lipschitz_sizing_field_criteria_2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GraphicsView/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h b/GraphicsView/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h index a1b58514c06..9cf5e923721 100644 --- a/GraphicsView/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h +++ b/GraphicsView/demo/Triangulation_2/include/CGAL/Lipschitz_sizing_field_criteria_2.h @@ -38,7 +38,8 @@ public: : Base(aspect_bound), sizing_field(sf), traits(traits) {} - Lipschitz_sizing_field_criteria_2& operator =(const Lipschitz_sizing_field_criteria_2& c) + Lipschitz_sizing_field_criteria_2(const Lipschitz_sizing_field_criteria_2&) = default; + Lipschitz_sizing_field_criteria_2& operator=(const Lipschitz_sizing_field_criteria_2& c) { if(&c == this) return *this; this->sizing_field = c.sizing_field; From 1cc00a32eb102772278f85e8e611f3a66040345b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 5 Mar 2021 14:52:25 +0100 Subject: [PATCH 129/178] Move LAS code from item to plugin to prevent BOOL declaration to conflict with the one form lib3mf. --- Polyhedron/demo/Polyhedron/CMakeLists.txt | 17 -------- .../demo/Polyhedron/Plugins/IO/CMakeLists.txt | 13 +++++++ .../Polyhedron/Plugins/IO/LAS_io_plugin.cpp | 39 +++++++++++++++---- .../Scene_points_with_normal_item.cpp | 37 ------------------ .../Scene_points_with_normal_item.h | 4 -- 5 files changed, 45 insertions(+), 65 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 0bb7d129c9e..af1cc39a9f6 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -338,23 +338,6 @@ if(CGAL_Qt5_FOUND AND Qt5_FOUND) PUBLIC CGAL::Eigen3_support) endif() - find_package(LASLIB) - set_package_properties( - LASLIB PROPERTIES - DESCRIPTION "A library for some I/O." - PURPOSE "Requiered for reading or writing LAS files.") - - include(CGAL_LASLIB_support) - if(TARGET CGAL::LASLIB_support) - target_link_libraries(scene_points_with_normal_item - PUBLIC CGAL::LASLIB_support) - if(MSVC) - target_compile_definitions( - scene_points_with_normal_item - PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") - endif() - endif() - if(TBB_FOUND) target_link_libraries(scene_points_with_normal_item PUBLIC CGAL::TBB_support) diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt index bed7401d8dc..5ac22254a05 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/CMakeLists.txt @@ -1,5 +1,13 @@ include(polyhedron_demo_macros) +find_package(LASLIB) +set_package_properties( + LASLIB PROPERTIES + DESCRIPTION "A library for some I/O." + PURPOSE "Requiered for reading or writing LAS files.") + +include(CGAL_LASLIB_support) + polyhedron_demo_plugin(gocad_plugin GOCAD_io_plugin KEYWORDS Viewer) target_link_libraries(gocad_plugin PUBLIC scene_surface_mesh_item) @@ -96,6 +104,11 @@ else() polyhedron_demo_plugin(las_plugin LAS_io_plugin KEYWORDS Viewer PointSetProcessing Classification) target_link_libraries(las_plugin PUBLIC scene_points_with_normal_item CGAL::LASLIB_support) target_compile_features(las_plugin PRIVATE ${needed_cxx_features}) + if(MSVC) + target_compile_definitions( + las_plugin + PUBLIC "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS") + endif() else() message( STATUS diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp index d0e616f2108..ee4b373b160 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/LAS_io_plugin.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include using namespace CGAL::Three; class Polyhedron_demo_las_plugin : @@ -35,12 +36,32 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { Scene_points_with_normal_item* item; item = new Scene_points_with_normal_item(); - if(!item->read_las_point_set(in)) + Q_ASSERT(item->point_set() != nullptr); + + item->point_set()->clear(); + + ok = CGAL::read_LAS (in, *(item->point_set())) && !item->isEmpty(); + if(ok) + { + std::cerr << item->point_set()->info(); + + if (!item->point_set()->has_normal_map()) { - delete item; - ok = false; - return QList(); + item->setRenderingMode(Points); } + else{ + item->setRenderingMode(CGAL::Three::Three::defaultPointSetRenderingMode()); + } + if (item->point_set()->check_colors()) + std::cerr << "-> Point set has colors" << std::endl; + + item->invalidateOpenGLBuffers(); + } + if(!ok) + { + delete item; + return QList(); + } item->setName(fileinfo.completeBaseName()); ok = true; @@ -63,14 +84,18 @@ bool Polyhedron_demo_las_plugin::save(QFileInfo fileinfo,QList(item); + Scene_points_with_normal_item* point_set_item = + qobject_cast(item); if(!point_set_item) return false; std::ofstream out(fileinfo.filePath().toUtf8().data()); items.pop_front(); - return point_set_item->write_las_point_set(out); + Q_ASSERT(point_set_item->point_set() != nullptr); + + point_set_item->point_set()->reset_indices(); + + return CGAL::write_LAS(out, *(point_set_item->point_set())); } diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp index 17789593d49..a1d7baf7cc9 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.cpp @@ -547,43 +547,6 @@ void Scene_points_with_normal_item::selectDuplicates() Q_EMIT itemChanged(); } -#ifdef CGAL_LINKED_WITH_LASLIB -// Loads point set from .LAS file -bool Scene_points_with_normal_item::read_las_point_set(std::istream& stream) -{ - Q_ASSERT(d->m_points != NULL); - - d->m_points->clear(); - - bool ok = CGAL::read_LAS (stream, *(d->m_points)) && !isEmpty(); - - std::cerr << d->m_points->info(); - - if (!d->m_points->has_normal_map()) - { - setRenderingMode(Points); - } - else{ - setRenderingMode(CGAL::Three::Three::defaultPointSetRenderingMode()); - } - if (d->m_points->check_colors()) - std::cerr << "-> Point set has colors" << std::endl; - - invalidateOpenGLBuffers(); - return ok; -} - -// Write point set to .LAS file -bool Scene_points_with_normal_item::write_las_point_set(std::ostream& stream) const -{ - Q_ASSERT(d->m_points != NULL); - - d->m_points->reset_indices(); - - return CGAL::write_LAS(stream, *(d->m_points)); -} - -#endif // LAS // Loads point set from .PLY file bool Scene_points_with_normal_item::read_ply_point_set(std::istream& stream) diff --git a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h index 31e7cfdb324..7594dba0ef4 100644 --- a/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_points_with_normal_item.h @@ -50,10 +50,6 @@ public: QMenu* contextMenu() Q_DECL_OVERRIDE; // IO -#ifdef CGAL_LINKED_WITH_LASLIB - bool read_las_point_set(std::istream& in); - bool write_las_point_set(std::ostream& out) const; -#endif // LAS bool read_ply_point_set(std::istream& in); bool write_ply_point_set(std::ostream& out, bool binary) const; bool read_off_point_set(std::istream& in); From 5066d5ae4ba5d23246226ee598d3659016bc12b1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 16 Mar 2021 13:28:00 +0100 Subject: [PATCH 130/178] Fix Qt::midbutton deprecation warning --- GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index f306e419ce7..c2c05f90c53 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -184,16 +184,16 @@ public: // Add custom mouse description setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::LeftButton, "Rotate the clipping plane when enabled"); setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::RightButton, "Translate the clipping plane when enabled"); - setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::MidButton, "Control the clipping plane transparency when enabled"); + setMouseBindingDescription(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::MiddleButton, "Control the clipping plane transparency when enabled"); setMouseBinding(::Qt::ControlModifier, ::Qt::LeftButton, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); setMouseBinding(::Qt::ControlModifier, ::Qt::RightButton, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); - setMouseBinding(::Qt::ControlModifier, ::Qt::MidButton, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); + setMouseBinding(::Qt::ControlModifier, ::Qt::MiddleButton, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); setWheelBinding(::Qt::ControlModifier, qglviewer::FRAME, qglviewer::NO_MOUSE_ACTION); setMouseBinding(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::LeftButton, qglviewer::FRAME, qglviewer::ROTATE); setMouseBinding(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::RightButton, qglviewer::FRAME, qglviewer::TRANSLATE); - setMouseBinding(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::MidButton, qglviewer::FRAME, qglviewer::ZOOM); + setMouseBinding(::Qt::Key_C, ::Qt::ControlModifier, ::Qt::MiddleButton, qglviewer::FRAME, qglviewer::ZOOM); setWheelBinding(::Qt::Key_C, ::Qt::ControlModifier, qglviewer::FRAME, qglviewer::ZOOM); if (title[0]==0) From fdcd84b0311d31d06d6994f90f5811c5008055f9 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 16 Mar 2021 14:18:05 +0100 Subject: [PATCH 131/178] Use copy_face_graph to duplicate the surface_mesh in affine_transformation to avoid problems related to the extra properties (it may cause a crash in the cas eof the face patch_id map, for example) --- .../demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp index 75b996dda51..bd6ecc28005 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Affine_transform_plugin.cpp @@ -570,7 +570,8 @@ void Polyhedron_demo_affine_transform_plugin::end(){ if(transform_item) { CGAL::qglviewer::Vec c = transform_item->center(); - FaceGraph* new_sm = new FaceGraph(*transform_item->getFaceGraph()); + FaceGraph* new_sm = new FaceGraph(); + CGAL::copy_face_graph(*transform_item->getFaceGraph(), *new_sm); typedef boost::property_map::type VPmap; VPmap vpmap = get(CGAL::vertex_point, *new_sm); From ed4198d67d23a5f58b6324b821103b437aafdb75 Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Tue, 16 Mar 2021 17:07:09 +0100 Subject: [PATCH 132/178] fixed the doc warning related to the ref of Chapter_dD_Geometry_Kernel --- Kernel_d/doc/Kernel_d/Kernel_d.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_d/doc/Kernel_d/Kernel_d.txt b/Kernel_d/doc/Kernel_d/Kernel_d.txt index ebccd581875..30c46dbc277 100644 --- a/Kernel_d/doc/Kernel_d/Kernel_d.txt +++ b/Kernel_d/doc/Kernel_d/Kernel_d.txt @@ -497,7 +497,7 @@ typedef Segment_d Segment; Segment s1, s2; std::cin >> s1 >> s2; -/* use auto */ +// use auto auto v = intersection(s1, s2); if (v) { // not empty From ac15312260ba9209332f5095b0dade4a88144653 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 18 Mar 2021 14:47:56 +0100 Subject: [PATCH 133/178] add Ceres support cmake file --- Installation/cmake/modules/CGAL_Ceres_support.cmake | 7 +++++++ .../examples/Polygon_mesh_processing/CMakeLists.txt | 9 ++++----- .../test/Polygon_mesh_processing/CMakeLists.txt | 8 ++++---- Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt | 6 +++--- 4 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 Installation/cmake/modules/CGAL_Ceres_support.cmake diff --git a/Installation/cmake/modules/CGAL_Ceres_support.cmake b/Installation/cmake/modules/CGAL_Ceres_support.cmake new file mode 100644 index 00000000000..bd4d6c8de1e --- /dev/null +++ b/Installation/cmake/modules/CGAL_Ceres_support.cmake @@ -0,0 +1,7 @@ +if(CERES_FOUND AND NOT TARGET CGAL::Ceres_support) + add_library(CGAL::Ceres_support INTERFACE IMPORTED) + set_target_properties(CGAL::Ceres_support PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "CGAL_PMP_USE_CERES_SOLVER" + INTERFACE_INCLUDE_DIRECTORIES "${CERES_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "ceres") +endif() diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index f979cf8cad3..1227234619e 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -136,8 +136,7 @@ else() endif() find_package(Ceres QUIET) -if(TARGET ceres) - target_compile_definitions(mesh_smoothing_example - PRIVATE CGAL_PMP_USE_CERES_SOLVER) - target_link_libraries(mesh_smoothing_example PRIVATE ceres) -endif(TARGET ceres) +include(CGAL_Ceres_support) +if(TARGET CGAL::Ceres_support) + target_link_libraries(mesh_smoothing_example PUBLIC CGAL::Ceres_support) +endif(TARGET CGAL::Ceres_support) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index 08a65b9ffc4..8fffbb6afbe 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -125,14 +125,14 @@ if(OpenMesh_FOUND) endif() find_package(Ceres QUIET) +include(CGAL_Ceres_support) -if(TARGET ceres AND TARGET CGAL::Eigen3_support) - target_compile_definitions( test_mesh_smoothing PRIVATE CGAL_PMP_USE_CERES_SOLVER ) - target_link_libraries( test_mesh_smoothing PUBLIC CGAL::Eigen3_support PRIVATE ceres ) +if(TARGET CGAL::Ceres_support AND TARGET CGAL::Eigen3_support) + target_link_libraries( test_mesh_smoothing PUBLIC CGAL::Eigen3_support CGAL::Ceres_support) # target_compile_definitions( test_pmp_repair_self_intersections PRIVATE CGAL_PMP_USE_CERES_SOLVER ) # target_link_libraries( test_pmp_repair_self_intersections PRIVATE ceres ) -endif(TARGET ceres AND TARGET CGAL::Eigen3_support) +endif(TARGET CGAL::Ceres_support AND TARGET CGAL::Eigen3_support) if(BUILD_TESTING) set_tests_properties( diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 0d3dea93625..577c980c628 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -42,9 +42,9 @@ if(TARGET CGAL::Eigen3_support) polyhedron_demo_plugin(smoothing_plugin Smoothing_plugin ${smoothingUI_FILES}) target_link_libraries(smoothing_plugin PUBLIC scene_surface_mesh_item scene_selection_item CGAL::Eigen3_support) find_package(Ceres QUIET) - if(TARGET ceres) - target_compile_definitions( smoothing_plugin PRIVATE CGAL_PMP_USE_CERES_SOLVER ) - target_link_libraries(smoothing_plugin PUBLIC ceres) + include(CGAL_Ceres_support) + if(TARGET CGAL::Ceres_support) + target_link_libraries(smoothing_plugin PUBLIC CGAL::Ceres_support) endif() set_package_properties( From 887b7d0eaa33b8ead4cbedd6623c60eab3caf9a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 18 Mar 2021 14:58:04 +0100 Subject: [PATCH 134/178] add METIS cmake support file --- BGL/examples/BGL_polyhedron_3/CMakeLists.txt | 12 +++++------- BGL/examples/BGL_surface_mesh/CMakeLists.txt | 6 +++--- Installation/cmake/modules/CGAL_METIS_support.cmake | 6 ++++++ Polyhedron/demo/Polyhedron/CMakeLists.txt | 5 +---- .../Plugins/Operations_on_polyhedra/CMakeLists.txt | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) create mode 100644 Installation/cmake/modules/CGAL_METIS_support.cmake diff --git a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt index f63a444cc7c..5f537a13683 100644 --- a/BGL/examples/BGL_polyhedron_3/CMakeLists.txt +++ b/BGL/examples/BGL_polyhedron_3/CMakeLists.txt @@ -51,12 +51,10 @@ else() endif() find_package( METIS ) -if( METIS_FOUND ) +include(CGAL_METIS_support) +if( TARGET CGAL::METIS_support ) create_single_source_cgal_program( "polyhedron_partition.cpp" ) - if( METIS_FOUND ) - target_include_directories( polyhedron_partition PRIVATE ${METIS_INCLUDE_DIRS} ) - target_link_libraries( polyhedron_partition PRIVATE ${METIS_LIBRARIES} ) - else() - message( STATUS "Examples that use the METIS library will not be compiled." ) - endif() + target_link_libraries( polyhedron_partition PUBLIC CGAL::METIS_support) +else() + message( STATUS "Examples that use the METIS library will not be compiled." ) endif() diff --git a/BGL/examples/BGL_surface_mesh/CMakeLists.txt b/BGL/examples/BGL_surface_mesh/CMakeLists.txt index f07081a0cd8..cc33dd58a0b 100644 --- a/BGL/examples/BGL_surface_mesh/CMakeLists.txt +++ b/BGL/examples/BGL_surface_mesh/CMakeLists.txt @@ -13,10 +13,10 @@ create_single_source_cgal_program("surface_mesh_dual.cpp") create_single_source_cgal_program("connected_components.cpp") find_package(METIS) -if( METIS_FOUND ) +include(CGAL_METIS_support) +if( TARGET CGAL::METIS_support ) create_single_source_cgal_program( "surface_mesh_partition.cpp" ) - target_include_directories( surface_mesh_partition PRIVATE ${METIS_INCLUDE_DIRS} ) - target_link_libraries( surface_mesh_partition PRIVATE ${METIS_LIBRARIES} ) + target_link_libraries( surface_mesh_partition PUBLIC CGAL::METIS_support ) else() message(STATUS "Examples that use the METIS library will not be compiled.") endif() diff --git a/Installation/cmake/modules/CGAL_METIS_support.cmake b/Installation/cmake/modules/CGAL_METIS_support.cmake new file mode 100644 index 00000000000..563bec6fc7f --- /dev/null +++ b/Installation/cmake/modules/CGAL_METIS_support.cmake @@ -0,0 +1,6 @@ +if(METIS_FOUND AND NOT TARGET CGAL::METIS_support) + add_library(CGAL::METIS_support INTERFACE IMPORTED) + set_target_properties(CGAL::METIS_support PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}") +endif() diff --git a/Polyhedron/demo/Polyhedron/CMakeLists.txt b/Polyhedron/demo/Polyhedron/CMakeLists.txt index 0bb7d129c9e..7645481f1f9 100644 --- a/Polyhedron/demo/Polyhedron/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/CMakeLists.txt @@ -75,15 +75,12 @@ set_package_properties( include(CGAL_Eigen3_support) find_package(METIS) +include(CGAL_METIS_support) set_package_properties( METIS PROPERTIES DESCRIPTION "A library for partitionning." PURPOSE "Requiered for the partition plugin.") -if(METIS_FOUND) - include_directories(${METIS_INCLUDE_DIRS}) -endif() - # Activate concurrency? option(POLYHEDRON_DEMO_ACTIVATE_CONCURRENCY "Enable concurrency" ON) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt index 2439f47b443..82d8554f6e3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/CMakeLists.txt @@ -20,10 +20,10 @@ target_link_libraries(diff_between_meshes_plugin PUBLIC scene_surface_mesh_item) polyhedron_demo_plugin(animate_mesh_plugin Animate_mesh_plugin ${animateUI_FILES}) target_link_libraries(animate_mesh_plugin PUBLIC scene_surface_mesh_item) - if( METIS_FOUND ) + if( TARGET CGAL::METIS_support ) qt5_wrap_ui( partitionUI_FILES PartitionDialog.ui ) polyhedron_demo_plugin(partition_plugin Partition_graph_plugin ${partitionUI_FILES}) - target_link_libraries(partition_plugin PUBLIC scene_surface_mesh_item ${METIS_LIBRARIES} ) + target_link_libraries(partition_plugin PUBLIC scene_surface_mesh_item CGAL::METIS_support ) else() message( "NOTICE : the Partition plugin needs METIS libraries and will not be compiled." From 5b397e9d6f856bde7ceeea1e5f49d76deab14a09 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 08:40:21 +0100 Subject: [PATCH 135/178] Fix group name for read_ply_points_with_properties --- Point_set_processing_3/include/CGAL/IO/read_ply_points.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h index 5588f2f1cf2..db4fafad369 100644 --- a/Point_set_processing_3/include/CGAL/IO/read_ply_points.h +++ b/Point_set_processing_3/include/CGAL/IO/read_ply_points.h @@ -92,7 +92,7 @@ namespace CGAL { #endif // DOXYGEN_RUNNING /** - \ingroup PkgPointSetProcessingIOPly + \ingroup PkgPointSetProcessing3IOPly Reads user-selected points properties from a .ply stream (ASCII or binary). From 109a893657c18d80216f6177f6301523f4557581 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 19 Mar 2021 11:30:05 +0100 Subject: [PATCH 136/178] remove #ifdef that should be defined --- .../internal/Isotropic_remeshing/remesh_impl.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 16f46e7cb7c..fa93c69d8de 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -875,12 +875,12 @@ namespace internal { vvb -= 1; vvc += 1; vvd += 1; -#ifdef VALE + put(degree, va, vva); put(degree, vb, vvb); put(degree, vc, vvc); put(degree, vd, vvd); -#endif + ++nb_flips; #ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS @@ -916,17 +916,17 @@ namespace internal { CGAL_assertion( is_flip_topologically_allowed(edge(he, mesh_)) ); CGAL_assertion( !get(ecmap_, edge(he, mesh_)) ); CGAL::Euler::flip_edge(he, mesh_); -#ifdef VALE + vva += 1; vvb += 1; vvc -= 1; vvd -= 1; - put(degree, va, vva); - put(degree, vb, vvb); - put(degree, vc, vvc); - put(degree, vd, vvd); -#endif + put(degree, va, vva); + put(degree, vb, vvb); + put(degree, vc, vvc); + put(degree, vd, vvd); + --nb_flips; CGAL_assertion_code(Halfedge_status s3 = status(he)); From 453b61100270295e8b046bb71c9ccc93146fdb33 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 19 Mar 2021 12:35:30 +0100 Subject: [PATCH 137/178] OUTPUT_TEXT_DIRECTION has been made obsolete The doxygen setting OUTPUT_TEXT_DIRECTION is obsolete --- Documentation/doc/resources/1.8.20/BaseDoxyfile.in | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in index 93dad8c7100..767fa9f07b2 100644 --- a/Documentation/doc/resources/1.8.20/BaseDoxyfile.in +++ b/Documentation/doc/resources/1.8.20/BaseDoxyfile.in @@ -93,14 +93,6 @@ ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English -# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all generated output in the proper direction. -# Possible values are: None, LTR, RTL and Context. -# The default value is: None. - -OUTPUT_TEXT_DIRECTION = None - # If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member # descriptions after the members that are listed in the file and class # documentation (similar to Javadoc). Set to NO to disable this. From 29a40dc40b982465b42f72826590902d0f59aab8 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 19 Mar 2021 15:47:12 +0100 Subject: [PATCH 138/178] Remove the timer and the output of the result --- .../isotropic_remeshing_example.cpp | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp index bb246a9393c..2fb29d976ef 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/isotropic_remeshing_example.cpp @@ -1,7 +1,5 @@ -#define EARLY #include #include -#include #include #include #include @@ -37,9 +35,6 @@ int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/pig.off"; - CGAL::Timer t; - t.start(); - Mesh mesh; if(!PMP::read_polygon_mesh(filename, mesh) || !CGAL::is_triangle_mesh(mesh)) { @@ -47,10 +42,7 @@ int main(int argc, char* argv[]) return 1; } - std::cout << "Read: " << t.time() << " sec" << std::endl; - t.reset(); - - double target_edge_length = (argc > 2) ? std::stod(std::string(argv[2])) : 1.0; + double target_edge_length = (argc > 2) ? std::stod(std::string(argv[2])) : 0.04; unsigned int nb_iter = 3; std::cout << "Split border..."; @@ -60,26 +52,14 @@ int main(int argc, char* argv[]) PMP::split_long_edges(border, target_edge_length, mesh); std::cout << "done." << std::endl; - - std::cout << "took " << t.time() << " sec" << std::endl; - t.reset(); - std::cout << "Start remeshing of " << filename << " (" << num_faces(mesh) << " faces)..." << std::endl; PMP::isotropic_remeshing(faces(mesh), target_edge_length, mesh, PMP::parameters::number_of_iterations(nb_iter) - .protect_constraints(true)); //i.e. protect border, here + .protect_constraints(true)); //i.e. protect border, here std::cout << "Remeshing done." << std::endl; - std::cout << "took " << t.time() << " sec" << std::endl; - t.reset(); - - std::ofstream out("out.off"); - out.precision(17); - //out << mesh << std::endl; - out.close(); - return 0; } From e01b9fb6ad10d6a143133b811019c82ec44c2ac2 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 15:47:34 +0100 Subject: [PATCH 139/178] add missing include --- Classification/include/CGAL/Classification/Label_set.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Classification/include/CGAL/Classification/Label_set.h b/Classification/include/CGAL/Classification/Label_set.h index d3e84acb4c9..cd42b34b909 100644 --- a/Classification/include/CGAL/Classification/Label_set.h +++ b/Classification/include/CGAL/Classification/Label_set.h @@ -19,6 +19,7 @@ #include #include +#include namespace CGAL { From 97ae3cbcc0b5d563b22a5e3ddde8df4e82baad63 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Sat, 20 Mar 2021 18:14:02 +0900 Subject: [PATCH 140/178] Work through expansions to find test failure --- Number_types/include/CGAL/FPU.h | 43 +++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 8e724756917..79b757047a9 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -612,18 +612,57 @@ inline void force_ieee_double_precision() #endif } -// Implementation (not part of the user interface) +/* +NOTE: Remove before merge. + +Originally this was: + +#define CGAL_IA_SQRT(a) \ + CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) + +In the normal path, IA_up is + return CGAL_IA_FORCE_TO_DOUBLE(d); + +So in the normal path this should be equivalent to + +return CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))); + +Unless there is some issue that I don't understand that's introduced by the function call. +*/ inline double IA_sqrt_up(double a) { return IA_up(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))); } +/* +NOTE: Remove before merge. + +Originally this was: + +FPU_set_cw(CGAL_FE_DOWNWARD); +double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0; +FPU_set_cw(CGAL_FE_UPWARD); + +define CGAL_IA_SQRT(a) \ + CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) + +We pass d.inf() in + +So this should be equivalent to + +double i = (d.inf() > 0.0) ? CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(d))) : 0.0; + +but we see that the CGAL_IA_FORCE_TO_DOUBLE has been omitted. + +Let's remedy that and see if that addresses the test failure. +*/ + inline double IA_sqrt_toward_zero(double d) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST return (d > 0.0) ? nextafter(std::sqrt(d), 0.) : 0.0; #else FPU_set_cw(CGAL_FE_DOWNWARD); - double i = (d > 0.0) ? CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(d)) : 0.0; + double i = (d > 0.0) ? CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(d))) : 0.0; FPU_set_cw(CGAL_FE_UPWARD); return i; #endif From 6b75fed7db2a2a9657ab615f259e5431b78bc6ac Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Sat, 20 Mar 2021 18:32:05 +0900 Subject: [PATCH 141/178] Clean up whitespace --- Number_types/include/CGAL/FPU.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 79b757047a9..3b0157a0612 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -623,7 +623,7 @@ Originally this was: In the normal path, IA_up is return CGAL_IA_FORCE_TO_DOUBLE(d); -So in the normal path this should be equivalent to +So in the normal path this should be equivalent to return CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))); From 504e4cf08bead231a0752fdb820587dce6c4ed5e Mon Sep 17 00:00:00 2001 From: Doug Roeper Date: Sat, 20 Mar 2021 19:34:55 -0400 Subject: [PATCH 142/178] Linear_cell_complex_incremental_builder include Adds a missing include. This file uses `Generalized_map_tag` on line 50, which is defined in `Linear_cell_complex_base.h`. --- .../include/CGAL/Linear_cell_complex_incremental_builder.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h index 86328a5deb8..8f4ed8b1846 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_incremental_builder.h @@ -14,6 +14,7 @@ #include #include +#include namespace CGAL { template Date: Tue, 23 Mar 2021 08:12:11 +0100 Subject: [PATCH 143/178] Update CHANGED.md --- Installation/CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 5787fc1441b..26ff408f622 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -44,6 +44,10 @@ A comprehensive list of the supported file formats is available in the Stream_su ### [dD Triangulations](https://doc.cgal.org/5.3/Manual/packages.html#PkgTriangulations) - Added the function `insert_if_in_star()` to the class `CGAL::Regular_triangulation`, which enables users to insert a point `p` in a regular triangulation on the condition that `p` appears post-insertion in the star of a user-specified, existing vertex. +### [Classification](https://doc.cgal.org/5.3/Manual/packages.html#PkgClassification) +- **Breaking change**: the support for TensorFlow was dropped, the + classifier `CGAL::TensorFlow::Neural_network_classifier` was removed. + [Release 5.2](https://github.com/CGAL/cgal/releases/tag/v5.2) ----------- From 91de37ec3adb127b487cccc0bb6bdddd3e386f09 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 23 Mar 2021 11:25:53 +0100 Subject: [PATCH 144/178] Fix warning: std::pow(float, int) returns double instead of float in recent C++ --- .../include/CGAL/edge_aware_upsample_point_set.h | 2 +- .../CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 2beb500eb88..5a5ce0b0a33 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -437,7 +437,7 @@ edge_aware_upsample_point_set( // FT cos_sigma = static_cast(std::cos(FT(CGAL::to_double(sharpness_angle)) / FT(180) * FT(CGAL_PI))); - FT sharpness_bandwidth = std::pow((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma), 2); + FT sharpness_bandwidth = static_cast(std::pow((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma), 2)); FT sum_density = 0.0; unsigned int count_density = 1; diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h index 820eee71576..e2e7bb38107 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Efficient_RANSAC.h @@ -1030,7 +1030,7 @@ namespace CGAL { } inline FT stop_probability(std::size_t largest_candidate, std::size_t num_pts, std::size_t num_candidates, std::size_t octree_depth) const { - return (std::min)(std::pow(FT(1) - FT(largest_candidate) + return (std::min)((FT)std::pow(FT(1) - FT(largest_candidate) / (FT(num_pts) * FT(octree_depth+1) * FT(1 << (m_required_samples - 1))), int(num_candidates)), FT(1)); From 60a568a03280f2abdb6220d250ce9e27c76c604e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 23 Mar 2021 11:39:18 +0100 Subject: [PATCH 145/178] Do not compile PCA examples/tests without Eigen --- .../Principal_component_analysis/CMakeLists.txt | 10 ++++++---- .../test/Principal_component_analysis/CMakeLists.txt | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt index 7499ccf9c83..0bb71659f24 100644 --- a/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/examples/Principal_component_analysis/CMakeLists.txt @@ -9,6 +9,10 @@ find_package(CGAL REQUIRED) # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) include(CGAL_Eigen3_support) +if(NOT TARGET CGAL::Eigen3_support) + message(STATUS "NOTICE: This project requires Eigen 3.1 (or greater) and will not be compiled.") + return() +endif() # create a target per cppfile file( @@ -17,8 +21,6 @@ file( ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") - if(TARGET CGAL::Eigen3_support) - get_filename_component(target ${cppfile} NAME_WE) - target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) - endif() + get_filename_component(target ${cppfile} NAME_WE) + target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) endforeach() diff --git a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt index 498476cdf5c..c81cffa2f8e 100644 --- a/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt +++ b/Principal_component_analysis/test/Principal_component_analysis/CMakeLists.txt @@ -9,6 +9,10 @@ find_package(CGAL REQUIRED) # Use Eigen find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater) include(CGAL_Eigen3_support) +if(NOT TARGET CGAL::Eigen3_support) + message(STATUS "NOTICE: This project requires Eigen 3.1 (or greater) and will not be compiled.") + return() +endif() # create a target per cppfile file( @@ -17,8 +21,6 @@ file( ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) foreach(cppfile ${cppfiles}) create_single_source_cgal_program("${cppfile}") - if(TARGET CGAL::Eigen3_support) - get_filename_component(target ${cppfile} NAME_WE) - target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) - endif() + get_filename_component(target ${cppfile} NAME_WE) + target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) endforeach() From aff0380871f4e3ebd831b42b35da8ba2f5dcd64b Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 23 Mar 2021 12:59:47 +0100 Subject: [PATCH 146/178] Fix Eigen in cmakelists --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 247 +++++++++--------- .../Tetrahedral_remeshing/CMakeLists.txt | 10 +- 2 files changed, 132 insertions(+), 125 deletions(-) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index f4a08426eb1..5c1f987fe34 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -20,139 +20,142 @@ if( CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3} ) endif() # Use Eigen -find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) +find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) - -find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) -if(VTK_FOUND) - if(VTK_USE_FILE) - include(${VTK_USE_FILE}) - endif() - if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) - message(STATUS "VTK found") - if(TARGET VTK::IOImage) - set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) +if(TARGET CGAL::Eigen3_support) + find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) + if(VTK_FOUND) + if(VTK_USE_FILE) + include(${VTK_USE_FILE}) + endif() + if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) + message(STATUS "VTK found") + if(TARGET VTK::IOImage) + set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) + endif() + else() + message(STATUS "VTK version 6.0 or greater is required") endif() else() - message(STATUS "VTK version 6.0 or greater is required") - endif() -else() - message(STATUS "VTK was not found") -endif() - -create_single_source_cgal_program( "mesh_hybrid_mesh_domain.cpp" ) -target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_implicit_sphere.cpp" ) -target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" ) -target_link_libraries(mesh_implicit_sphere_variable_size PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" ) -target_link_libraries(mesh_two_implicit_spheres_with_balls PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" ) -target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_cubes_intersection.cpp" ) -target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" ) -target_link_libraries(mesh_cubes_intersection_with_features PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" ) -target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) -target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_domain_sm.cpp" ) -target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_domain_with_surface_inside.cpp" ) -target_link_libraries(mesh_polyhedral_domain_with_surface_inside PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" ) -target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "remesh_polyhedral_surface_sm.cpp" ) -target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" ) -target_link_libraries(mesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_domain_with_features_sm.cpp" ) -target_link_libraries(mesh_polyhedral_domain_with_features_sm PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_domain_with_lipschitz_sizing.cpp" ) -target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" ) -target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" ) -target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) - -if( TARGET CGAL::CGAL_ImageIO) - if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) ) - add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) - target_link_libraries( mesh_3D_gray_vtk_image PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) - cgal_add_test( mesh_3D_gray_vtk_image ) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image ) + message(STATUS "VTK was not found") endif() - create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) - target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_hybrid_mesh_domain.cpp" ) + target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_3D_gray_image_multiple_values.cpp" ) - target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_implicit_sphere.cpp" ) + target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" ) - target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" ) + target_link_libraries(mesh_implicit_sphere_variable_size PUBLIC CGAL::Eigen3_support) - if( CGAL_ImageIO_USE_ZLIB ) - create_single_source_cgal_program( "mesh_optimization_example.cpp" ) - target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" ) + target_link_libraries(mesh_two_implicit_spheres_with_balls PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" ) - target_link_libraries(mesh_optimization_lloyd_example PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" ) + target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_3D_image.cpp" ) - target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_cubes_intersection.cpp" ) + target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" ) - target_link_libraries(mesh_3D_image_with_custom_initialization PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" ) + target_link_libraries(mesh_cubes_intersection_with_features PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" ) - target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen3_support) - else() - message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." ) - endif() -else() - message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." ) -endif() + create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" ) + target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) - foreach(target - mesh_3D_image - mesh_3D_image_variable_size - mesh_3D_image_with_custom_initialization - mesh_3D_image_with_features - mesh_implicit_sphere - mesh_implicit_sphere_variable_size - mesh_optimization_example - mesh_optimization_lloyd_example - mesh_polyhedral_complex - mesh_polyhedral_complex_sm - mesh_polyhedral_domain - mesh_polyhedral_domain_sm - mesh_polyhedral_domain_with_features - mesh_polyhedral_domain_with_features_sm - mesh_polyhedral_domain_with_lipschitz_sizing - mesh_two_implicit_spheres_with_balls) - if(TARGET ${target}) - target_link_libraries(${target} PUBLIC CGAL::TBB_support) + create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) + target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_domain_sm.cpp" ) + target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_domain_with_surface_inside.cpp" ) + target_link_libraries(mesh_polyhedral_domain_with_surface_inside PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" ) + target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "remesh_polyhedral_surface_sm.cpp" ) + target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" ) + target_link_libraries(mesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_domain_with_features_sm.cpp" ) + target_link_libraries(mesh_polyhedral_domain_with_features_sm PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_domain_with_lipschitz_sizing.cpp" ) + target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" ) + target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" ) + target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) + + if( TARGET CGAL::CGAL_ImageIO) + if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) ) + add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) + target_link_libraries( mesh_3D_gray_vtk_image PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) + cgal_add_test( mesh_3D_gray_vtk_image ) + add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image ) endif() - endforeach() -endif() + + create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) + target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_3D_gray_image_multiple_values.cpp" ) + target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" ) + target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) + + if( CGAL_ImageIO_USE_ZLIB ) + create_single_source_cgal_program( "mesh_optimization_example.cpp" ) + target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" ) + target_link_libraries(mesh_optimization_lloyd_example PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_3D_image.cpp" ) + target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" ) + target_link_libraries(mesh_3D_image_with_custom_initialization PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" ) + target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen3_support) + else() + message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." ) + endif() + else() + message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." ) + endif() + + if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) + foreach(target + mesh_3D_image + mesh_3D_image_variable_size + mesh_3D_image_with_custom_initialization + mesh_3D_image_with_features + mesh_implicit_sphere + mesh_implicit_sphere_variable_size + mesh_optimization_example + mesh_optimization_lloyd_example + mesh_polyhedral_complex + mesh_polyhedral_complex_sm + mesh_polyhedral_domain + mesh_polyhedral_domain_sm + mesh_polyhedral_domain_with_features + mesh_polyhedral_domain_with_features_sm + mesh_polyhedral_domain_with_lipschitz_sizing + mesh_two_implicit_spheres_with_balls) + if(TARGET ${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) + endif() + endforeach() + endif() +else() #CGAL::Eigen_3_support + message( STATUS "NOTICE: All examples need the Eigen_3 library, and will not be compiled." ) +endif() #CGAL::Eigen_3_support diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt index c7548855ad3..cf5769d86cd 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt @@ -40,8 +40,12 @@ create_single_source_cgal_program( "tetrahedral_remeshing_with_features.cpp") create_single_source_cgal_program( "tetrahedral_remeshing_of_one_subdomain.cpp") create_single_source_cgal_program( "tetrahedral_remeshing_from_mesh.cpp") +if(TARGET CGAL::Eigen3_support) create_single_source_cgal_program( "mesh_and_remesh_polyhedral_domain_with_features.cpp" ) -target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) - target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PRIVATE CGAL::TBB_support) + target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) + if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) + target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PRIVATE CGAL::TBB_support) + endif() +else() + message(STATUS "Some examples need the Eigen3 library, and will not be compiled.") endif() From 9f1e0cb8d66666d3aaab0eadca50dbb62cfc26b3 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 23 Mar 2021 12:59:47 +0100 Subject: [PATCH 147/178] Fix Eigen in cmakelists --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 303 +++++++++--------- .../Tetrahedral_remeshing/CMakeLists.txt | 11 +- 2 files changed, 161 insertions(+), 153 deletions(-) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 2f9ba7d5b27..f4ba1aab015 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -22,172 +22,175 @@ endif() # Use Eigen find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) include(CGAL_Eigen3_support) - -find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) -if(VTK_FOUND) - if(VTK_USE_FILE) - include(${VTK_USE_FILE}) - endif() - if("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) - message(STATUS "VTK found") - if(TARGET VTK::IOImage) - set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) +if(TARGET CGAL::Eigen3_support) + find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) + if(VTK_FOUND) + if(VTK_USE_FILE) + include(${VTK_USE_FILE}) + endif() + if("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) + message(STATUS "VTK found") + if(TARGET VTK::IOImage) + set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) + endif() + else() + message(STATUS "VTK version 6.0 or greater is required") endif() else() - message(STATUS "VTK version 6.0 or greater is required") - endif() -else() - message(STATUS "VTK was not found") -endif() - -create_single_source_cgal_program("mesh_hybrid_mesh_domain.cpp") -target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_implicit_sphere.cpp") -target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_implicit_sphere_variable_size.cpp") -target_link_libraries(mesh_implicit_sphere_variable_size - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_two_implicit_spheres_with_balls.cpp") -target_link_libraries(mesh_two_implicit_spheres_with_balls - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_implicit_domains_2.cpp" - "implicit_functions.cpp") -target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_cubes_intersection.cpp") -target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_cubes_intersection_with_features.cpp") -target_link_libraries(mesh_cubes_intersection_with_features - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_implicit_domains.cpp" - "implicit_functions.cpp") -target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) - -find_package( ITT QUIET ) -if(TARGET ITT::ITT) - target_link_libraries(mesh_implicit_domains PRIVATE ITT::ITT) - target_compile_definitions(mesh_implicit_domains PRIVATE CGAL_MESH_3_USE_INTEL_ITT) -endif() - -create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) -target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_polyhedral_domain_sm.cpp") -target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( - "mesh_polyhedral_domain_with_surface_inside.cpp") -target_link_libraries(mesh_polyhedral_domain_with_surface_inside - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("remesh_polyhedral_surface.cpp") -target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("remesh_polyhedral_surface_sm.cpp") -target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_polyhedral_domain_with_features.cpp") -target_link_libraries(mesh_polyhedral_domain_with_features - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_polyhedral_domain_with_features_sm.cpp") -target_link_libraries(mesh_polyhedral_domain_with_features_sm - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program( - "mesh_polyhedral_domain_with_lipschitz_sizing.cpp") -target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing - PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_polyhedral_complex.cpp") -target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) - -create_single_source_cgal_program("mesh_polyhedral_complex_sm.cpp") -target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) - -if(TARGET CGAL::CGAL_ImageIO) - if(VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION - VERSION_GREATER 5)) - add_executable(mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp) - target_link_libraries( - mesh_3D_gray_vtk_image - PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO - ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) - cgal_add_test(mesh_3D_gray_vtk_image) - add_to_cached_list(CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image) + message(STATUS "VTK was not found") endif() - create_single_source_cgal_program("mesh_3D_gray_image.cpp") - target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_hybrid_mesh_domain.cpp") + target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_3D_gray_image_multiple_values.cpp") - target_link_libraries(mesh_3D_gray_image_multiple_values + create_single_source_cgal_program("mesh_implicit_sphere.cpp") + target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_implicit_sphere_variable_size.cpp") + target_link_libraries(mesh_implicit_sphere_variable_size PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_3D_image_with_features.cpp") - target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_two_implicit_spheres_with_balls.cpp") + target_link_libraries(mesh_two_implicit_spheres_with_balls + PUBLIC CGAL::Eigen3_support) - if(CGAL_ImageIO_USE_ZLIB) - create_single_source_cgal_program("mesh_optimization_example.cpp") - target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_implicit_domains_2.cpp" + "implicit_functions.cpp") + target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_optimization_lloyd_example.cpp") - target_link_libraries(mesh_optimization_lloyd_example + create_single_source_cgal_program("mesh_cubes_intersection.cpp") + target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_cubes_intersection_with_features.cpp") + target_link_libraries(mesh_cubes_intersection_with_features + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_implicit_domains.cpp" + "implicit_functions.cpp") + target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) + + find_package( ITT QUIET ) + if(TARGET ITT::ITT) + target_link_libraries(mesh_implicit_domains PRIVATE ITT::ITT) + target_compile_definitions(mesh_implicit_domains PRIVATE CGAL_MESH_3_USE_INTEL_ITT) + endif() + + create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) + target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_polyhedral_domain_sm.cpp") + target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( + "mesh_polyhedral_domain_with_surface_inside.cpp") + target_link_libraries(mesh_polyhedral_domain_with_surface_inside + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("remesh_polyhedral_surface.cpp") + target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("remesh_polyhedral_surface_sm.cpp") + target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_polyhedral_domain_with_features.cpp") + target_link_libraries(mesh_polyhedral_domain_with_features + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_polyhedral_domain_with_features_sm.cpp") + target_link_libraries(mesh_polyhedral_domain_with_features_sm + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( + "mesh_polyhedral_domain_with_lipschitz_sizing.cpp") + target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_polyhedral_complex.cpp") + target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_polyhedral_complex_sm.cpp") + target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) + + if(TARGET CGAL::CGAL_ImageIO) + if(VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION + VERSION_GREATER 5)) + add_executable(mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp) + target_link_libraries( + mesh_3D_gray_vtk_image + PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO + ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) + cgal_add_test(mesh_3D_gray_vtk_image) + add_to_cached_list(CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image) + endif() + + create_single_source_cgal_program("mesh_3D_gray_image.cpp") + target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_3D_gray_image_multiple_values.cpp") + target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_3D_image.cpp") - target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image_with_features.cpp") + target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( - "mesh_3D_image_with_custom_initialization.cpp") - target_link_libraries(mesh_3D_image_with_custom_initialization - PUBLIC CGAL::Eigen3_support) + if(CGAL_ImageIO_USE_ZLIB) + create_single_source_cgal_program("mesh_optimization_example.cpp") + target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_optimization_lloyd_example.cpp") + target_link_libraries(mesh_optimization_lloyd_example + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_3D_image.cpp") + target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program( + "mesh_3D_image_with_custom_initialization.cpp") + target_link_libraries(mesh_3D_image_with_custom_initialization + PUBLIC CGAL::Eigen3_support) + + create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") + target_link_libraries(mesh_3D_image_variable_size + PUBLIC CGAL::Eigen3_support) + else() + message( + STATUS + "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." + ) + endif() - create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") - target_link_libraries(mesh_3D_image_variable_size - PUBLIC CGAL::Eigen3_support) else() message( STATUS - "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." + "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." ) endif() -else() - message( - STATUS - "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." - ) -endif() - -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) - foreach( - target - mesh_3D_image - mesh_3D_image_variable_size - mesh_3D_image_with_custom_initialization - mesh_3D_image_with_features - mesh_implicit_domains - mesh_implicit_sphere - mesh_implicit_sphere_variable_size - mesh_optimization_example - mesh_optimization_lloyd_example - mesh_polyhedral_complex - mesh_polyhedral_complex_sm - mesh_polyhedral_domain - mesh_polyhedral_domain_sm - mesh_polyhedral_domain_with_features - mesh_polyhedral_domain_with_features_sm - mesh_polyhedral_domain_with_lipschitz_sizing - mesh_two_implicit_spheres_with_balls) - if(TARGET ${target}) - target_link_libraries(${target} PUBLIC CGAL::TBB_support) - endif() - endforeach() -endif() + if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) + foreach( + target + mesh_3D_image + mesh_3D_image_variable_size + mesh_3D_image_with_custom_initialization + mesh_3D_image_with_features + mesh_implicit_domains + mesh_implicit_sphere + mesh_implicit_sphere_variable_size + mesh_optimization_example + mesh_optimization_lloyd_example + mesh_polyhedral_complex + mesh_polyhedral_complex_sm + mesh_polyhedral_domain + mesh_polyhedral_domain_sm + mesh_polyhedral_domain_with_features + mesh_polyhedral_domain_with_features_sm + mesh_polyhedral_domain_with_lipschitz_sizing + mesh_two_implicit_spheres_with_balls) + if(TARGET ${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) + endif() + endforeach() + endif() +else() #CGAL::Eigen_3_support + message( STATUS "NOTICE: All examples need the Eigen_3 library, and will not be compiled." ) +endif() #CGAL::Eigen_3_support diff --git a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt index 915f08fa948..417b560671c 100644 --- a/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt +++ b/Tetrahedral_remeshing/examples/Tetrahedral_remeshing/CMakeLists.txt @@ -36,9 +36,14 @@ create_single_source_cgal_program( "tetrahedral_remeshing_example.cpp" ) create_single_source_cgal_program( "tetrahedral_remeshing_with_features.cpp") create_single_source_cgal_program( "tetrahedral_remeshing_of_one_subdomain.cpp") create_single_source_cgal_program( "tetrahedral_remeshing_from_mesh.cpp") + +if(TARGET CGAL::Eigen3_support) create_single_source_cgal_program( "mesh_and_remesh_polyhedral_domain_with_features.cpp" ) -target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) -if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) - target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PRIVATE CGAL::TBB_support) + target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) + if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) + target_link_libraries(mesh_and_remesh_polyhedral_domain_with_features PRIVATE CGAL::TBB_support) + endif() +else() + message(STATUS "Some examples need the Eigen3 library, and will not be compiled.") endif() From ab14acff77dfb283366453be2cf5c8c59073832e Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Tue, 23 Mar 2021 13:14:41 +0100 Subject: [PATCH 148/178] Replace std::pow(x,2) by CGAL::square(x) --- Generator/include/CGAL/random_convex_hull_in_disc_2.h | 2 +- .../include/CGAL/bilateral_smooth_point_set.h | 4 ++-- .../include/CGAL/edge_aware_upsample_point_set.h | 4 ++-- .../include/CGAL/wlop_simplify_and_regularize_point_set.h | 2 +- .../CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h | 2 +- .../Surface_mesh_segmentation/Expectation_maximization.h | 4 ++-- .../include/CGAL/internal/Surface_mesh_segmentation/Filters.h | 4 ++-- .../internal/Surface_mesh_segmentation/K_means_clustering.h | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Generator/include/CGAL/random_convex_hull_in_disc_2.h b/Generator/include/CGAL/random_convex_hull_in_disc_2.h index 0315a7108e4..4969ca9cb87 100644 --- a/Generator/include/CGAL/random_convex_hull_in_disc_2.h +++ b/Generator/include/CGAL/random_convex_hull_in_disc_2.h @@ -192,7 +192,7 @@ void random_convex_hull_in_disc_2(std::size_t n, double radius, std::list(std::floor(n / std::pow(std::log(static_cast(n)), 2))); + if (!fast) T = static_cast(std::floor(n / CGAL::square(std::log(static_cast(n))))); while (simulated_points < n) { // l is a list coming from a convex hull operation. we are moving the diff --git a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h index 420f8ecb833..8918301b6ee 100644 --- a/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h +++ b/Point_set_processing_3/include/CGAL/bilateral_smooth_point_set.h @@ -90,7 +90,7 @@ compute_denoise_projection( Vector normal_sum = CGAL::NULL_VECTOR; FT cos_sigma = cos(sharpness_angle * CGAL_PI / 180.0); - FT sharpness_bandwidth = std::pow((CGAL::max)(1e-8, 1 - cos_sigma), 2); + FT sharpness_bandwidth = CGAL::square((CGAL::max)(1e-8, 1 - cos_sigma)); for (typename PointRange::iterator it : neighbor_pwns) { @@ -101,7 +101,7 @@ compute_denoise_projection( if (dist2 < radius2) { FT theta = std::exp(dist2 * iradius16); - FT psi = std::exp(-std::pow(1 - get(normal_map, vt) * nn, 2) + FT psi = std::exp(-CGAL::square(1 - get(normal_map, vt) * nn) / sharpness_bandwidth); weight = theta * psi; diff --git a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h index 5a5ce0b0a33..73c2484b1cd 100644 --- a/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h +++ b/Point_set_processing_3/include/CGAL/edge_aware_upsample_point_set.h @@ -212,7 +212,7 @@ update_new_point( for (unsigned int j = 0; j < candidate_num; j++) { - FT psi = std::exp(-std::pow(FT(1) - normal_cadidate[j] * t.normal, FT(2)) + FT psi = std::exp(-CGAL::square(FT(1) - normal_cadidate[j] * t.normal) / sharpness_bandwidth); FT project_diff_t_v = (t.pt - new_v.pt) * t.normal; FT weight = psi * theta; @@ -437,7 +437,7 @@ edge_aware_upsample_point_set( // FT cos_sigma = static_cast(std::cos(FT(CGAL::to_double(sharpness_angle)) / FT(180) * FT(CGAL_PI))); - FT sharpness_bandwidth = static_cast(std::pow((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma), 2)); + FT sharpness_bandwidth = CGAL::square((CGAL::max)((FT)1e-8, (FT)1.0 - cos_sigma)); FT sum_density = 0.0; unsigned int count_density = 1; diff --git a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h index a15bc4ec1ea..bd03a86ccf3 100644 --- a/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h +++ b/Point_set_processing_3/include/CGAL/wlop_simplify_and_regularize_point_set.h @@ -185,7 +185,7 @@ compute_update_sample_point( if (dist2 < 1e-10) continue; FT dist = std::sqrt(dist2); - weight = std::exp(dist2 * iradius16) * std::pow(FT(1.0) / dist, 2); // L1 + weight = std::exp(dist2 * iradius16) * CGAL::square(FT(1.0) / dist); // L1 if (!is_sample_densities_empty) { diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h index cd8917ed12b..aca2e52cef4 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Disk_samplers.h @@ -88,7 +88,7 @@ public: for(std::size_t i = 0; i < number_of_points; ++i) { double Q = i * golden_ratio * CGAL_PI; double R = std::sqrt(static_cast(i) / number_of_points); - double weight = exp(-0.5 * (std::pow(R / CGAL_ANGLE_ST_DEV_DIVIDER, 2))); + double weight = exp(-0.5 * (CGAL::square(R / CGAL_ANGLE_ST_DEV_DIVIDER))); *out_it++ = Tuple(R * cos(Q), R * sin(Q), weight); } } else { diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h index 0982f5eea0a..67dbfac4878 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h @@ -75,7 +75,7 @@ private: return x == mean ? 1.0 : 0.0; } - double e_over = -0.5 * std::pow((x - mean) / deviation, 2); + double e_over = -0.5 * CGAL::square((x - mean) / deviation); return exp(e_over) / deviation; } /** @@ -289,7 +289,7 @@ private: double new_deviation = 0.0; for(std::size_t point_i = 0; point_i < points.size(); ++point_i) { double membership = responsibility_matrix[center_i][point_i]; - new_deviation += membership * std::pow(points[point_i] - new_mean, 2); + new_deviation += membership * CGAL::square(points[point_i] - new_mean); } new_deviation = std::sqrt(new_deviation/total_membership); diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h index 6c6e231a604..ae2c7809284 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h @@ -92,7 +92,7 @@ public: double deviation = 0.0; for(typename std::map::iterator it = neighbors.begin(); it != neighbors.end(); ++it) { - deviation += std::pow(get(values, it->first) - current_sdf_value, 2); + deviation += CGAL::square(get(values, it->first) - current_sdf_value); } deviation = std::sqrt(deviation / neighbors.size()); if(deviation == 0.0) { @@ -133,7 +133,7 @@ public: private: /** Gaussian function for weighting. */ double gaussian_function(double value, double deviation) const { - return exp(-0.5 * (std::pow(value / deviation, 2))); + return exp(-0.5 * (CGAL::square(value / deviation))); } }; diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h index c35b6301648..9ca194cac17 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/K_means_clustering.h @@ -123,7 +123,7 @@ public: double cumulative_distance_square = 0.0; // distance_square holds closest distance that points have, so just test new coming center (i.e. centers.back()) for(std::size_t j = 0; j < points.size(); ++j) { - double new_distance = std::pow(centers.back() - points[j], 2); + double new_distance = CGAL::square(centers.back() - points[j]); if(new_distance < distance_square[j]) { distance_square[j] = new_distance; } @@ -422,7 +422,7 @@ private: double sum = 0.0; for(std::vector::const_iterator point_it = points.begin(); point_it != points.end(); ++point_it) { - sum += std::pow(centers[point_it->center_id].mean - point_it->data, 2); + sum += CGAL::square(centers[point_it->center_id].mean - point_it->data); } return sum; } From 12cf238ca2b4095c957ea740522722508291db09 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 23 Mar 2021 13:49:55 +0100 Subject: [PATCH 149/178] Don't REQUIRE Eigen --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index f4ba1aab015..71f7bfc848e 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -20,7 +20,7 @@ if(CGAL_ACTIVATE_CONCURRENT_MESH_3 OR ENV{CGAL_ACTIVATE_CONCURRENT_MESH_3}) endif() # Use Eigen -find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater) +find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) if(TARGET CGAL::Eigen3_support) find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) From acd886b11b30617615811f7cac81b49a826108ab Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 23 Mar 2021 14:55:55 +0100 Subject: [PATCH 150/178] Don't indent, use return() --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 247 +++++++++++++------------- 1 file changed, 124 insertions(+), 123 deletions(-) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 5c1f987fe34..97680fb860d 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -22,140 +22,141 @@ endif() # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) -if(TARGET CGAL::Eigen3_support) - find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) - if(VTK_FOUND) - if(VTK_USE_FILE) - include(${VTK_USE_FILE}) - endif() - if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) - message(STATUS "VTK found") - if(TARGET VTK::IOImage) - set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) - endif() - else() - message(STATUS "VTK version 6.0 or greater is required") +if(NOT TARGET CGAL::Eigen3_support) + message( STATUS "NOTICE: All examples need the Eigen3 library, and will not be compiled." ) + return() +endif() +find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) +if(VTK_FOUND) + if(VTK_USE_FILE) + include(${VTK_USE_FILE}) + endif() + if ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) + message(STATUS "VTK found") + if(TARGET VTK::IOImage) + set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) endif() else() - message(STATUS "VTK was not found") + message(STATUS "VTK version 6.0 or greater is required") + endif() +else() + message(STATUS "VTK was not found") +endif() + +create_single_source_cgal_program( "mesh_hybrid_mesh_domain.cpp" ) +target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_implicit_sphere.cpp" ) +target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" ) +target_link_libraries(mesh_implicit_sphere_variable_size PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" ) +target_link_libraries(mesh_two_implicit_spheres_with_balls PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" ) +target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_cubes_intersection.cpp" ) +target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" ) +target_link_libraries(mesh_cubes_intersection_with_features PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" ) +target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) +target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_domain_sm.cpp" ) +target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_domain_with_surface_inside.cpp" ) +target_link_libraries(mesh_polyhedral_domain_with_surface_inside PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" ) +target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "remesh_polyhedral_surface_sm.cpp" ) +target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" ) +target_link_libraries(mesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_domain_with_features_sm.cpp" ) +target_link_libraries(mesh_polyhedral_domain_with_features_sm PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_domain_with_lipschitz_sizing.cpp" ) +target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" ) +target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" ) +target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) + +if( TARGET CGAL::CGAL_ImageIO) + if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) ) + add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) + target_link_libraries( mesh_3D_gray_vtk_image PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) + cgal_add_test( mesh_3D_gray_vtk_image ) + add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image ) endif() - create_single_source_cgal_program( "mesh_hybrid_mesh_domain.cpp" ) - target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) + target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_implicit_sphere.cpp" ) - target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_3D_gray_image_multiple_values.cpp" ) + target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_implicit_sphere_variable_size.cpp" ) - target_link_libraries(mesh_implicit_sphere_variable_size PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" ) + target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_two_implicit_spheres_with_balls.cpp" ) - target_link_libraries(mesh_two_implicit_spheres_with_balls PUBLIC CGAL::Eigen3_support) + if( CGAL_ImageIO_USE_ZLIB ) + create_single_source_cgal_program( "mesh_optimization_example.cpp" ) + target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_implicit_domains_2.cpp" "implicit_functions.cpp" ) - target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" ) + target_link_libraries(mesh_optimization_lloyd_example PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_cubes_intersection.cpp" ) - target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_3D_image.cpp" ) + target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_cubes_intersection_with_features.cpp" ) - target_link_libraries(mesh_cubes_intersection_with_features PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" ) + target_link_libraries(mesh_3D_image_with_custom_initialization PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program( "mesh_implicit_domains.cpp" "implicit_functions.cpp" ) - target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) - target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_domain_sm.cpp" ) - target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_domain_with_surface_inside.cpp" ) - target_link_libraries(mesh_polyhedral_domain_with_surface_inside PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "remesh_polyhedral_surface.cpp" ) - target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "remesh_polyhedral_surface_sm.cpp" ) - target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_domain_with_features.cpp" ) - target_link_libraries(mesh_polyhedral_domain_with_features PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_domain_with_features_sm.cpp" ) - target_link_libraries(mesh_polyhedral_domain_with_features_sm PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_domain_with_lipschitz_sizing.cpp" ) - target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_complex.cpp" ) - target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_polyhedral_complex_sm.cpp" ) - target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) - - if( TARGET CGAL::CGAL_ImageIO) - if( VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) ) - add_executable ( mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp ) - target_link_libraries( mesh_3D_gray_vtk_image PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) - cgal_add_test( mesh_3D_gray_vtk_image ) - add_to_cached_list( CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image ) - endif() - - create_single_source_cgal_program( "mesh_3D_gray_image.cpp" ) - target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_3D_gray_image_multiple_values.cpp" ) - target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_3D_image_with_features.cpp" ) - target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) - - if( CGAL_ImageIO_USE_ZLIB ) - create_single_source_cgal_program( "mesh_optimization_example.cpp" ) - target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_optimization_lloyd_example.cpp" ) - target_link_libraries(mesh_optimization_lloyd_example PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_3D_image.cpp" ) - target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_3D_image_with_custom_initialization.cpp" ) - target_link_libraries(mesh_3D_image_with_custom_initialization PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" ) - target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen3_support) - else() - message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." ) - endif() + create_single_source_cgal_program( "mesh_3D_image_variable_size.cpp" ) + target_link_libraries(mesh_3D_image_variable_size PUBLIC CGAL::Eigen3_support) else() - message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." ) + message( STATUS "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." ) endif() +else() + message( STATUS "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." ) +endif() + +if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) + foreach(target + mesh_3D_image + mesh_3D_image_variable_size + mesh_3D_image_with_custom_initialization + mesh_3D_image_with_features + mesh_implicit_sphere + mesh_implicit_sphere_variable_size + mesh_optimization_example + mesh_optimization_lloyd_example + mesh_polyhedral_complex + mesh_polyhedral_complex_sm + mesh_polyhedral_domain + mesh_polyhedral_domain_sm + mesh_polyhedral_domain_with_features + mesh_polyhedral_domain_with_features_sm + mesh_polyhedral_domain_with_lipschitz_sizing + mesh_two_implicit_spheres_with_balls) + if(TARGET ${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) + endif() + endforeach() +endif() - if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) - foreach(target - mesh_3D_image - mesh_3D_image_variable_size - mesh_3D_image_with_custom_initialization - mesh_3D_image_with_features - mesh_implicit_sphere - mesh_implicit_sphere_variable_size - mesh_optimization_example - mesh_optimization_lloyd_example - mesh_polyhedral_complex - mesh_polyhedral_complex_sm - mesh_polyhedral_domain - mesh_polyhedral_domain_sm - mesh_polyhedral_domain_with_features - mesh_polyhedral_domain_with_features_sm - mesh_polyhedral_domain_with_lipschitz_sizing - mesh_two_implicit_spheres_with_balls) - if(TARGET ${target}) - target_link_libraries(${target} PUBLIC CGAL::TBB_support) - endif() - endforeach() - endif() -else() #CGAL::Eigen_3_support - message( STATUS "NOTICE: All examples need the Eigen_3 library, and will not be compiled." ) -endif() #CGAL::Eigen_3_support From 5aa763e0559ae4e965ddf34900656c0d18711cd6 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 23 Mar 2021 14:57:15 +0100 Subject: [PATCH 151/178] Don't indent and use return() --- Mesh_3/examples/Mesh_3/CMakeLists.txt | 307 +++++++++++++------------- 1 file changed, 154 insertions(+), 153 deletions(-) diff --git a/Mesh_3/examples/Mesh_3/CMakeLists.txt b/Mesh_3/examples/Mesh_3/CMakeLists.txt index 71f7bfc848e..24d2dfd4f2c 100644 --- a/Mesh_3/examples/Mesh_3/CMakeLists.txt +++ b/Mesh_3/examples/Mesh_3/CMakeLists.txt @@ -22,175 +22,176 @@ endif() # Use Eigen find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater) include(CGAL_Eigen3_support) -if(TARGET CGAL::Eigen3_support) - find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) - if(VTK_FOUND) - if(VTK_USE_FILE) - include(${VTK_USE_FILE}) - endif() - if("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) - message(STATUS "VTK found") - if(TARGET VTK::IOImage) - set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) - endif() - else() - message(STATUS "VTK version 6.0 or greater is required") +if(NOT TARGET CGAL::Eigen3_support) + message( STATUS "NOTICE: All examples need the Eigen3 library, and will not be compiled." ) + return() +endif() #CGAL::Eigen_3_support + +find_package(VTK QUIET COMPONENTS vtkImagingGeneral vtkIOImage NO_MODULE) +if(VTK_FOUND) + if(VTK_USE_FILE) + include(${VTK_USE_FILE}) + endif() + if("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION VERSION_GREATER 5) + message(STATUS "VTK found") + if(TARGET VTK::IOImage) + set(VTK_LIBRARIES VTK::ImagingGeneral VTK::IOImage) endif() else() - message(STATUS "VTK was not found") + message(STATUS "VTK version 6.0 or greater is required") + endif() +else() + message(STATUS "VTK was not found") +endif() + +create_single_source_cgal_program("mesh_hybrid_mesh_domain.cpp") +target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_implicit_sphere.cpp") +target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_implicit_sphere_variable_size.cpp") +target_link_libraries(mesh_implicit_sphere_variable_size + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_two_implicit_spheres_with_balls.cpp") +target_link_libraries(mesh_two_implicit_spheres_with_balls + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_implicit_domains_2.cpp" + "implicit_functions.cpp") +target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_cubes_intersection.cpp") +target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_cubes_intersection_with_features.cpp") +target_link_libraries(mesh_cubes_intersection_with_features + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_implicit_domains.cpp" + "implicit_functions.cpp") +target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) + +find_package( ITT QUIET ) +if(TARGET ITT::ITT) + target_link_libraries(mesh_implicit_domains PRIVATE ITT::ITT) + target_compile_definitions(mesh_implicit_domains PRIVATE CGAL_MESH_3_USE_INTEL_ITT) +endif() + +create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) +target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_polyhedral_domain_sm.cpp") +target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( + "mesh_polyhedral_domain_with_surface_inside.cpp") +target_link_libraries(mesh_polyhedral_domain_with_surface_inside + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("remesh_polyhedral_surface.cpp") +target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("remesh_polyhedral_surface_sm.cpp") +target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_polyhedral_domain_with_features.cpp") +target_link_libraries(mesh_polyhedral_domain_with_features + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_polyhedral_domain_with_features_sm.cpp") +target_link_libraries(mesh_polyhedral_domain_with_features_sm + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program( + "mesh_polyhedral_domain_with_lipschitz_sizing.cpp") +target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing + PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_polyhedral_complex.cpp") +target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) + +create_single_source_cgal_program("mesh_polyhedral_complex_sm.cpp") +target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) + +if(TARGET CGAL::CGAL_ImageIO) + if(VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION + VERSION_GREATER 5)) + add_executable(mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp) + target_link_libraries( + mesh_3D_gray_vtk_image + PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO + ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) + cgal_add_test(mesh_3D_gray_vtk_image) + add_to_cached_list(CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image) endif() - create_single_source_cgal_program("mesh_hybrid_mesh_domain.cpp") - target_link_libraries(mesh_hybrid_mesh_domain PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_gray_image.cpp") + target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_implicit_sphere.cpp") - target_link_libraries(mesh_implicit_sphere PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_implicit_sphere_variable_size.cpp") - target_link_libraries(mesh_implicit_sphere_variable_size + create_single_source_cgal_program("mesh_3D_gray_image_multiple_values.cpp") + target_link_libraries(mesh_3D_gray_image_multiple_values PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_two_implicit_spheres_with_balls.cpp") - target_link_libraries(mesh_two_implicit_spheres_with_balls - PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image_with_features.cpp") + target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_implicit_domains_2.cpp" - "implicit_functions.cpp") - target_link_libraries(mesh_implicit_domains_2 PUBLIC CGAL::Eigen3_support) + if(CGAL_ImageIO_USE_ZLIB) + create_single_source_cgal_program("mesh_optimization_example.cpp") + target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_cubes_intersection.cpp") - target_link_libraries(mesh_cubes_intersection PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_cubes_intersection_with_features.cpp") - target_link_libraries(mesh_cubes_intersection_with_features - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_implicit_domains.cpp" - "implicit_functions.cpp") - target_link_libraries(mesh_implicit_domains PUBLIC CGAL::Eigen3_support) - - find_package( ITT QUIET ) - if(TARGET ITT::ITT) - target_link_libraries(mesh_implicit_domains PRIVATE ITT::ITT) - target_compile_definitions(mesh_implicit_domains PRIVATE CGAL_MESH_3_USE_INTEL_ITT) - endif() - - create_single_source_cgal_program( "mesh_polyhedral_domain.cpp" ) - target_link_libraries(mesh_polyhedral_domain PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_polyhedral_domain_sm.cpp") - target_link_libraries(mesh_polyhedral_domain_sm PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( - "mesh_polyhedral_domain_with_surface_inside.cpp") - target_link_libraries(mesh_polyhedral_domain_with_surface_inside - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("remesh_polyhedral_surface.cpp") - target_link_libraries(remesh_polyhedral_surface PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("remesh_polyhedral_surface_sm.cpp") - target_link_libraries(remesh_polyhedral_surface_sm PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_polyhedral_domain_with_features.cpp") - target_link_libraries(mesh_polyhedral_domain_with_features - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_polyhedral_domain_with_features_sm.cpp") - target_link_libraries(mesh_polyhedral_domain_with_features_sm - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( - "mesh_polyhedral_domain_with_lipschitz_sizing.cpp") - target_link_libraries(mesh_polyhedral_domain_with_lipschitz_sizing - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_polyhedral_complex.cpp") - target_link_libraries(mesh_polyhedral_complex PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_polyhedral_complex_sm.cpp") - target_link_libraries(mesh_polyhedral_complex_sm PUBLIC CGAL::Eigen3_support) - - if(TARGET CGAL::CGAL_ImageIO) - if(VTK_FOUND AND ("${VTK_VERSION_MAJOR}" GREATER "5" OR VTK_VERSION - VERSION_GREATER 5)) - add_executable(mesh_3D_gray_vtk_image mesh_3D_gray_vtk_image.cpp) - target_link_libraries( - mesh_3D_gray_vtk_image - PUBLIC CGAL::Eigen3_support CGAL::CGAL CGAL::CGAL_ImageIO - ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} ${VTK_LIBRARIES}) - cgal_add_test(mesh_3D_gray_vtk_image) - add_to_cached_list(CGAL_EXECUTABLE_TARGETS mesh_3D_gray_vtk_image) - endif() - - create_single_source_cgal_program("mesh_3D_gray_image.cpp") - target_link_libraries(mesh_3D_gray_image PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_3D_gray_image_multiple_values.cpp") - target_link_libraries(mesh_3D_gray_image_multiple_values + create_single_source_cgal_program("mesh_optimization_lloyd_example.cpp") + target_link_libraries(mesh_optimization_lloyd_example PUBLIC CGAL::Eigen3_support) - create_single_source_cgal_program("mesh_3D_image_with_features.cpp") - target_link_libraries(mesh_3D_image_with_features PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image.cpp") + target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) - if(CGAL_ImageIO_USE_ZLIB) - create_single_source_cgal_program("mesh_optimization_example.cpp") - target_link_libraries(mesh_optimization_example PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_optimization_lloyd_example.cpp") - target_link_libraries(mesh_optimization_lloyd_example - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_3D_image.cpp") - target_link_libraries(mesh_3D_image PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program( - "mesh_3D_image_with_custom_initialization.cpp") - target_link_libraries(mesh_3D_image_with_custom_initialization - PUBLIC CGAL::Eigen3_support) - - create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") - target_link_libraries(mesh_3D_image_variable_size - PUBLIC CGAL::Eigen3_support) - else() - message( - STATUS - "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." - ) - endif() + create_single_source_cgal_program( + "mesh_3D_image_with_custom_initialization.cpp") + target_link_libraries(mesh_3D_image_with_custom_initialization + PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("mesh_3D_image_variable_size.cpp") + target_link_libraries(mesh_3D_image_variable_size + PUBLIC CGAL::Eigen3_support) else() message( STATUS - "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." + "NOTICE: The examples mesh_3D_image.cpp, mesh_3D_image_variable_size.cpp, mesh_optimization_example.cpp and mesh_optimization_lloyd_example.cpp need CGAL_ImageIO to be configured with ZLIB support, and will not be compiled." ) endif() - if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) - foreach( - target - mesh_3D_image - mesh_3D_image_variable_size - mesh_3D_image_with_custom_initialization - mesh_3D_image_with_features - mesh_implicit_domains - mesh_implicit_sphere - mesh_implicit_sphere_variable_size - mesh_optimization_example - mesh_optimization_lloyd_example - mesh_polyhedral_complex - mesh_polyhedral_complex_sm - mesh_polyhedral_domain - mesh_polyhedral_domain_sm - mesh_polyhedral_domain_with_features - mesh_polyhedral_domain_with_features_sm - mesh_polyhedral_domain_with_lipschitz_sizing - mesh_two_implicit_spheres_with_balls) - if(TARGET ${target}) - target_link_libraries(${target} PUBLIC CGAL::TBB_support) - endif() - endforeach() - endif() -else() #CGAL::Eigen_3_support - message( STATUS "NOTICE: All examples need the Eigen_3 library, and will not be compiled." ) -endif() #CGAL::Eigen_3_support +else() + message( + STATUS + "NOTICE: Some examples need the CGAL_ImageIO library, and will not be compiled." + ) +endif() + +if(CGAL_ACTIVATE_CONCURRENT_MESH_3 AND TARGET CGAL::TBB_support) + foreach( + target + mesh_3D_image + mesh_3D_image_variable_size + mesh_3D_image_with_custom_initialization + mesh_3D_image_with_features + mesh_implicit_domains + mesh_implicit_sphere + mesh_implicit_sphere_variable_size + mesh_optimization_example + mesh_optimization_lloyd_example + mesh_polyhedral_complex + mesh_polyhedral_complex_sm + mesh_polyhedral_domain + mesh_polyhedral_domain_sm + mesh_polyhedral_domain_with_features + mesh_polyhedral_domain_with_features_sm + mesh_polyhedral_domain_with_lipschitz_sizing + mesh_two_implicit_spheres_with_balls) + if(TARGET ${target}) + target_link_libraries(${target} PUBLIC CGAL::TBB_support) + endif() + endforeach() +endif() From e98198178f1278a87e4f65f45d9013fdcf05dc94 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 23 Mar 2021 15:45:54 +0100 Subject: [PATCH 152/178] Add the functor Non_zero_dimension_3 to the Kernel --- .../include/CGAL/Kernel/function_objects.h | 35 +++++++++++++++++++ .../include/CGAL/Kernel/interface_macros.h | 2 ++ Nef_3/include/CGAL/Nef_3/bounded_side_3.h | 7 ++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 1d698f65b6e..4b06db737af 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -37,6 +37,41 @@ namespace CGAL { namespace CommonKernelFunctors { + + + template + class Non_zero_dimension_3 + { + typedef typename K::Vector_3 Vector_3; + + public: + typedef int result_type; + + int operator()(const Vector_3& vec) const + { + int dir = -1; + if(certainly_not(is_zero(vec.x()))){ + dir = 0; + } else if(certainly_not(is_zero(vec.y()))){ + dir = 1; + }else if(certainly_not(is_zero(vec.y()))){ + dir = 2; + } + + if(dir == -1){ + if(! is_zero(vec.x())){ + return 0; + } else if(! is_zero(vec.y())){ + return 1; + } else if(! is_zero(vec.z())){ + return 2; + } + } + return dir; + } + }; + + template class Are_ordered_along_line_2 { diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index a4caf77e7be..668749ff3d5 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -582,6 +582,8 @@ CGAL_Kernel_pred(Less_y_3, less_y_3_object) CGAL_Kernel_pred(Less_z_3, less_z_3_object) +CGAL_Kernel_pred(Non_zero_dimension_3, + non_zero_dimension_3_object) CGAL_Kernel_pred_RT(Orientation_2, orientation_2_object) CGAL_Kernel_pred_RT(Orientation_3, diff --git a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index a34ed350fd4..90ff227e88c 100644 --- a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -99,8 +99,9 @@ Bounded_side bounded_side_3(IteratorForward first, we don't need to care about the plane orientation */ } - - + typename R::Non_zero_dimension_3 non_zero_dimension_3; + int dir = non_zero_dimension_3(plane.orthogonal_vector()); +#if 0 auto apv = approx(plane.orthogonal_vector()); int dir = 0; @@ -112,7 +113,7 @@ Bounded_side bounded_side_3(IteratorForward first, if(CGAL::abs(apv.z().sup()) > max){ dir = 2; } - +#endif CGAL_assertion(!plane.is_degenerate()); Point_2 (*t)(const Point_3&); From a28a7cd44a690b0eef511d82015ed14af819cb90 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 23 Mar 2021 17:11:26 +0100 Subject: [PATCH 153/178] Return directly --- .../include/CGAL/Kernel/function_objects.h | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 4b06db737af..b72ba5eb03b 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -49,26 +49,24 @@ namespace CommonKernelFunctors { int operator()(const Vector_3& vec) const { - int dir = -1; if(certainly_not(is_zero(vec.x()))){ - dir = 0; + return 0; } else if(certainly_not(is_zero(vec.y()))){ - dir = 1; + return 1; }else if(certainly_not(is_zero(vec.y()))){ - dir = 2; + return 2; } - if(dir == -1){ - if(! is_zero(vec.x())){ - return 0; - } else if(! is_zero(vec.y())){ - return 1; - } else if(! is_zero(vec.z())){ - return 2; - } + if(! is_zero(vec.x())){ + return 0; + } else if(! is_zero(vec.y())){ + return 1; + } else if(! is_zero(vec.z())){ + return 2; } - return dir; - } + + return -1; + } }; From 3b1dfc764bfd0ee1f3b3cdae51720caab930d4c4 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 24 Mar 2021 08:44:17 +0100 Subject: [PATCH 154/178] Add missing include --- Generator/include/CGAL/random_convex_hull_in_disc_2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Generator/include/CGAL/random_convex_hull_in_disc_2.h b/Generator/include/CGAL/random_convex_hull_in_disc_2.h index 4969ca9cb87..0bac0f466e3 100644 --- a/Generator/include/CGAL/random_convex_hull_in_disc_2.h +++ b/Generator/include/CGAL/random_convex_hull_in_disc_2.h @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace CGAL { From 20193092889f802929575282fd7e5a8440b3a59a Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 24 Mar 2021 15:31:43 +0100 Subject: [PATCH 155/178] Replace Rep by a boost::tuple --- Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index 4b0bfbd9c47..96dac082ad3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -17,6 +17,7 @@ #define CGAL_CARTESIAN_CIRCLEC3_H #include +#include "boost/tuple/tuple.hpp" namespace CGAL { @@ -29,13 +30,8 @@ class CircleC3 { typedef typename R_::Direction_3 Direction_3; typedef typename R_::FT FT; - struct Rep - { - Sphere_3 first; - Plane_3 second; - Rep () : first(), second() { } - Rep (const Sphere_3& s, const Plane_3& p) : first(s), second(p) { } - }; + typedef boost::tuple Rep; + typedef typename R_::template Handle::type Base; Base base; @@ -125,7 +121,7 @@ public: const Plane_3& supporting_plane() const { - return get_pointee_or_identity(base).second; + return boost::get<1>(get_pointee_or_identity(base)); } const Sphere_3& supporting_sphere() const @@ -145,7 +141,7 @@ public: const Sphere_3& diametral_sphere() const { - return get_pointee_or_identity(base).first; + return boost::get<0>(get_pointee_or_identity(base)); } double approximate_area() const From e0b410e2e66f168b92dd915e5be18d7a95f7d488 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 24 Mar 2021 16:03:51 +0100 Subject: [PATCH 156/178] int -> result_type --- Kernel_23/include/CGAL/Kernel/function_objects.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index b72ba5eb03b..60044b9da6b 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -47,7 +47,7 @@ namespace CommonKernelFunctors { public: typedef int result_type; - int operator()(const Vector_3& vec) const + result_type operator()(const Vector_3& vec) const { if(certainly_not(is_zero(vec.x()))){ return 0; From e1a9cfc6ba33a3d7731683da616c416664f264b3 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 24 Mar 2021 16:10:06 +0100 Subject: [PATCH 157/178] Also break the outer loop --- Nef_3/include/CGAL/Nef_3/SNC_point_locator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h index b11861428cb..bc3af7976af 100644 --- a/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h +++ b/Nef_3/include/CGAL/Nef_3/SNC_point_locator.h @@ -853,7 +853,7 @@ public: // We next check if v is a vertex on the face to avoid a geometric test bool v_vertex_of_f = false; Halffacet_cycle_iterator fci; - for(fci=f->facet_cycles_begin(); fci!=f->facet_cycles_end(); ++fci) { + for(fci=f->facet_cycles_begin(); (! v_vertex_of_f) && (fci!=f->facet_cycles_end()); ++fci) { if(fci.is_shalfedge()) { SHalfedge_around_facet_circulator sfc(fci), send(sfc); CGAL_For_all(sfc,send) { From c26cb0012d54bb0127366a4d66859d92a9c02919 Mon Sep 17 00:00:00 2001 From: Brian Spilsbury Date: Thu, 25 Mar 2021 12:52:20 +0900 Subject: [PATCH 158/178] Clean up temporary notes --- Number_types/include/CGAL/FPU.h | 41 --------------------------------- 1 file changed, 41 deletions(-) diff --git a/Number_types/include/CGAL/FPU.h b/Number_types/include/CGAL/FPU.h index 3b0157a0612..0a324d451a6 100644 --- a/Number_types/include/CGAL/FPU.h +++ b/Number_types/include/CGAL/FPU.h @@ -612,51 +612,10 @@ inline void force_ieee_double_precision() #endif } -/* -NOTE: Remove before merge. - -Originally this was: - -#define CGAL_IA_SQRT(a) \ - CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) - -In the normal path, IA_up is - return CGAL_IA_FORCE_TO_DOUBLE(d); - -So in the normal path this should be equivalent to - -return CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))); - -Unless there is some issue that I don't understand that's introduced by the function call. -*/ - inline double IA_sqrt_up(double a) { return IA_up(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))); } -/* -NOTE: Remove before merge. - -Originally this was: - -FPU_set_cw(CGAL_FE_DOWNWARD); -double i = (d.inf() > 0.0) ? CGAL_IA_SQRT(d.inf()) : 0.0; -FPU_set_cw(CGAL_FE_UPWARD); - -define CGAL_IA_SQRT(a) \ - CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(a))) - -We pass d.inf() in - -So this should be equivalent to - -double i = (d.inf() > 0.0) ? CGAL_IA_FORCE_TO_DOUBLE(CGAL_BUG_SQRT(CGAL_IA_STOP_CPROP(d))) : 0.0; - -but we see that the CGAL_IA_FORCE_TO_DOUBLE has been omitted. - -Let's remedy that and see if that addresses the test failure. -*/ - inline double IA_sqrt_toward_zero(double d) { #ifdef CGAL_ALWAYS_ROUND_TO_NEAREST return (d > 0.0) ? nextafter(std::sqrt(d), 0.) : 0.0; From 8094b087084c716e51e34bf3df82191034e96d15 Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Thu, 25 Mar 2021 10:37:09 +0100 Subject: [PATCH 159/178] Add missing includes --- .../include/CGAL/internal/Surface_mesh_segmentation/Filters.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h index ae2c7809284..f1733ef2ac4 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Filters.h @@ -30,6 +30,8 @@ #include #include +#include +#include namespace CGAL { From b4e98df11789362c49345e1d844e49d4570b4f01 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 25 Mar 2021 11:54:29 +0100 Subject: [PATCH 160/178] cleanup --- Nef_3/include/CGAL/Nef_3/bounded_side_3.h | 102 ---------------------- 1 file changed, 102 deletions(-) diff --git a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index 90ff227e88c..9cd7a5eba2e 100644 --- a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -82,7 +82,6 @@ Bounded_side bounded_side_3(IteratorForward first, typename R::Plane_3 plane = typename R::Plane_3(0,0,0,0)) { typedef typename R::Point_2 Point_2; typedef typename R::Point_3 Point_3; - typedef typename R::Vector_3 Vector_3; typedef typename R::Plane_3 Plane_3; if(plane == Plane_3(0,0,0,0)) { @@ -101,19 +100,7 @@ Bounded_side bounded_side_3(IteratorForward first, typename R::Non_zero_dimension_3 non_zero_dimension_3; int dir = non_zero_dimension_3(plane.orthogonal_vector()); -#if 0 - auto apv = approx(plane.orthogonal_vector()); - int dir = 0; - double max = CGAL::abs(apv.x().sup()); - if(CGAL::abs(apv.y().sup()) > max){ - dir = 1; - max = CGAL::abs(apv.y().sup()); - } - if(CGAL::abs(apv.z().sup()) > max){ - dir = 2; - } -#endif CGAL_assertion(!plane.is_degenerate()); Point_2 (*t)(const Point_3&); @@ -138,94 +125,5 @@ Bounded_side bounded_side_3(IteratorForward first, } //namespace CGAL -#ifdef WRONG_IMPLEMENTATION -/* The following code is wrong since Proyector_.. structures must not return - references to temporal objects */ -template < class Point_2, class Point_3> -struct Project_XY { - typedef Point_3 argument_type; - typedef Point_2 result_type; - Point_2 operator()( Point_3& p) const { - return Point_2(p.hx(), p.hy(), p.hw()); - } - const Point_2 operator()( const Point_3& p) const { - return Point_2(p.hx(), p.hy(), p.hw()); - } -}; - -template < class Point_2, class Point_3> -struct Project_YZ { - typedef Point_3 argument_type; - typedef Point_2 result_type; - Point_2 operator()( Point_3& p) const { - return Point_2(p.hy(), p.hz(), p.hw()); - } - const Point_2 operator()( const Point_3& p) const { - return Point_2(p.hy(), p.hz(), p.hw()); - } -}; - -template < class Point_2, class Point_3> -struct Project_XZ { - typedef Point_3 argument_type; - typedef Point_2 result_type; - Point_2 operator()( Point_3& p) const { - return Point_2(p.hx(), p.hz(), p.hw()); - } - const Point_2 operator()( const Point_3& p) const { - return Point_2(p.hx(), p.hz(), p.hw()); - } -}; - -template -Bounded_side bounded_side_3(IC first, - IC last, - const Point_3& point, - Plane_3 plane = Plane_3(0,0,0,0)) { - - typedef typename R::Point_2 Point_2; - typedef typename R::Point_3 Point_3; - typedef typename R::Vector_3 Vector_3; - typedef typename R::Plane_3 Plane_3; - - CGAL_assertion( !CGAL::is_empty_range( first, last)); - - if(plane == Plane_3(0,0,0,0)) { - Vector_3 hv; - normal_vector_newell_3( first, last, hv); - plane = Plane_3( *first, Vector_3(hv)); - } - CGAL_assertion(!plane.is_degenerate()); - Vector_3 pd(plane.orthogonal_vector()), pyz(1,0,0), pxz(0,1,0); - if(pd == pyz || pd == -pyz) { - /* the plane is parallel to the YZ plane */ - typedef Project_YZ< Point_2, Point_3> Project_YZ; - typedef Iterator_project< IC, Project_YZ> Iterator_YZ; - Project_YZ project; - Point_2 p = project(point); - Iterator_YZ pfirst(first), plast(last); - return bounded_side_2(pfirst, plast, p); - } - else if(pd == pxz || pd ==- pxz) { - /* the plane is parallel to the XZ plane */ - typedef Project_XZ< Point_2, Point_3> Project_XZ; - typedef Iterator_project< IC, Project_XZ> Iterator_XZ; - Project_XZ project; - Point_2 p = project(point); - Iterator_XZ pfirst(first), plast(last); - return bounded_side_2(pfirst, plast, p); - } - else { - CGAL_assertion(cross_product(pd.vector(), Vector_3(0,0,1)) == NULL_VECTOR); - /* the plane is not perpendicular to the XY plane */ - typedef Project_XY< Point_2, Point_3> Project_XY; - typedef Iterator_project< IC, Project_XY> Iterator_XY; - Project_XY project; - Point_2 p = project(point); - Iterator_XY pfirst(first), plast(last); - return bounded_side_2(pfirst, plast, p); - } -} -#endif // WRONG_IMPLEMENTATION #endif // CGAL_BOUNDED_SIDE_3_H From b03920667978d7f7002ead463b39cf5ffd66aac8 Mon Sep 17 00:00:00 2001 From: Doug Roeper Date: Sat, 27 Feb 2021 17:52:20 -0500 Subject: [PATCH 161/178] Separates the `import_from_plane_graph` logic into 2 separate functions so the user can build the graph directly from a list of points and edges instead of a `std::istream`. --- .../CGAL/Linear_cell_complex_constructors.h | 150 +++++++++++------- 1 file changed, 92 insertions(+), 58 deletions(-) diff --git a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h index 1505ca79733..0d8808fb7a0 100644 --- a/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h +++ b/Linear_cell_complex/include/CGAL/Linear_cell_complex_constructors.h @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -28,65 +29,41 @@ namespace CGAL { * CGAL data structures. */ - /** Import an embedded plane graph read into a flux into a - * linear cell complex. - * @param alcc the linear cell complex where the graph will be imported. - * @param ais the istream where read the graph. - * @return A dart created during the convertion. + + /** + * Imports a plane-embedded graph from a list of points and edges represented as pairs of vertex indices */ template< class LCC > typename LCC::Dart_handle import_from_plane_graph(LCC& alcc, - std::istream& ais) + const std::vector& vertices, + const std::vector& edge_indices) { - CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==2 ); - + typedef typename LCC::Traits::Construct_direction_2 Construct_direction_2; + typedef typename LCC::Traits::Construct_vector Construct_vector; typedef typename LCC::Dart_handle Dart_handle; typedef typename LCC::Traits::Direction_2 Direction; - typedef typename std::list::iterator List_iterator; typedef typename std::map::iterator LCC_iterator; + typedef typename std::list::iterator List_iterator; + typedef typename LCC::Point Point; + + CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==2 ); + CGAL_assertion(edge_indices.size() % 2 == 0); - // Arrays of vertices std::vector< typename LCC::Vertex_attribute_handle > initVertices; - std::vector< std::list > testVertices; + initVertices.reserve(vertices.size()); + std::transform(vertices.begin(), + vertices.end(), + std::back_inserter(initVertices), + [&](const Point& point) { + return alcc.create_vertex_attribute(point); + }); - std::string txt; - typename LCC::FT x, y; - Dart_handle d1=alcc.null_handle; - unsigned int v1, v2; - - unsigned int nbSommets = 0; - unsigned int nbAretes = 0; - - ais >> nbSommets >> nbAretes; - while (nbSommets > 0) - { - if (!ais.good()) - { - std::cout << "Problem: file does not contain enough vertices." - << std::endl; - return alcc.null_handle; - } - - ais >> iformat(x) >> iformat(y); - initVertices.push_back(alcc.create_vertex_attribute - (typename LCC::Point(x, y))); - testVertices.push_back(std::list()); - --nbSommets; - } - - while (nbAretes>0) - { - if (!ais.good()) - { - std::cout << "Problem: file does not contain enough edges." - << std::endl; - return alcc.null_handle; - } - - // We read an egde (given by the number of its two vertices). - ais >> v1 >> v2; - --nbAretes; + std::vector< std::list > testVertices{vertices.size(), std::list()}; + Dart_handle d1 = alcc.null_handle; + for (std::size_t i = 0; (i + 1) < edge_indices.size(); i += 2) { + const auto& v1 = edge_indices[i]; + const auto& v2 = edge_indices[i + 1]; CGAL_assertion(v1 < initVertices.size()); CGAL_assertion(v2 < initVertices.size()); @@ -103,7 +80,6 @@ namespace CGAL { Dart_handle first = alcc.null_handle; Dart_handle prec = alcc.null_handle; - typename LCC::Point sommet1, sommet2; for (unsigned int i=0; i - (typename LCC::Traits::Construct_direction_2() - (typename LCC::Traits::Construct_vector() - (sommet1,sommet2)), *it)); + (Construct_direction_2() + (Construct_vector() + (vertex1,vertex2)), *it)); ++it; while (it!=testVertices[i].end()) { - sommet2 = alcc.point(alcc.other_extremity(*it)); + vertex2 = alcc.point(alcc.other_extremity(*it)); tabDart.insert(std::pair - (typename LCC::Traits::Construct_direction_2() - (typename LCC::Traits::Construct_vector() - (sommet1,sommet2)), *it)); + (Construct_direction_2() + (Construct_vector() + (vertex1,vertex2)), *it)); ++it; } @@ -152,6 +128,64 @@ namespace CGAL { return first; } + /** + * Imports a plane-embedded graph from a file into a LinearCellComplex. + * + * @param alcc the linear cell complex where the graph will be imported. + * @param ais the istream where read the graph. + * @return A dart created during the convertion. + */ + template< class LCC > + typename LCC::Dart_handle import_from_plane_graph(LCC& alcc, + std::istream& ais) + { + using FT = typename LCC::FT; + using Point = typename LCC::Point; + + std::vector vertices; + unsigned int numVertices = 0; + unsigned int numEdges = 0; + ais >> numVertices >> numEdges; + while (numVertices > 0) + { + if (!ais.good()) + { + std::cout << "Problem: file does not contain enough vertices." + << std::endl; + return alcc.null_handle; + } + + FT x, y; + ais >> iformat(x) >> iformat(y); + vertices.push_back(Point{x, y}); + --numVertices; + } + + std::vector edge_indices; + while (numEdges>0) + { + if (!ais.good()) + { + std::cout << "Problem: file does not contain enough edges." + << std::endl; + return alcc.null_handle; + } + + // We read an edge (given by the number of its two vertices). + unsigned int v1, v2; + ais >> v1 >> v2; + --numEdges; + + CGAL_assertion(v1 < vertices.size()); + CGAL_assertion(v2 < vertices.size()); + + edge_indices.push_back(v1); + edge_indices.push_back(v2); + } + + return import_from_plane_graph(alcc, vertices, edge_indices); + } + template < class LCC > typename LCC::Dart_handle import_from_plane_graph(LCC& alcc, const char* filename) From 6ba3a6bae00d7aca1b15dba4f89e15281b1e4d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Thu, 25 Mar 2021 13:26:56 +0100 Subject: [PATCH 162/178] fix deprecated include path --- .../ETHZ/internal/random-forest/common-libraries.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp b/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp index 97e13f532ce..db3a049c47c 100644 --- a/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp +++ b/Classification/include/CGAL/Classification/ETHZ/internal/random-forest/common-libraries.hpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #if BOOST_VERSION >= 104700 From e3b0302b2b8d7a736f0d64d27fd2338f18200209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 26 Mar 2021 09:53:29 +0100 Subject: [PATCH 163/178] inherit from a std exception --- .../internal/Corefinement/intersection_impl.h | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_impl.h index b95da4e4c2b..eb59cf0357e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersection_impl.h @@ -30,12 +30,27 @@ #include #include +#include + namespace CGAL{ namespace Polygon_mesh_processing { namespace Corefinement { -struct Self_intersection_exception{}; -struct Triple_intersection_exception{}; +struct Self_intersection_exception : + public std::runtime_error +{ + Self_intersection_exception() + : std::runtime_error("Self-intersection detected in input mesh") + {} +}; + +struct Triple_intersection_exception : + public std::runtime_error +{ + Triple_intersection_exception() + : std::runtime_error("Non-handled triple intersection of input triangles") + {} +}; // This functor computes the pairwise intersection of triangle meshes. // Intersection are given as a set of polylines // The algorithm works as follow: From 48bb925b65342c6e68112041ed3c509c05fe56de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 26 Mar 2021 10:40:53 +0100 Subject: [PATCH 164/178] Fix inconsistency in robust projection code If the triangle/plane is degenerate, the case is handled separately. If we know the plane is not degenerate, the normal should not be recomputed in a different manner, which might lead to a null normal and some issues down the line. --- Kernel_23/include/CGAL/Kernel/function_objects.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index cd335df94fc..9907dbcc455 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2752,25 +2752,19 @@ namespace CommonKernelFunctors { bool is_inside_triangle_3(const typename K::Point_3& p, const typename K::Triangle_3& t, + const typename K::Vector_3& w, typename K::Point_3& result, const K& k) { typedef typename K::Point_3 Point_3; - typedef typename K::Vector_3 Vector_3; - typename K::Construct_vector_3 vector = - k.construct_vector_3_object(); typename K::Construct_vertex_3 vertex_on = k.construct_vertex_3_object(); - typename K::Construct_cross_product_vector_3 cross_product = - k.construct_cross_product_vector_3_object(); const Point_3& t0 = vertex_on(t,0); const Point_3& t1 = vertex_on(t,1); const Point_3& t2 = vertex_on(t,2); - Vector_3 w = cross_product(vector(t0,t1), vector(t1,t2)); - bool outside = false; if ( is_inside_triangle_3_aux(w, t0, t1, p, result, outside, k) || is_inside_triangle_3_aux(w, t1, t2, p, result, outside, k) @@ -2846,6 +2840,8 @@ namespace CommonKernelFunctors { typename K::Construct_projected_point_3 projection = k.construct_projected_point_3_object(); typename K::Is_degenerate_3 is_degenerate = k.is_degenerate_3_object(); + typename K::Construct_orthogonal_vector_3 normal = + k.construct_orthogonal_vector_3_object(); const typename K::Plane_3 plane = supporting_plane(triangle); if(is_degenerate(plane)) { @@ -2892,9 +2888,8 @@ namespace CommonKernelFunctors { // Project origin on triangle supporting plane const Point_3 proj = projection(plane, origin); - Point_3 moved_point; - bool inside = is_inside_triangle_3(proj,triangle,moved_point,k); + bool inside = is_inside_triangle_3(proj,triangle,normal(plane),moved_point,k); // If proj is inside triangle, return it if ( inside ) From b131bd9d25782b933db4b1fd75a246ce8ecf6b76 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 26 Mar 2021 10:49:34 +0100 Subject: [PATCH 165/178] Change the URL to internal release That will fix our documentation testsuite. --- Scripts/developer_scripts/autotest_cgal | 2 +- Scripts/developer_scripts/autotest_cgal_with_ctest | 2 +- Scripts/developer_scripts/run_doxygen_testsuite | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index 558256bc1b5..cbf481b7b31 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -60,7 +60,7 @@ WGET="wget" WGET_OPTS="--no-check-certificate --no-verbose" CURL="curl" CURL_OPTS="-k --remote-name --silent --location-trusted" -CGAL_URL="https://cgal.geometryfactory.com/CGAL/Members/Releases" +CGAL_URL="https://cgal.geometryfactory.com/CGAL/Releases" LATEST_LOCATION="${CGAL_URL}/LATEST" TAR="tar" GZIP="gzip" diff --git a/Scripts/developer_scripts/autotest_cgal_with_ctest b/Scripts/developer_scripts/autotest_cgal_with_ctest index 3cfe83b02c0..d5fe28ced9e 100755 --- a/Scripts/developer_scripts/autotest_cgal_with_ctest +++ b/Scripts/developer_scripts/autotest_cgal_with_ctest @@ -16,7 +16,7 @@ export WGET="wget" export WGET_OPTS="--no-check-certificate --no-verbose" export CURL="curl" export CURL_OPTS="-k --remote-name --silent --location-trusted" -export CGAL_URL="https://cgal.geometryfactory.com/CGAL/Members/Releases" +export CGAL_URL="https://cgal.geometryfactory.com/CGAL/Releases" export UPLOAD_RESULT_DESTINATION="cgaltest@cgaltest.geometryfactory.com:incoming" export LATEST_LOCATION="${CGAL_URL}/LATEST" export TAR="tar" diff --git a/Scripts/developer_scripts/run_doxygen_testsuite b/Scripts/developer_scripts/run_doxygen_testsuite index f5cd10a1f12..62e1a5d2eeb 100755 --- a/Scripts/developer_scripts/run_doxygen_testsuite +++ b/Scripts/developer_scripts/run_doxygen_testsuite @@ -22,8 +22,8 @@ function error() { exit 1 } -CGAL_URL="https://cgal.geometryfactory.com/CGAL/Members/Releases" -CURL_OPTS="--remote-name --silent -n" +CGAL_URL="https://cgal.geometryfactory.com/CGAL/Releases" +CURL_OPTS="--remote-name --silent --location --netrc" LATEST_LOCATION="${CGAL_URL}/LATEST" CGAL_DOC_BUILD="/home/cgal-testsuite/cgal_doc_build" From b680815c03d3ad4d92107aecb2afb6d43dcd8154 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 26 Mar 2021 10:50:02 +0100 Subject: [PATCH 166/178] Remove trailing whitespace --- Scripts/developer_scripts/autotest_cgal | 12 ++++++------ Scripts/developer_scripts/autotest_cgal_with_ctest | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Scripts/developer_scripts/autotest_cgal b/Scripts/developer_scripts/autotest_cgal index cbf481b7b31..b629bb2eace 100755 --- a/Scripts/developer_scripts/autotest_cgal +++ b/Scripts/developer_scripts/autotest_cgal @@ -653,7 +653,7 @@ EOF cat >> "$file" <> "${ACTUAL_LOGFILE}" +echo "Running `basename ${0}` "'$Revision$' >> "${ACTUAL_LOGFILE}" # Sanity checks if [ "${REFERENCE_PLATFORMS_DIR}" = "must_be_set_in_.autocgalrc" ]; then @@ -865,11 +865,11 @@ fi # Detects cygwin if uname | grep -q "CYGWIN"; then JOM="`which jom`" - if [ -e "$JOM" ]; then + if [ -e "$JOM" ]; then CMAKE_GENERATOR='-GNMake Makefiles JOM' MAKE_CMD='jom' log "${ACTUAL_LOGFILE}" "Cygwin detected, jom detected, using jom" - else + else CMAKE_GENERATOR='-GNMake Makefiles' MAKE_CMD='nmake' log "${ACTUAL_LOGFILE}" "Cygwin detected, using nmake" @@ -886,7 +886,7 @@ if [ -z "$IS_CYGWIN" ]; then lockfile -r 1 "$LOCK_FILE"; if [ ${?} != 0 ]; then PID=`cat "$LOCK_FILE"` - if kill -0 "$PID"; then + if kill -0 "$PID"; then log "${ACTUAL_LOGFILE}" "COULD NOT ACQUIRE LOCK! LOCKING PROCESS PID=$PID"; exit 1; else diff --git a/Scripts/developer_scripts/autotest_cgal_with_ctest b/Scripts/developer_scripts/autotest_cgal_with_ctest index d5fe28ced9e..1ae365c3ada 100755 --- a/Scripts/developer_scripts/autotest_cgal_with_ctest +++ b/Scripts/developer_scripts/autotest_cgal_with_ctest @@ -190,7 +190,7 @@ unzip_cgal() # Parse command line arguments for arg in "$@" do - case "$arg" in + case "$arg" in "-c") echo "Using latest unzipped release instead of getting a new one from the server" USE_LATEST_UNZIPPED="y" @@ -237,7 +237,7 @@ LOCK_FILE="${CGAL_HOME}/autotest_cgal_with_cmake.lock" ACTUAL_LOGFILE="${CGAL_HOME}/`basename ${0}`.log" rm -f "${ACTUAL_LOGFILE}" -echo "Running `basename ${0}` "'$Revision$' >> "${ACTUAL_LOGFILE}" +echo "Running `basename ${0}` "'$Revision$' >> "${ACTUAL_LOGFILE}" cd "$CGAL_HOME" From 2d82c8b3a9f97758dee92a981381dde2ec64a590 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 26 Mar 2021 11:11:48 +0100 Subject: [PATCH 167/178] Remove the link to Travis --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 80336987350..2d51a910d8a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![Build Status](https://travis-ci.org/CGAL/cgal.svg?branch=master)](https://travis-ci.org/CGAL/cgal) - ![CGAL](Installation/doc_html/images/cgal_2013_grey.png) The Computational Geometry Algorithms Library (CGAL) is a C++ library that From c70c0a511f2c7de5fbf79a8c786a7122464bce37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 29 Mar 2021 09:14:23 +0200 Subject: [PATCH 168/178] use initialized vector --- Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index 0beec86c962..f6a4a8f6bf5 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -747,7 +747,7 @@ test_new_3(const R& rep) = rep.oriented_side_3_object(); Oriented_side tmp39 = oriented_side(h2,p2); tmp39 = oriented_side(sp9,p2); - tmp39 = oriented_side(p2,v1,p2); + tmp39 = oriented_side(p2,v3,p2); (void) tmp39; typename R::Bounded_side_3 bounded_side From fe5f6556b9f78bcb1c25cb4d01521b90fc3ad710 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 29 Mar 2021 15:23:24 +0200 Subject: [PATCH 169/178] add a comment --- Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h index 96dac082ad3..ba583f69e7d 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Circle_3.h @@ -30,6 +30,7 @@ class CircleC3 { typedef typename R_::Direction_3 Direction_3; typedef typename R_::FT FT; + //using a boost::tuple because std::pair and tuple cannot work with incomplete types. typedef boost::tuple Rep; From 94f969149da57839cccf9de1d051d47a47871ca1 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Wed, 31 Mar 2021 10:50:05 +0200 Subject: [PATCH 170/178] [cleanup][surface_mesh] Remove unused and duplicate includes The includes became unnecessary after a735e84. --- Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp b/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp index 33ac1ef7dad..034b82b82bb 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp @@ -8,14 +8,6 @@ #include #include -#include -#include -#include - -#include -#include -#include - typedef CGAL::Exact_predicates_exact_constructions_kernel K; typedef K::Triangle_3 Triangle_3; From dc854d808836815a3fc5d314f114581a50e8a7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Wed, 31 Mar 2021 11:54:38 +0200 Subject: [PATCH 171/178] Use std::remove_if to speed-up invalid polygon removal --- .../repair_polygon_soup.h | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h index 782ba395cb9..9edd6c93205 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_polygon_soup.h @@ -316,27 +316,22 @@ template std::size_t remove_invalid_polygons_in_polygon_soup(PointRange& /*points*/, PolygonRange& polygons) { - std::vector to_remove; - const std::size_t ini_polygons_size = polygons.size(); - for(std::size_t polygon_index=0; polygon_index!=ini_polygons_size; ++polygon_index) - { - if(polygons[polygon_index].size() <= 2) - { + const auto rit = std::remove_if(polygons.begin(), polygons.end(), + [](auto& polygon) -> bool + { #ifdef CGAL_PMP_REPAIR_POLYGON_SOUP_VERBOSE_PP - std::cout << "Invalid polygon:"; - print_polygon(std::cout, polygons[polygon_index]); + if(polygon.size() <= 2) + { + std::cout << "Invalid polygon:"; + print_polygon(std::cout, polygon); + } #endif - to_remove.push_back(polygon_index); - } - } + return (polygon.size() <= 2); + }); - while(!to_remove.empty()) - { - polygons.erase(polygons.begin() + to_remove.back()); - to_remove.pop_back(); - } + const std::size_t removed_polygons_n = static_cast(std::distance(rit, polygons.end())); - const std::size_t removed_polygons_n = ini_polygons_size - polygons.size(); + polygons.erase(rit, polygons.end()); #ifdef CGAL_PMP_REPAIR_POLYGON_SOUP_VERBOSE if(removed_polygons_n > 0) From af81a6e1e53e7790780928e44721f4f8fb29697e Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Wed, 31 Mar 2021 12:16:46 +0200 Subject: [PATCH 172/178] [cleanup][surface_mesh] Fix include order from local to global --- Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp b/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp index 034b82b82bb..c6583404588 100644 --- a/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp +++ b/Surface_mesh/examples/Surface_mesh/sm_do_intersect.cpp @@ -1,13 +1,13 @@ -#include -#include -#include - #include #include #include #include +#include +#include +#include + typedef CGAL::Exact_predicates_exact_constructions_kernel K; typedef K::Triangle_3 Triangle_3; From 590aa1b4a66aa4ade6c616afdec876fa176e771a Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 31 Mar 2021 11:51:57 +0200 Subject: [PATCH 173/178] Fix out of scope references leading to segfaults --- .../Classification/example_cluster_classification.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Classification/examples/Classification/example_cluster_classification.cpp b/Classification/examples/Classification/example_cluster_classification.cpp index a8b8bdbe714..d9e58780295 100644 --- a/Classification/examples/Classification/example_cluster_classification.cpp +++ b/Classification/examples/Classification/example_cluster_classification.cpp @@ -82,7 +82,12 @@ int main (int argc, char** argv) #endif generator.generate_point_based_features (pointwise_features); - generator.generate_normal_based_features (pointwise_features, pts.normal_map()); + + // Generator should only be used with variables defined at the scope + // of the generator object, thus we instantiate the normal map + // outside of the function + Vmap normal_map = pts.normal_map(); + generator.generate_normal_based_features (pointwise_features, normal_map); #ifdef CGAL_LINKED_WITH_TBB pointwise_features.end_parallel_additions(); @@ -152,8 +157,8 @@ int main (int argc, char** argv) // First, compute means of features. features.begin_parallel_additions(); - for (Feature_handle fh : pointwise_features) - features.add (clusters, fh); + for (std::size_t i = 0; i < pointwise_features.size(); ++ i) + features.add (clusters, pointwise_features[i]); features.end_parallel_additions(); // Then, compute variances of features (and remaining cluster features). From e0ee8aaf426771faf93e469aeebac5b197045f5c Mon Sep 17 00:00:00 2001 From: Simon Giraudot Date: Wed, 31 Mar 2021 11:52:12 +0200 Subject: [PATCH 174/178] Fix memory leak by resetting unique ptr instead of releasing --- Classification/include/CGAL/Classification/Feature_set.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classification/include/CGAL/Classification/Feature_set.h b/Classification/include/CGAL/Classification/Feature_set.h index 2573c3abde6..16db586b634 100644 --- a/Classification/include/CGAL/Classification/Feature_set.h +++ b/Classification/include/CGAL/Classification/Feature_set.h @@ -228,7 +228,7 @@ public: { #ifdef CGAL_LINKED_WITH_TBB m_tasks->wait(); - m_tasks.release(); + m_tasks.reset(); m_adders.clear(); #endif } From f4a79aebd81bd2a2441685d999d3ddadc4f8bef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 31 Mar 2021 14:12:43 +0200 Subject: [PATCH 175/178] catch const ref --- .../test/Polygon_mesh_processing/test_autorefinement.cpp | 6 +++--- .../Operations_on_polyhedra/Clip_polyhedron_plugin.cpp | 8 ++++---- .../demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp | 4 ++-- .../Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp | 4 ++-- .../Plugins/PMP/Surface_intersection_plugin.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp index b6a91b4bd5c..eb8cf3a4654 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/test_autorefinement.cpp @@ -52,7 +52,7 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin assert(total_nb_points == total_nb_pt); assert( !triple_intersection ); } - catch(PMP::Corefinement::Triple_intersection_exception) + catch(const PMP::Corefinement::Triple_intersection_exception&) { assert( triple_intersection ); } @@ -67,7 +67,7 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin assert( (nb_vertices_before_autorefine!=nb_vertices_after_autorefine)== (*(visitor.i) != 0) ); assert( !triple_intersection ); } - catch(PMP::Corefinement::Triple_intersection_exception) + catch(const PMP::Corefinement::Triple_intersection_exception&) { assert( triple_intersection ); } @@ -83,7 +83,7 @@ void test(const char* fname, std::size_t nb_polylines, std::size_t total_nb_poin assert( nb_vertices_after_fix==num_vertices(mesh)); assert( !triple_intersection ); } - catch(PMP::Corefinement::Triple_intersection_exception) + catch(const PMP::Corefinement::Triple_intersection_exception&) { assert( triple_intersection ); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp index 7d51372d2bd..b5e059bb108 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp @@ -263,7 +263,7 @@ public Q_SLOTS: .allow_self_intersections(ui_widget.do_not_modify_CheckBox->isChecked())); } } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const GAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the region handled.")); } @@ -283,7 +283,7 @@ public Q_SLOTS: .allow_self_intersections(ui_widget.do_not_modify_CheckBox->isChecked())); } } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the region handled.")); } @@ -418,7 +418,7 @@ public Q_SLOTS: !ui_widget.coplanarCheckBox->isChecked()), CGAL::Polygon_mesh_processing::parameters::do_not_modify(ui_widget.do_not_modify_CheckBox->isChecked())); } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the region handled.")); } @@ -433,7 +433,7 @@ public Q_SLOTS: CGAL::Polygon_mesh_processing::parameters::throw_on_self_intersection(true), CGAL::Polygon_mesh_processing::parameters::do_not_modify(ui_widget.do_not_modify_CheckBox->isChecked())); } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the region handled.")); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp index b3084533368..8228ea5409b 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Corefinement_plugin.cpp @@ -159,7 +159,7 @@ private: scene->itemChanged(item2); scene->itemChanged(item1); } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the neighborhood of the intersection.")); } @@ -229,7 +229,7 @@ private: str_op = "Difference"; } } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the neighborhood of the intersection.")); QApplication::restoreOverrideCursor(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp index f16ad282266..0c7e1eba63e 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Repair_polyhedron_plugin.cpp @@ -257,7 +257,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefine_triggered(Sce try{ CGAL::Polygon_mesh_processing::experimental::autorefine(*poly_item->polyhedron()); } - catch(CGAL::Polygon_mesh_processing::Corefinement::Triple_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Triple_intersection_exception&) { CGAL::Three::Three::warning(tr("The result of the requested operation is not handled (triple intersection).")); } @@ -288,7 +288,7 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionAutorefineAndRMSelfInter if (!solved) CGAL::Three::Three::information(tr("Self-intersection could not be removed due to non-manifold edges in the output")); } - catch(CGAL::Polygon_mesh_processing::Corefinement::Triple_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Triple_intersection_exception&) { CGAL::Three::Three::warning(tr("The result of the requested operation is not handled (triple intersection).")); } diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp index 88de2f26dab..8134a7494b5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Surface_intersection_plugin.cpp @@ -139,7 +139,7 @@ void Polyhedron_demo_intersection_plugin::intersectionSurfaces() std::back_inserter(new_item->polylines), PMP::parameters::throw_on_self_intersection(true)); } - catch(CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { QMessageBox::warning((QWidget*)NULL, tr("Self-intersections Found"), From 3a409e6ac2b4618c4eeac3825783a265bf6a7159 Mon Sep 17 00:00:00 2001 From: Sebastien Loriot Date: Wed, 31 Mar 2021 14:16:56 +0200 Subject: [PATCH 176/178] Update Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp Co-authored-by: Laurent Rineau --- .../Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp index b5e059bb108..7fca6b934a2 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp @@ -263,7 +263,7 @@ public Q_SLOTS: .allow_self_intersections(ui_widget.do_not_modify_CheckBox->isChecked())); } } - catch(const GAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) + catch(const CGAL::Polygon_mesh_processing::Corefinement::Self_intersection_exception&) { CGAL::Three::Three::warning(tr("The requested operation is not possible due to the presence of self-intersections in the region handled.")); } From b1a537c80c47cf38b1103d678b7b4c527c04364a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 31 Mar 2021 16:35:24 +0200 Subject: [PATCH 177/178] add attention notice in Ceres about libunwind --- Documentation/doc/Documentation/Third_party.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/doc/Documentation/Third_party.txt b/Documentation/doc/Documentation/Third_party.txt index a7232b3b1af..3a26f64255a 100644 --- a/Documentation/doc/Documentation/Third_party.txt +++ b/Documentation/doc/Documentation/Third_party.txt @@ -310,6 +310,10 @@ requires solving complex non-linear least squares problems. Visit the official website of the library at `ceres-solver.org` for more information. +\attention \ceres indicates that `glog` is a recommended dependency. `glog` has `libunwind` as a recommended dependency. +On some platforms, linking with `libunwind` was responsible for an increase of the runtime of the final application. +If you experience such an issue, we recommand to compile \ceres without `glog` support. + \subsection thirdpartyGLPK GLPK \glpk (GNU Linear Programming Kit) is a library for solving linear programming (LP), mixed integer programming (MIP), and other related problems. From 5213cd3bfe50e351d96ccad2daa50e1528d913f5 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 1 Apr 2021 18:11:42 +0100 Subject: [PATCH 178/178] replace include --- Nef_3/include/CGAL/Nef_3/ID_support_handler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h index 2d7e28d1674..53a946a0fd6 100644 --- a/Nef_3/include/CGAL/Nef_3/ID_support_handler.h +++ b/Nef_3/include/CGAL/Nef_3/ID_support_handler.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include
Type1
Type1 Type2 `T...`