diff --git a/Arrangement_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h b/Arrangement_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h index e7a105de6d4..6e0b4d4f96f 100755 --- a/Arrangement_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h +++ b/Arrangement_2/include/CGAL/Arr_point_location/Arr_lm_grid_generator.h @@ -42,14 +42,16 @@ CGAL_BEGIN_NAMESPACE * to creates the set of landmarks on the grid. * the size of the grid is determined by the number of landmarks. */ -template +template class Arr_grid_landmarks_generator : public Arr_observer { public: - typedef Arrangement_ Arrangement_2; + typedef Arrangement_ Arrangement_2; + typedef NT_ NT; + typedef Arr_grid_landmarks_generator Self; + typedef typename Arrangement_2::Traits_2 Traits_2; - typedef Arr_grid_landmarks_generator Self; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Halfedge_const_handle Halfedge_const_handle; @@ -62,13 +64,6 @@ public: typedef typename Traits_2::Approximate_number_type ANT; -#ifdef SEGMENTS - typedef typename Traits_2::Kernel::FT FT; -#elif defined (CONICS) - typedef CGAL::CORE_algebraic_number_traits Nt_traits; - typedef Nt_traits::Algebraic FT; -#endif - typedef typename Traits_2::Point_2 Point_2; typedef std::vector Points_set; @@ -90,7 +85,7 @@ protected: //bounding box of the arrangement ANT x_min, x_max, y_min, y_max; - FT step_x, step_y; + NT step_x, step_y; int sqrt_n; private: @@ -271,8 +266,8 @@ protected: //calculate the step size sqrt_n = static_cast (std::sqrt(static_cast (n)) + 0.99999); - FT delta_x = right.x() - left.x(); - FT delta_y = top.y() - bottom.y(); + NT delta_x = right.x() - left.x(); + NT delta_y = top.y() - bottom.y(); step_x = delta_x / (sqrt_n-1); step_y = delta_y / (sqrt_n-1); diff --git a/Arrangement_2/test/Arrangement_2/cgal_test b/Arrangement_2/test/Arrangement_2/cgal_test index de35d7851b9..f9f73750e46 100755 --- a/Arrangement_2/test/Arrangement_2/cgal_test +++ b/Arrangement_2/test/Arrangement_2/cgal_test @@ -171,7 +171,7 @@ compile_and_run_trapped_test() test_segment_traits() { # function executable number type kernel traits - compile_test test_traits $CGAL_GMPQ_NT $CARTESIAN_KERNEL $SEGMENT_TRAITS + compile_test test_traits $QUOTIENT_MP_FLOAT_NT $CARTESIAN_KERNEL $SEGMENT_TRAITS if [ ${res} -eq 0 ] ; then echo " ERROR: not executed test_traits" >> $ERRORFILE else @@ -193,7 +193,7 @@ test_segment_traits() test_non_caching_segment_traits() { # function executable number type kernel traits - compile_test test_traits $CGAL_GMPQ_NT $CARTESIAN_KERNEL $NON_CACHING_SEGMENT_TRAITS + compile_test test_traits $QUOTIENT_MP_FLOAT_NT $CARTESIAN_KERNEL $NON_CACHING_SEGMENT_TRAITS if [ ${res} -eq 0 ] ; then echo " ERROR: not executed test_traits" >> $ERRORFILE else @@ -215,7 +215,7 @@ test_non_caching_segment_traits() test_polyline_traits() { # function executable number type kernel traits - compile_test test_traits $CGAL_GMPQ_NT $CARTESIAN_KERNEL $POLYLINE_TRAITS + compile_test test_traits $QUOTIENT_MP_FLOAT_NT $CARTESIAN_KERNEL $POLYLINE_TRAITS if [ ${res} -eq 0 ] ; then echo " ERROR: not executed test_traits" >> $ERRORFILE else @@ -237,7 +237,7 @@ test_polyline_traits() test_non_caching_polyline_traits() { # function executable number type kernel traits - compile_test test_traits $CGAL_GMPQ_NT $CARTESIAN_KERNEL $NON_CACHING_POLYLINE_TRAITS + compile_test test_traits $QUOTIENT_MP_FLOAT_NT $CARTESIAN_KERNEL $NON_CACHING_POLYLINE_TRAITS if [ ${res} -eq 0 ] ; then echo " ERROR: not executed test_traits" >> $ERRORFILE else diff --git a/Arrangement_2/test/Arrangement_2/point_location.C b/Arrangement_2/test/Arrangement_2/point_location.C index 3a5150d8739..a7a09cdf1bd 100755 --- a/Arrangement_2/test/Arrangement_2/point_location.C +++ b/Arrangement_2/test/Arrangement_2/point_location.C @@ -1,28 +1,26 @@ +#include -//#define CONICS -#define SEGMENTS -//#define SEGMENTS_IN_DOUBLE +#ifdef CGAL_USE_GMP + + #include + + typedef CGAL::Gmpq Number_type; + +#else + #include + #include + + typedef CGAL::Quotient Number_type; + +#endif #include #include #include #include -#ifdef SEGMENTS -#include #include -#elif defined (CONICS) -#include -#include -#endif - -#ifdef SEGMENTS_IN_DOUBLE -#include "Segment_reader_double.h" -#elif defined (SEGMENTS) #include "Segment_reader.h" -#elif defined (CONICS) -#include "Conic_reader.h" -#endif #include #include @@ -32,31 +30,12 @@ #include #include -#ifdef SEGMENTS //#include #include -#endif -#ifdef SEGMENTS -typedef CGAL::Gmpq Number_type; typedef CGAL::Cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Traits_2; -#elif defined (CONICS) -typedef CGAL::CORE_algebraic_number_traits Nt_traits; -typedef Nt_traits::Rational Rational; -typedef Nt_traits::Rational Number_type; -typedef Nt_traits::Algebraic Algebraic; -typedef CGAL::Cartesian Rat_kernel; -typedef Rat_kernel::Point_2 Rat_point_2; -typedef Rat_kernel::Segment_2 Rat_segment_2; -typedef Rat_kernel::Circle_2 Rat_circle_2; -typedef CGAL::Cartesian Alg_kernel; -typedef CGAL::Arr_conic_traits_2 Traits_2; -#endif - typedef Traits_2::Point_2 Point_2; typedef Traits_2::Curve_2 Curve_2; typedef Traits_2::X_monotone_curve_2 Segment_2; @@ -77,7 +56,7 @@ typedef CGAL::Arr_random_landmarks_generator Random_lm_generator; typedef CGAL::Arr_landmarks_point_location Lm_random_point_location; -typedef CGAL::Arr_grid_landmarks_generator +typedef CGAL::Arr_grid_landmarks_generator Grid_lm_generator; typedef CGAL::Arr_landmarks_point_location Lm_grid_point_location; @@ -85,14 +64,13 @@ typedef CGAL::Arr_halton_landmarks_generator Halton_lm_generator; typedef CGAL::Arr_landmarks_point_location Lm_halton_point_location; -#ifdef SEGMENTS typedef CGAL::Arr_middle_edges_landmarks_generator Mide_lm_generator; typedef CGAL::Arr_landmarks_point_location Lm_mide_point_location; //typedef CGAL::Arr_triangulation_point_location // Trg_point_location; -#endif + // ===> Add new point location type here <=== typedef std::list Points_list; @@ -103,11 +81,7 @@ typedef Objects_vector::iterator Object_iterator; // ===> Change the number of point-location startegies // when a new point location is added. <=== -#ifdef SEGMENTS #define NUM_OF_POINT_LOCATION_STRATEGIES 8 -#else -#define NUM_OF_POINT_LOCATION_STRATEGIES 7 -#endif /*! */ int check_point_location (Arrangement_2 &arr, Points_list &plist) @@ -158,7 +132,6 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) std::cout << "Halton lm construction took " << timer.time() < Add new point location instance here. <=== @@ -271,9 +243,7 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist) } timer.stop(); ///END std::cout << "Halton LM location took " << timer.time() < Add a call to operate the the new point location. <=== @@ -433,12 +402,8 @@ int read_points(const char * points_filename, Points_list &plist) bool test(const char* curves_filename, const char* points_filename) { - //read curves and insert them into the arrangement -#ifdef SEGMENTS + //read curves and insert them into the arrangement Segment_reader reader; -#elif defined (CONICS) - Conic_reader reader; -#endif CGAL::Bbox_2 bbox; Curve_list curve_list; diff --git a/Arrangement_2/test/Arrangement_2/test_configuration.h b/Arrangement_2/test/Arrangement_2/test_configuration.h index c1c67439a6e..c06e65093c2 100644 --- a/Arrangement_2/test/Arrangement_2/test_configuration.h +++ b/Arrangement_2/test/Arrangement_2/test_configuration.h @@ -42,7 +42,7 @@ #endif #if !defined(TEST_NT) -#define TEST_NT LEDA_RAT_NT +#define TEST_NT QUOTIENT_MP_FLOAT_NT #endif #if !defined(TEST_TRAITS) diff --git a/Arrangement_2/test/Arrangement_2/test_construction.C b/Arrangement_2/test/Arrangement_2/test_construction.C index ce1ada36855..40fda63dc5a 100644 --- a/Arrangement_2/test/Arrangement_2/test_construction.C +++ b/Arrangement_2/test/Arrangement_2/test_construction.C @@ -1,10 +1,20 @@ +#include +#ifdef CGAL_USE_GMP + + #include + + typedef CGAL::Gmpq Number_type; + +#else + #include + #include + + typedef CGAL::Quotient Number_type; + +#endif #include -#include -#include -#include - #include #include #include @@ -45,12 +55,15 @@ public: }; template -bool are_same_results(Arrangement& arr, - unsigned int n_v, - unsigned int n_e, - unsigned int n_f, - const std::vector &pts_from_file, - const std::vector& subcurves_from_file) +bool are_same_results + (Arrangement& arr, + unsigned int n_v, + unsigned int n_e, + unsigned int n_f, + const std::vector& + pts_from_file, + const std::vector& + subcurves_from_file) { typedef typename Arrangement::Traits_2 Traits_2; typedef typename Arrangement::Point_2 Point_2; @@ -92,13 +105,13 @@ bool are_same_results(Arrangement& arr, std::sort(curves_res.begin(), curves_res.end(), Curve_compare()); Curve_equal curve_eq; - if(!std::equal(curves_res.begin(), curves_res.end(), subcurves_from_file.begin(), curve_eq)) + if (! std::equal (curves_res.begin(), curves_res.end(), + subcurves_from_file.begin(), curve_eq)) return false; return true; } -typedef CGAL::Gmpq Number_type; typedef CGAL::Simple_cartesian Kernel; typedef CGAL::Arr_segment_traits_2 Base_traits_2; typedef Base_traits_2::Curve_2 Base_curve_2; @@ -165,33 +178,41 @@ bool test_one_file(std::ifstream& in_file) { CGAL::insert_curve(arr, curves[i]); } - if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || - !CGAL::is_valid(arr)) + if (! are_same_results (arr, + n_vertices, n_edges, n_faces, + pts_from_file, subcurves_from_file) || + ! CGAL::is_valid(arr)) { std::cout<<"ERROR : insert_curve failed\n"; return false; } - arr.clear(); + arr.clear(); //////////////////////////////////////////////////////////// // test aggregate construction CGAL::insert_curves(arr, curves.begin(), curves.end()); - if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || - !CGAL::is_valid(arr)) + if (! are_same_results (arr, + n_vertices, n_edges, n_faces, + pts_from_file, subcurves_from_file) || + ! CGAL::is_valid(arr)) { std::cout<<"ERROR : insert_curves failed\n"; return false; } arr.clear(); + ///////////////////////////////////////////////////////////// - // insert half of the curves aggregatley and than insert the rest aggregatley - //(test the addition visitor) + // insert half of the curves aggregatley and than insert the rest + // aggregatley (test the addition visitor) CGAL::insert_curves(arr, curves.begin(), curves.begin() + (num_of_curves/2)); CGAL::insert_curves(arr, curves.begin() + (num_of_curves/2), curves.end()); - if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || - !CGAL::is_valid(arr)) + + if (! are_same_results (arr, + n_vertices, n_edges, n_faces, + pts_from_file, subcurves_from_file) || + ! CGAL::is_valid(arr)) { std::cout<<"ERROR : insert_curves (addition) failed\n"; return false; @@ -210,8 +231,10 @@ bool test_one_file(std::ifstream& in_file) CGAL::insert_point(arr, iso_verts[i]); } - if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || - !CGAL::is_valid(arr)) + if (! are_same_results (arr, + n_vertices, n_edges, n_faces, + pts_from_file, subcurves_from_file) || + ! CGAL::is_valid(arr)) { std::cout<<"ERROR : insert_x_monotone_curve failed\n"; return false; @@ -219,13 +242,17 @@ bool test_one_file(std::ifstream& in_file) arr.clear(); ///////////////////////////////////////////////////////////////////// // insert the disjoint subcurves aggregatley with insert_x_monotone_curves - CGAL::insert_x_monotone_curves(arr, subcurves_from_file.begin(), subcurves_from_file.end()); + CGAL::insert_x_monotone_curves (arr, + subcurves_from_file.begin(), + subcurves_from_file.end()); for(i=0; i