From 0c690014b7cdb25ef6b957cfe348a6b2f26b0358 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 25 Aug 2016 14:38:16 +0200 Subject: [PATCH] Remove all usage of CGAL_LEDA_VERSION Now, LEDA version >= 6.0 is required if `CGAL_USE_LEDA` is toggled. --- .../Arrangement_on_surface_2/arr_bench.cpp | 4 -- .../Arr_spherical_gaussian_map_3.h | 4 -- .../include/CGAL/Regular_complex_d.h | 4 -- Kernel_23/include/CGAL/kernel_to_kernel.h | 4 -- LEDA/include/CGAL/LEDA_basic.h | 4 -- .../CGAL/IO/Nef_polyhedron_2_PS_stream.h | 6 --- Nef_2/include/CGAL/Nef_2/gen_point_location.h | 4 -- Nef_S2/include/CGAL/Nef_S2/leda_sphere_map.h | 5 --- Number_types/include/CGAL/leda_bigfloat.h | 4 -- .../include/CGAL/leda_bigfloat_interval.h | 4 -- .../include/CGAL/leda_coercion_traits.h | 21 --------- Number_types/include/CGAL/leda_integer.h | 17 ------- Number_types/include/CGAL/leda_rational.h | 44 ++++--------------- Number_types/include/CGAL/leda_real.h | 30 ------------- Number_types/test/Number_types/leda_real.cpp | 4 -- Polynomial/include/CGAL/Polynomial.h | 6 +-- .../include/CGAL/Handle_with_policy.h | 6 +-- 17 files changed, 10 insertions(+), 161 deletions(-) diff --git a/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/arr_bench.cpp b/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/arr_bench.cpp index f80b73ff31b..86e299c27ad 100644 --- a/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/arr_bench.cpp +++ b/Arrangement_on_surface_2/benchmark/Arrangement_on_surface_2/arr_bench.cpp @@ -48,11 +48,7 @@ enum MaxFilesNumber { // Stream: #if BENCH_KERNEL == LEDA_KERNEL || BENCH_KERNEL == MY_KERNEL #if defined(USE_CGAL_WINDOW) -#if CGAL_LEDA_VERSION < 500 -#include -#else #include -#endif #else #include #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h index 3e8f798a1e4..93c659e893b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_spherical_gaussian_map_3/Arr_spherical_gaussian_map_3.h @@ -42,12 +42,8 @@ #include #if defined(CGAL_USE_LEDA) -#if CGAL_LEDA_VERSION < 500 -#include -#else #include #endif -#endif namespace CGAL { diff --git a/Convex_hull_d/include/CGAL/Regular_complex_d.h b/Convex_hull_d/include/CGAL/Regular_complex_d.h index 363973167b3..0cea6f64ef8 100644 --- a/Convex_hull_d/include/CGAL/Regular_complex_d.h +++ b/Convex_hull_d/include/CGAL/Regular_complex_d.h @@ -42,12 +42,8 @@ #include #ifdef CGAL_USE_LEDA -#if CGAL_LEDA_VERSION < 500 -#include -#else #include #endif -#endif namespace CGAL { diff --git a/Kernel_23/include/CGAL/kernel_to_kernel.h b/Kernel_23/include/CGAL/kernel_to_kernel.h index 5c3f8c84646..f96ee015dc9 100644 --- a/Kernel_23/include/CGAL/kernel_to_kernel.h +++ b/Kernel_23/include/CGAL/kernel_to_kernel.h @@ -30,12 +30,8 @@ #ifdef CGAL_USE_LEDA #include #include -#if CGAL_LEDA_VERSION < 500 -#include -#else #include #endif -#endif #include #include diff --git a/LEDA/include/CGAL/LEDA_basic.h b/LEDA/include/CGAL/LEDA_basic.h index 5eec9bd390b..df44b4d7ed3 100644 --- a/LEDA/include/CGAL/LEDA_basic.h +++ b/LEDA/include/CGAL/LEDA_basic.h @@ -33,11 +33,7 @@ // The following is needed for LEDA 4.4 due to min/max problems... # define LEDA_NO_MIN_MAX_TEMPL -#if CGAL_LEDA_VERSION < 500 -#include -#else #include -#endif #ifdef LEDA_NAMESPACE # define CGAL_LEDA_SCOPE leda diff --git a/Nef_2/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h b/Nef_2/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h index 58206b4d98f..c12fd5c2bb6 100644 --- a/Nef_2/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h +++ b/Nef_2/include/CGAL/IO/Nef_polyhedron_2_PS_stream.h @@ -22,15 +22,9 @@ #define CGAL_NEF_POLYHEDRON_2_PS_STREAM_H #include -#if CGAL_LEDA_VERSION < 500 -#include -#include -#include -#else #include #include #include -#endif namespace CGAL { static int frame_default = 100; diff --git a/Nef_2/include/CGAL/Nef_2/gen_point_location.h b/Nef_2/include/CGAL/Nef_2/gen_point_location.h index 536ada6426c..b51c9b92203 100644 --- a/Nef_2/include/CGAL/Nef_2/gen_point_location.h +++ b/Nef_2/include/CGAL/Nef_2/gen_point_location.h @@ -23,11 +23,7 @@ #define CGAL_NEF_2_GEN_POINT_LOCATION_H #include -#if CGAL_LEDA_VERSION < 500 -#include -#else #include -#endif #include #include #include diff --git a/Nef_S2/include/CGAL/Nef_S2/leda_sphere_map.h b/Nef_S2/include/CGAL/Nef_S2/leda_sphere_map.h index 20ac01cb356..ea3edcc7942 100644 --- a/Nef_S2/include/CGAL/Nef_S2/leda_sphere_map.h +++ b/Nef_S2/include/CGAL/Nef_S2/leda_sphere_map.h @@ -24,13 +24,8 @@ #include #include #include -#if CGAL_LEDA_VERSION < 500 -#include -#include -#else #include #include -#endif #undef CGAL_NEF_DEBUG #define CGAL_NEF_DEBUG 211 diff --git a/Number_types/include/CGAL/leda_bigfloat.h b/Number_types/include/CGAL/leda_bigfloat.h index 3b57085e646..67a322f122f 100644 --- a/Number_types/include/CGAL/leda_bigfloat.h +++ b/Number_types/include/CGAL/leda_bigfloat.h @@ -32,11 +32,7 @@ #include #include -#if CGAL_LEDA_VERSION < 500 -#include -#else #include -#endif namespace CGAL { diff --git a/Number_types/include/CGAL/leda_bigfloat_interval.h b/Number_types/include/CGAL/leda_bigfloat_interval.h index 8f26e52db9a..71dacbe3dfb 100644 --- a/Number_types/include/CGAL/leda_bigfloat_interval.h +++ b/Number_types/include/CGAL/leda_bigfloat_interval.h @@ -26,11 +26,7 @@ #include #include -#if CGAL_LEDA_VERSION < 500 -#include -#else #include -#endif #include diff --git a/Number_types/include/CGAL/leda_coercion_traits.h b/Number_types/include/CGAL/leda_coercion_traits.h index 7fe27810e4a..ccf3581a97a 100644 --- a/Number_types/include/CGAL/leda_coercion_traits.h +++ b/Number_types/include/CGAL/leda_coercion_traits.h @@ -31,17 +31,10 @@ #ifdef CGAL_USE_LEDA #include -#if CGAL_LEDA_VERSION < 500 -#include -#include -#include -#include -#else #include #include #include #include -#endif namespace CGAL { @@ -107,21 +100,7 @@ struct Coercion_traits< ::leda::bigfloat ,::leda::rational >{ typedef Type result_type; Type operator()(const ::leda::rational& x) const { return x;} Type operator()(const ::leda::bigfloat& x) const { -#if CGAL_LEDA_VERSION < 500 - ::leda::integer e = x.get_exponent(); - ::leda::integer s = x.get_significant(); - if(e<0) { - ::leda::bigfloat b_two_to_e = ::leda::ipow2(-e); - ::leda::integer two_to_e = ::leda::floor(b_two_to_e); - return ::leda::rational(s,two_to_e); - } - // e >= 0 - ::leda::bigfloat b_two_to_e = ::leda::ipow2(e); - ::leda::integer two_to_e = ::leda::floor(b_two_to_e); - return ::leda::rational(s * two_to_e); -#else return x.to_rational(); -#endif } }; }; diff --git a/Number_types/include/CGAL/leda_integer.h b/Number_types/include/CGAL/leda_integer.h index d9737b32cd6..22ed66a0172 100644 --- a/Number_types/include/CGAL/leda_integer.h +++ b/Number_types/include/CGAL/leda_integer.h @@ -33,13 +33,8 @@ #include #include -#if CGAL_LEDA_VERSION < 500 -#include -#include // for To_interval -#else #include #include // for To_interval -#endif #include #include @@ -116,18 +111,6 @@ template <> class Algebraic_structure_traits< leda_integer > // public: // Type operator()( const Type& x, const Type& y ) const { // Type m = x % y; -// #if CGAL_LEDA_VERSION < 520 -// // Fix wrong leda result -// if( x < 0 && m != 0 ) -// m -= y; -// #elif CGAL_LEDA_VERSION < 600 -// // Fix another wrong leda result -// if( x < 0 && y > 0 && m != 0 ) -// m -= y; -// #else -// // Do nothing, it seems to work now! -// // TODO: be careful for future improvements of LEDA -// #endif // return m; // } // CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR( Type ) diff --git a/Number_types/include/CGAL/leda_rational.h b/Number_types/include/CGAL/leda_rational.h index 903e3a14545..13bfb7cd0eb 100644 --- a/Number_types/include/CGAL/leda_rational.h +++ b/Number_types/include/CGAL/leda_rational.h @@ -37,19 +37,14 @@ #include #include -#if CGAL_LEDA_VERSION < 500 -# include -# include -#else -# include -# if defined( _MSC_VER ) -# pragma push_macro("ERROR") -# undef ERROR -# endif // _MSC_VER -# include -# if defined( _MSC_VER ) -# pragma pop_macro("ERROR") -# endif +#include +#if defined( _MSC_VER ) +# pragma push_macro("ERROR") +# undef ERROR +#endif // _MSC_VER +#include +#if defined( _MSC_VER ) +# pragma pop_macro("ERROR") #endif #include // for GCD in Fraction_traits @@ -121,35 +116,12 @@ template <> class Real_embeddable_traits< leda_rational > public: std::pair operator()( const Type& x ) const { -#if CGAL_LEDA_VERSION >= 501 CGAL_LEDA_SCOPE::interval temp(x); std::pair result(temp.lower_bound(),temp.upper_bound()); CGAL_assertion_code( double infinity=std::numeric_limits::infinity(); ) CGAL_postcondition(result.first == -infinity || Type(result.first)<=x); CGAL_postcondition(result.second == infinity || Type(result.second)>=x); return result; -#else - CGAL_LEDA_SCOPE::bigfloat xnum = x.numerator(); - CGAL_LEDA_SCOPE::bigfloat xden = x.denominator(); - CGAL_LEDA_SCOPE::bigfloat xupp = - div(xnum,xden,53,CGAL_LEDA_SCOPE::TO_P_INF); - CGAL_LEDA_SCOPE::bigfloat xlow = - div(xnum,xden,53,CGAL_LEDA_SCOPE::TO_N_INF); - - // really smallest positive double - double MinDbl = CGAL_LEDA_SCOPE::fp::compose_parts(0,0,0,1); - - double low = xlow.to_double(); - while(Type(low) > x) low = low - MinDbl; - - double upp = xupp.to_double(); - while(Type(upp) < x) upp = upp + MinDbl; - - std::pair result(low,upp); - CGAL_postcondition(Type(result.first)<=x); - CGAL_postcondition(Type(result.second)>=x); - return result; -#endif // Original CGAL to_interval (seemed to be inferior) // // There's no guarantee about the error of to_double(), so I add // // 3 ulps... diff --git a/Number_types/include/CGAL/leda_real.h b/Number_types/include/CGAL/leda_real.h index b25aa39354b..3766b5fcc6b 100644 --- a/Number_types/include/CGAL/leda_real.h +++ b/Number_types/include/CGAL/leda_real.h @@ -35,25 +35,15 @@ #include #include -#if CGAL_LEDA_VERSION < 500 -#include -#include -#else #include -#endif namespace CGAL { template <> class Algebraic_structure_traits< leda_real > -#if CGAL_LEDA_VERSION >= 500 : public Algebraic_structure_traits_base< leda_real, Field_with_root_of_tag > { -#else - : public Algebraic_structure_traits_base< leda_real, - Field_with_kth_root_tag > { -#endif public: typedef Tag_true Is_exact; @@ -78,7 +68,6 @@ template <> class Algebraic_structure_traits< leda_real > }; // Root_of is only available for LEDA versions >= 5.0 -#if CGAL_LEDA_VERSION >= 500 class Root_of { public: typedef Type result_type; @@ -112,7 +101,6 @@ template <> class Algebraic_structure_traits< leda_real > };*/ }; -#endif }; @@ -166,7 +154,6 @@ template <> class Real_embeddable_traits< leda_real > public: std::pair operator()( const Type& x ) const { -#if CGAL_LEDA_VERSION >= 501 leda_bigfloat bnum = x.to_bigfloat(); leda_bigfloat berr = x.get_bigfloat_error(); @@ -180,23 +167,6 @@ template <> class Real_embeddable_traits< leda_real > CGAL_postcondition(Type(result.first)<=x); CGAL_postcondition(Type(result.second)>=x); return result; -#else - CGAL_LEDA_SCOPE::interval temp(x); //bug in leda - std::pair result(temp.lower_bound(),temp.upper_bound()); - CGAL_postcondition_msg(Type(result.first)<=x, - "Known bug in LEDA <=5.0"); - CGAL_postcondition_msg(Type(result.first)>=x, - "Known bug in LEDA <=5.0"); - return result; - // If x is very small and we look closer at x - // (i.e. comparison or to_double() or to_bigfloat()) - // then x gets 0, which is really bad. - // Therefore we do not touch x. - // The LEDA interval above returns (-inf, inf) for - // very small x, which is also bad and leads to - // problems lateron. The postcondition fails in this - // situation. -#endif // Original CGAL to_interval: // Protect_FPU_rounding P (CGAL_FE_TONEAREST); // double approx = z.to_double(); diff --git a/Number_types/test/Number_types/leda_real.cpp b/Number_types/test/Number_types/leda_real.cpp index 26e74940fb1..429229fec62 100644 --- a/Number_types/test/Number_types/leda_real.cpp +++ b/Number_types/test/Number_types/leda_real.cpp @@ -9,11 +9,7 @@ int main() { typedef leda_real NT; -#if CGAL_LEDA_VERSION >= 500 typedef CGAL::Field_with_root_of_tag Tag; -#else - typedef CGAL::Field_with_kth_root_tag Tag; -#endif typedef CGAL::Tag_true Is_exact; CGAL::test_algebraic_structure(); diff --git a/Polynomial/include/CGAL/Polynomial.h b/Polynomial/include/CGAL/Polynomial.h index 76ce642b0e1..9fd3cfeb82e 100644 --- a/Polynomial/include/CGAL/Polynomial.h +++ b/Polynomial/include/CGAL/Polynomial.h @@ -48,11 +48,7 @@ #include #ifdef CGAL_USE_LEDA -#if CGAL_LEDA_VERSION >= 500 -#include -#else -#include -#endif +# include #endif // CGAL_USE_LEDA #include diff --git a/STL_Extension/include/CGAL/Handle_with_policy.h b/STL_Extension/include/CGAL/Handle_with_policy.h index 905a5435758..478e95707a3 100644 --- a/STL_Extension/include/CGAL/Handle_with_policy.h +++ b/STL_Extension/include/CGAL/Handle_with_policy.h @@ -34,11 +34,7 @@ #include #ifdef CGAL_USE_LEDA -# if CGAL_LEDA_VERSION < 500 -# include -# else -# include -# endif +# include #endif