From 634fe394bad2e1a6f3e5c85488fbed7f31007cdf Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Wed, 30 Dec 2020 19:56:58 +0100 Subject: [PATCH 1/6] Skip filtering on trivial predicates --- .../CGAL/NewKernel_d/Cartesian_LA_functors.h | 6 +++--- .../CGAL/NewKernel_d/Cartesian_filter_K.h | 18 ++++++++++++------ .../CGAL/NewKernel_d/Filtered_predicate2.h | 1 + .../include/CGAL/NewKernel_d/Lazy_cartesian.h | 4 +++- .../CGAL/NewKernel_d/Types/Hyperplane.h | 2 +- .../include/CGAL/NewKernel_d/Types/Sphere.h | 2 +- .../NewKernel_d/function_objects_cartesian.h | 12 ++++++------ .../CGAL/NewKernel_d/functor_properties.h | 2 +- 8 files changed, 28 insertions(+), 19 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h index b717a80bac4..365760185cd 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h @@ -137,7 +137,7 @@ template struct Compute_cartesian_coordinate { typedef typename Get_type::type RT; typedef typename R::Vector_ first_argument_type; typedef int second_argument_type; - typedef Tag_true Is_exact; + typedef Tag_true Uses_no_arithmetic; typedef decltype(std::declval()[0]) result_type; template @@ -153,7 +153,7 @@ template struct Construct_cartesian_const_iterator { typedef typename R::LA_vector S_; typedef typename R::Point_cartesian_const_iterator result_type; // same as Vector - typedef Tag_true Is_exact; + typedef Tag_true Uses_no_arithmetic; result_type operator()(argument_type const& v,Begin_tag)const{ return S_::vector_begin(v); @@ -282,7 +282,7 @@ template struct PV_dimension { typedef typename R::Vector_ argument_type; typedef int result_type; typedef typename R::LA_vector LA; - typedef Tag_true Is_exact; + typedef Tag_true Uses_no_arithmetic; template result_type operator()(T const& v) const { diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h index ed164e844da..c02efa6dcc6 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h @@ -42,7 +42,7 @@ template<> struct Functors_without_division > { }; // FIXME: -// - Is_exact (which should be renamed to Uses_no_arithmetic) predicates should not be filtered +// - Uses_no_arithmetic predicates should not be filtered // - Functors_without_division should be defined near/in the actual functors template < typename Base_, typename AK_, typename EK_, typename Pred_list = typeset_all > @@ -78,18 +78,24 @@ struct Cartesian_filter_K : public Base_ // TODO: only fix some types, based on some criterion? template struct Type : Get_type {}; - template::type, bool=Pred_list::template contains::value> struct Functor : - Inherit_functor {}; - template struct Functor { + template::type>::value> struct Pred_helper { typedef typename Get_functor::type AP; typedef typename Get_functor::type EP; typedef Filtered_predicate2 type; }; + // Less_cartesian_coordinate doesn't usually need filtering + // This fixes the predicate, as opposed to Inherit_functor which would leave it open (is that good?) + template struct Pred_helper : + Get_functor {}; + + template::type, bool=Pred_list::template contains::value> struct Functor : + Inherit_functor {}; + template struct Functor : + Pred_helper {}; + // TODO: // template struct Functor : // Kernel_base::template Functor {}; -// TODO: -// detect when Less_cartesian_coordinate doesn't need filtering }; } //namespace CGAL diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h index c3d2281ad96..5a0d6f20255 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h @@ -39,6 +39,7 @@ namespace CGAL { // not, or we let all this up to the compiler optimizer to figure out ? // - Some caching could be done at the Point_2 level. +// FIXME: understand and document what the parameter 'Protection' means exactly template class Filtered_predicate2 diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h index 56ecd5df953..e0bd33da4ca 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Lazy_cartesian.h @@ -294,7 +294,9 @@ struct Lazy_cartesian : template struct Functor { typedef typename Get_functor::type FA; typedef typename Get_functor::type FE; - typedef Filtered_predicate2 type; + // Careful if operator< for Interval_nt ever starts using arithmetic... + // Not done directly in Filtered_predicate2 because of C2A + typedef Filtered_predicate2::value> type; }; template struct Functor { typedef Lazy_construction2 type; diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h index c3c1de8adb9..7cf4f2189ed 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Hyperplane.h @@ -127,7 +127,7 @@ template struct Hyperplane_translation { CGAL_FUNCTOR_INIT_IGNORE(Hyperplane_translation) typedef typename Get_type::type Hyperplane; typedef typename Get_type::type result_type; - // TODO: Is_exact? + // TODO: Uses_no_arithmetic? result_type operator()(Hyperplane const&s)const{ return s.translation(); } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h b/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h index 92a5aa65c0b..19d601c6b6d 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Types/Sphere.h @@ -83,7 +83,7 @@ template struct Squared_radius { CGAL_FUNCTOR_INIT_IGNORE(Squared_radius) typedef typename Get_type::type Sphere; typedef typename Get_type::type const& result_type; - // TODO: Is_exact? + // TODO: Uses_no_arithmetic? result_type operator()(Sphere const&s)const{ return s.squared_radius(); } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h index 3ab117131dc..605db974423 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/function_objects_cartesian.h @@ -1108,7 +1108,7 @@ template struct Less_point_cartesian_coordinate : private Store_kernel typedef typename Get_functor::type Cc; // TODO: This is_exact thing should be reengineered. // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + typedef typename CGAL::Uses_no_arithmetic Uses_no_arithmetic; template result_type operator()(V const&a, W const&b, I i)const{ @@ -1128,7 +1128,7 @@ template struct Compare_point_cartesian_coordinate : private Store_ker typedef typename Get_functor::type Cc; // TODO: This is_exact thing should be reengineered. // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + typedef typename CGAL::Uses_no_arithmetic Uses_no_arithmetic; template result_type operator()(V const&a, W const&b, I i)const{ @@ -1148,7 +1148,7 @@ template struct Compare_lexicographically : private Store_kernel { typedef typename Get_functor >::type CI; // TODO: This is_exact thing should be reengineered. // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + typedef typename CGAL::Uses_no_arithmetic Uses_no_arithmetic; template result_type operator()(V const&a, W const&b)const{ @@ -1176,7 +1176,7 @@ template struct Less_lexicographically : private Store_kernel { typedef R_ R; typedef typename Get_type::type result_type; typedef typename Get_functor::type CL; - typedef typename CGAL::Is_exact Is_exact; + typedef typename CGAL::Uses_no_arithmetic Uses_no_arithmetic; template result_type operator() (V const&a, W const&b) const { @@ -1194,7 +1194,7 @@ template struct Less_or_equal_lexicographically : private Store_kernel typedef R_ R; typedef typename Get_type::type result_type; typedef typename Get_functor::type CL; - typedef typename CGAL::Is_exact Is_exact; + typedef typename CGAL::Uses_no_arithmetic Uses_no_arithmetic; template result_type operator() (V const&a, W const&b) const { @@ -1214,7 +1214,7 @@ template struct Equal_points : private Store_kernel { typedef typename Get_functor >::type CI; // TODO: This is_exact thing should be reengineered. // the goal is to have a way to tell: don't filter this - typedef typename CGAL::Is_exact Is_exact; + typedef typename CGAL::Uses_no_arithmetic Uses_no_arithmetic; template result_type operator()(V const&a, W const&b)const{ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/functor_properties.h b/NewKernel_d/include/CGAL/NewKernel_d/functor_properties.h index eb2f767c7a2..f8608d9fd4d 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/functor_properties.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/functor_properties.h @@ -24,7 +24,7 @@ namespace CGAL { template \ struct Is_pretty : T::Is_pretty {} -CGAL_STRAWBERRY(Is_exact); +CGAL_STRAWBERRY(Uses_no_arithmetic); CGAL_STRAWBERRY(Is_fast); CGAL_STRAWBERRY(Is_stored); #undef CGAL_STRAWBERRY From caef69cdef5f9fe7c6175fc9ea2e3242f546d997 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Wed, 30 Dec 2020 23:28:03 +0100 Subject: [PATCH 2/6] Protection parameter of Filtered_predicate2 --- Filtered_kernel/include/CGAL/Filtered_predicate.h | 4 ++++ NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Filtered_kernel/include/CGAL/Filtered_predicate.h b/Filtered_kernel/include/CGAL/Filtered_predicate.h index 63199a63a32..da9e4b1c4fb 100644 --- a/Filtered_kernel/include/CGAL/Filtered_predicate.h +++ b/Filtered_kernel/include/CGAL/Filtered_predicate.h @@ -37,6 +37,10 @@ namespace CGAL { // not, or we let all this up to the compiler optimizer to figure out ? // - Some caching could be done at the Point_2 level. +// Protection is undocumented and currently always true, meaning that it +// assumes a default rounding mode of round-to-nearest. false would correspond +// to a default of round-towards-infinity, so interval arithmetic does not +// require protection but regular code may. template class Filtered_predicate diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h index 5a0d6f20255..2064af0b986 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Filtered_predicate2.h @@ -39,7 +39,11 @@ namespace CGAL { // not, or we let all this up to the compiler optimizer to figure out ? // - Some caching could be done at the Point_2 level. -// FIXME: understand and document what the parameter 'Protection' means exactly +// Protection has a different meaning than in Filtered_predicate, it says +// whether we need to set the rounding mode: some predicates only do +// comparisons and don't need it. Probably this should be done inside this +// class, based on Uses_no_arithmetic, but I have some doubts about C2A, +// converting a long long to Interval_nt requires protection. template class Filtered_predicate2 @@ -88,7 +92,6 @@ public: catch (Uncertain_conversion_exception&) {} } CGAL_BRANCH_PROFILER_BRANCH(tmp); - Protect_FPU_rounding p(CGAL_FE_TONEAREST); return ep(c2e(std::forward(args))...); } }; From ece8478a904413a466a0bd90e8a4d7f4c33f8bc3 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Thu, 31 Dec 2020 16:23:31 +0100 Subject: [PATCH 3/6] static filter for 2d Side_of_oriented_sphere --- .../NewKernel_d/Cartesian_static_filters.h | 70 +++++++++++++------ 1 file changed, 49 insertions(+), 21 deletions(-) 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..24b35fb4969 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_static_filters.h @@ -15,37 +15,46 @@ #include #include // bug, should be included by the next one #include +#include #include namespace CGAL { namespace SFA { // static filter adapter // Note that this would be quite a bit simpler without stateful kernels +template struct Adapter_2 { + typedef typename Get_type::type Point; + typedef typename Get_functor::type CC; + typedef typename Get_functor::type Orientation_base; + typedef typename Get_functor::type Side_of_oriented_circle_base; + 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_){} + decltype(auto) x()const{return c(p,0);} + decltype(auto) y()const{return c(p,1);} + }; + struct Vector_2 {}; + struct Circle_2 {}; + struct Orientation_2 { + typedef typename Get_type::type result_type; + auto operator()(Point_2 const&A, Point_2 const&B, Point_2 const&C)const{ + Point const* t[3]={&A.p,&B.p,&C.p}; + return Orientation_base(A.r)(make_transforming_iterator(t+0),make_transforming_iterator(t+3)); + } + }; + struct Side_of_oriented_circle_2 { + typedef typename Get_type::type result_type; + auto operator()(Point_2 const&A, Point_2 const&B, Point_2 const&C, Point_2 const&D)const{ + Point const* t[3]={&A.p,&B.p,&C.p}; + return Side_of_oriented_circle_base(A.r)(make_transforming_iterator(t+0),make_transforming_iterator(t+3),D.p); + } + }; +}; template struct Orientation_of_points_2 : private Store_kernel { CGAL_FUNCTOR_INIT_STORE(Orientation_of_points_2) typedef typename Get_type::type Point; typedef typename Get_type::type result_type; - typedef typename Get_type::type FT; typedef typename Get_functor::type CC; - typedef typename Get_functor::type Orientation_base; - // TODO: Move this out for easy reuse - struct Adapter { - 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);} - }; - struct Vector_2 {}; - struct Circle_2 {}; - struct Orientation_2 { - typedef typename Orientation_of_points_2::result_type result_type; - result_type operator()(Point_2 const&A, Point_2 const&B, Point_2 const&C)const{ - Point const* t[3]={&A.p,&B.p,&C.p}; - return Orientation_base(A.r)(make_transforming_iterator(t+0),make_transforming_iterator(t+3)); - } - }; - }; + typedef Adapter_2 Adapter; template result_type operator()(Iter f, Iter CGAL_assertion_code(e))const{ CC c(this->kernel()); Point const& A=*f; @@ -56,6 +65,22 @@ template struct Orientation_of_points_2 : private Store_k return typename internal::Static_filters_predicates::Orientation_2()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C)); } }; +template struct Side_of_oriented_sphere_2 : private Store_kernel { + CGAL_FUNCTOR_INIT_STORE(Side_of_oriented_sphere_2) + typedef typename Get_type::type Point; + typedef typename Get_type::type result_type; + typedef typename Get_functor::type CC; + typedef Adapter_2 Adapter; + template result_type operator()(Iter f, Iter CGAL_assertion_code(e), Point const& D)const{ + CC c(this->kernel()); + Point const& A=*f; + Point const& B=*++f; + Point const& C=*++f; + CGAL_assertion(++f==e); + typedef typename Adapter::Point_2 P; + return typename internal::Static_filters_predicates::Side_of_oriented_circle_2()(P(this->kernel(),c,A),P(this->kernel(),c,B),P(this->kernel(),c,C),P(this->kernel(),c,D)); + } +}; } template @@ -80,6 +105,9 @@ struct Cartesian_static_filters, R_, Derived_> : public R_ { // >::type type; }; + template struct Functor { + typedef SFA::Side_of_oriented_sphere_2 type; + }; }; } From cf54055b820482d9ad1f7d730b60df95e5873b64 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Sun, 14 Feb 2021 01:16:52 +0100 Subject: [PATCH 4/6] bitrot in Kernel_[23]_interface --- .../include/CGAL/NewKernel_d/Cartesian_LA_functors.h | 2 +- NewKernel_d/include/CGAL/NewKernel_d/Kernel_2_interface.h | 6 ++++-- NewKernel_d/include/CGAL/NewKernel_d/Kernel_3_interface.h | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h index b717a80bac4..a3d64cbc7c2 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_LA_functors.h @@ -50,7 +50,7 @@ template struct Construct_LA_vector // Makes no sense for an unknown dimension. return typename Constructor::Dimension()(this->kernel().dimension()); } - result_type operator()(result_type const& v)const{ + result_type const& operator()(result_type const& v)const{ return v; } result_type operator()(result_type&& v)const{ diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_2_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_2_interface.h index d1515d152fc..3d6d588b142 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_2_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_2_interface.h @@ -79,10 +79,11 @@ template struct Kernel_2_interface : public Base_ { Side_of_oriented_circle_2(Kernel const&k):sos(k){} result_type operator()(Point_2 const&a, Point_2 const&b, Point_2 const&c, Point_2 const&d) { //return sos(a,b,c,d); - Point_2 const* t[4]={&a,&b,&c,&d}; - return sos(make_transforming_iterator(t+0),make_transforming_iterator(t+4)); + Point_2 const* t[4]={&a,&b,&c}; + return sos(make_transforming_iterator(t+0),make_transforming_iterator(t+3), d); } }; + typedef typename Get_functor >::type Construct_point_2; Less_x_2 less_x_2_object()const{ return Less_x_2(*this); } Less_y_2 less_y_2_object()const{ return Less_y_2(*this); } Compare_x_2 compare_x_2_object()const{ return Compare_x_2(*this); } @@ -90,6 +91,7 @@ template struct Kernel_2_interface : public Base_ { Compare_distance_2 compare_distance_2_object()const{ return Compare_distance_2(*this); } Orientation_2 orientation_2_object()const{ return Orientation_2(*this); } Side_of_oriented_circle_2 side_of_oriented_circle_2_object()const{ return Side_of_oriented_circle_2(*this); } + Construct_point_2 construct_point_2_object()const{ return Construct_point_2(*this); } }; } diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_3_interface.h b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_3_interface.h index 6c85a4161b9..de0258ea492 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Kernel_3_interface.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Kernel_3_interface.h @@ -76,10 +76,11 @@ template struct Kernel_3_interface : public Base_ { Side_of_oriented_sphere_3(Kernel const&k):sos(k){} result_type operator()(Point_3 const&a, Point_3 const&b, Point_3 const&c, Point_3 const&d, Point_3 const&e) { //return sos(a,b,c,d); - Point_3 const* t[5]={&a,&b,&c,&d,&e}; - return sos(make_transforming_iterator(t+0),make_transforming_iterator(t+5)); + Point_3 const* t[5]={&a,&b,&c,&d}; + return sos(make_transforming_iterator(t+0),make_transforming_iterator(t+4),e); } }; + typedef typename Get_functor >::type Construct_point_3; // I don't have the Coplanar predicates (yet) @@ -88,6 +89,7 @@ template struct Kernel_3_interface : public Base_ { Compare_distance_3 compare_distance_3_object()const{ return Compare_distance_3(*this); } Orientation_3 orientation_3_object()const{ return Orientation_3(*this); } Side_of_oriented_sphere_3 side_of_oriented_sphere_3_object()const{ return Side_of_oriented_sphere_3(*this); } + Construct_point_3 construct_point_3_object()const{ return Construct_point_3(*this); } }; } From 82fa63d7209534fe4695bcfec239b939d8206677 Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 15 Feb 2021 21:06:38 +0100 Subject: [PATCH 5/6] New benchmark/test. --- NewKernel_d/test/NewKernel_d/tri2.cpp | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 NewKernel_d/test/NewKernel_d/tri2.cpp diff --git a/NewKernel_d/test/NewKernel_d/tri2.cpp b/NewKernel_d/test/NewKernel_d/tri2.cpp new file mode 100644 index 00000000000..eab4e5d2d62 --- /dev/null +++ b/NewKernel_d/test/NewKernel_d/tri2.cpp @@ -0,0 +1,77 @@ +// Benchmark on the construction of Delaunay 2D with Epick (Kernel_23) vs +// something based on NewKernel_d that uses Eigen::Vector2d as Point_2. +#if __cpp_aligned_new >= 201606L +#if 1 +#define CGAL_NEWKERNEL_D_USE_EIGEN_VECTOR 1 +#include +#include +#include + +namespace CGAL { +struct Epick_2_help1 +: Cartesian_filter_K< + Cartesian_base_d>, + Cartesian_base_d>, + Cartesian_base_d::Type, CGAL::Dimension_tag<2>> + > +{ +}; +struct Epick_2_help2 +: Cartesian_filter_K< + Epick_2_help1, + Cartesian_base_d>, + Cartesian_base_d::Type, CGAL::Dimension_tag<2>>, + Functors_without_division>::type + > +{ }; +struct Epick_2 +: Kernel_2_interface,Epick_2_help2>> +{ }; +template <> +struct Triangulation_structural_filtering_traits { + typedef Tag_true Use_structural_filtering_tag; +}; +} +typedef CGAL::Epick_2 K; +static_assert(std::is_same::value, ""); +#else +#include +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +#endif + +#include +#include +#include +#include +#include + +typedef CGAL::Delaunay_triangulation_2 DT; +typedef DT::Point Point_2; + +int main(int argc,char** argv) +{ + int n = (argc > 1) ? atoi(argv[1]) : 100000; + std::vector points; + points.reserve( n ); + + std::mt19937 gen(1234); + std::uniform_real_distribution<> dis(1.0, 2.0); + for(int i=0;i +int main(){ + std::cerr << "This program requires C++17 or later.\n"; +} +#endif From bf2940de3d8924c4ffe6f822f23f678ec0076b1d Mon Sep 17 00:00:00 2001 From: Marc Glisse Date: Mon, 15 Feb 2021 21:29:17 +0100 Subject: [PATCH 6/6] Tell cmake to build those tests... --- NewKernel_d/test/NewKernel_d/CMakeLists.txt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/NewKernel_d/test/NewKernel_d/CMakeLists.txt b/NewKernel_d/test/NewKernel_d/CMakeLists.txt index c039a4e45b0..931c38db9a0 100644 --- a/NewKernel_d/test/NewKernel_d/CMakeLists.txt +++ b/NewKernel_d/test/NewKernel_d/CMakeLists.txt @@ -18,13 +18,20 @@ find_package(CGAL REQUIRED) find_package(Eigen3) include(CGAL_Eigen3_support) if(TARGET CGAL::Eigen3_support) - create_single_source_cgal_program("Epick_d.cpp") - target_link_libraries(Epick_d PUBLIC CGAL::Eigen3_support) + file( + GLOB cppfiles + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) + foreach(cppfile ${cppfiles}) + get_filename_component(target ${cppfile} NAME_WE) + create_single_source_cgal_program("${cppfile}") + target_link_libraries(${target} PUBLIC CGAL::Eigen3_support) + endforeach() else() message( STATUS - "NOTICE: This program requires the Eigen3 library, and will not be compiled." + "NOTICE: These programs require the Eigen3 library, and will not be compiled." ) endif()