Fixed the test suite so that it can function also when GMP is not installed.

This commit is contained in:
Ron Wein 2006-03-12 10:41:39 +00:00
parent dcbb71487c
commit a56b61093b
5 changed files with 131 additions and 117 deletions

View File

@ -42,14 +42,16 @@ CGAL_BEGIN_NAMESPACE
* to creates the set of landmarks on the grid. * to creates the set of landmarks on the grid.
* the size of the grid is determined by the number of landmarks. * the size of the grid is determined by the number of landmarks.
*/ */
template <class Arrangement_> template <class Arrangement_, class NT_>
class Arr_grid_landmarks_generator class Arr_grid_landmarks_generator
: public Arr_observer <Arrangement_> : public Arr_observer <Arrangement_>
{ {
public: public:
typedef Arrangement_ Arrangement_2; typedef Arrangement_ Arrangement_2;
typedef NT_ NT;
typedef Arr_grid_landmarks_generator<Arrangement_2, NT> Self;
typedef typename Arrangement_2::Traits_2 Traits_2; typedef typename Arrangement_2::Traits_2 Traits_2;
typedef Arr_grid_landmarks_generator<Arrangement_2> Self;
typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator; typedef typename Arrangement_2::Vertex_const_iterator Vertex_const_iterator;
typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle; typedef typename Arrangement_2::Vertex_const_handle Vertex_const_handle;
typedef typename Arrangement_2::Halfedge_const_handle Halfedge_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; 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 typename Traits_2::Point_2 Point_2;
typedef std::vector<Point_2> Points_set; typedef std::vector<Point_2> Points_set;
@ -90,7 +85,7 @@ protected:
//bounding box of the arrangement //bounding box of the arrangement
ANT x_min, x_max, y_min, y_max; ANT x_min, x_max, y_min, y_max;
FT step_x, step_y; NT step_x, step_y;
int sqrt_n; int sqrt_n;
private: private:
@ -271,8 +266,8 @@ protected:
//calculate the step size //calculate the step size
sqrt_n = static_cast<int> (std::sqrt(static_cast<double> (n)) + 0.99999); sqrt_n = static_cast<int> (std::sqrt(static_cast<double> (n)) + 0.99999);
FT delta_x = right.x() - left.x(); NT delta_x = right.x() - left.x();
FT delta_y = top.y() - bottom.y(); NT delta_y = top.y() - bottom.y();
step_x = delta_x / (sqrt_n-1); step_x = delta_x / (sqrt_n-1);
step_y = delta_y / (sqrt_n-1); step_y = delta_y / (sqrt_n-1);

View File

@ -171,7 +171,7 @@ compile_and_run_trapped_test()
test_segment_traits() test_segment_traits()
{ {
# function executable number type kernel 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 if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed test_traits" >> $ERRORFILE echo " ERROR: not executed test_traits" >> $ERRORFILE
else else
@ -193,7 +193,7 @@ test_segment_traits()
test_non_caching_segment_traits() test_non_caching_segment_traits()
{ {
# function executable number type kernel 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 if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed test_traits" >> $ERRORFILE echo " ERROR: not executed test_traits" >> $ERRORFILE
else else
@ -215,7 +215,7 @@ test_non_caching_segment_traits()
test_polyline_traits() test_polyline_traits()
{ {
# function executable number type kernel 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 if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed test_traits" >> $ERRORFILE echo " ERROR: not executed test_traits" >> $ERRORFILE
else else
@ -237,7 +237,7 @@ test_polyline_traits()
test_non_caching_polyline_traits() test_non_caching_polyline_traits()
{ {
# function executable number type kernel 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 if [ ${res} -eq 0 ] ; then
echo " ERROR: not executed test_traits" >> $ERRORFILE echo " ERROR: not executed test_traits" >> $ERRORFILE
else else

View File

@ -1,28 +1,26 @@
#include <CGAL/basic.h>
//#define CONICS #ifdef CGAL_USE_GMP
#define SEGMENTS
//#define SEGMENTS_IN_DOUBLE #include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type;
#else
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
#endif
#include <CGAL/Cartesian.h> #include <CGAL/Cartesian.h>
#include <CGAL/Arrangement_2.h> #include <CGAL/Arrangement_2.h>
#include <CGAL/Timer.h> #include <CGAL/Timer.h>
#include <cstdlib> #include <cstdlib>
#ifdef SEGMENTS
#include <CGAL/Gmpq.h>
#include <CGAL/Arr_segment_traits_2.h> #include <CGAL/Arr_segment_traits_2.h>
#elif defined (CONICS)
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_conic_traits_2.h>
#endif
#ifdef SEGMENTS_IN_DOUBLE
#include "Segment_reader_double.h"
#elif defined (SEGMENTS)
#include "Segment_reader.h" #include "Segment_reader.h"
#elif defined (CONICS)
#include "Conic_reader.h"
#endif
#include <CGAL/Arr_naive_point_location.h> #include <CGAL/Arr_naive_point_location.h>
#include <CGAL/Arr_walk_along_line_point_location.h> #include <CGAL/Arr_walk_along_line_point_location.h>
@ -32,31 +30,12 @@
#include <CGAL/Arr_point_location/Arr_lm_grid_generator.h> #include <CGAL/Arr_point_location/Arr_lm_grid_generator.h>
#include <CGAL/Arr_point_location/Arr_lm_halton_generator.h> #include <CGAL/Arr_point_location/Arr_lm_halton_generator.h>
#ifdef SEGMENTS
//#include <CGAL/Arr_triangulation_point_location.h> //#include <CGAL/Arr_triangulation_point_location.h>
#include <CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h> #include <CGAL/Arr_point_location/Arr_lm_middle_edges_generator.h>
#endif
#ifdef SEGMENTS
typedef CGAL::Gmpq Number_type;
typedef CGAL::Cartesian<Number_type> Kernel; typedef CGAL::Cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Traits_2; typedef CGAL::Arr_segment_traits_2<Kernel> 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<Rational> 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<Algebraic> Alg_kernel;
typedef CGAL::Arr_conic_traits_2<Rat_kernel,
Alg_kernel,
Nt_traits> Traits_2;
#endif
typedef Traits_2::Point_2 Point_2; typedef Traits_2::Point_2 Point_2;
typedef Traits_2::Curve_2 Curve_2; typedef Traits_2::Curve_2 Curve_2;
typedef Traits_2::X_monotone_curve_2 Segment_2; typedef Traits_2::X_monotone_curve_2 Segment_2;
@ -77,7 +56,7 @@ typedef CGAL::Arr_random_landmarks_generator<Arrangement_2>
Random_lm_generator; Random_lm_generator;
typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Random_lm_generator> typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Random_lm_generator>
Lm_random_point_location; Lm_random_point_location;
typedef CGAL::Arr_grid_landmarks_generator<Arrangement_2> typedef CGAL::Arr_grid_landmarks_generator<Arrangement_2, Number_type>
Grid_lm_generator; Grid_lm_generator;
typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Grid_lm_generator> typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Grid_lm_generator>
Lm_grid_point_location; Lm_grid_point_location;
@ -85,14 +64,13 @@ typedef CGAL::Arr_halton_landmarks_generator<Arrangement_2>
Halton_lm_generator; Halton_lm_generator;
typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Halton_lm_generator> typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Halton_lm_generator>
Lm_halton_point_location; Lm_halton_point_location;
#ifdef SEGMENTS
typedef CGAL::Arr_middle_edges_landmarks_generator<Arrangement_2> typedef CGAL::Arr_middle_edges_landmarks_generator<Arrangement_2>
Mide_lm_generator; Mide_lm_generator;
typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Mide_lm_generator> typedef CGAL::Arr_landmarks_point_location<Arrangement_2, Mide_lm_generator>
Lm_mide_point_location; Lm_mide_point_location;
//typedef CGAL::Arr_triangulation_point_location<Arrangement_2> //typedef CGAL::Arr_triangulation_point_location<Arrangement_2>
// Trg_point_location; // Trg_point_location;
#endif
// ===> Add new point location type here <=== // ===> Add new point location type here <===
typedef std::list<Point_2> Points_list; typedef std::list<Point_2> Points_list;
@ -103,11 +81,7 @@ typedef Objects_vector::iterator Object_iterator;
// ===> Change the number of point-location startegies // ===> Change the number of point-location startegies
// when a new point location is added. <=== // when a new point location is added. <===
#ifdef SEGMENTS
#define NUM_OF_POINT_LOCATION_STRATEGIES 8 #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) 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() <<std::endl; std::cout << "Halton lm construction took " << timer.time() <<std::endl;
//std::cout << ' ' << timer.time() ; //std::cout << ' ' << timer.time() ;
#ifdef SEGMENTS
timer.reset(); timer.start(); timer.reset(); timer.start();
Mide_lm_generator mide_g(arr); Mide_lm_generator mide_g(arr);
Lm_mide_point_location mide_lm_pl (arr, &mide_g); // 7 Lm_mide_point_location mide_lm_pl (arr, &mide_g); // 7
@ -169,7 +142,6 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist)
//Trg_point_location trg_pl(arr); // 8 //Trg_point_location trg_pl(arr); // 8
//timer.stop(); //timer.stop();
//std::cout << "Trg construction took " << timer.time() <<std::endl; //std::cout << "Trg construction took " << timer.time() <<std::endl;
#endif
std::cout<< std::endl; std::cout<< std::endl;
// ===> Add new point location instance here. <=== // ===> Add new point location instance here. <===
@ -271,9 +243,7 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist)
} }
timer.stop(); ///END timer.stop(); ///END
std::cout << "Halton LM location took " << timer.time() <<std::endl; std::cout << "Halton LM location took " << timer.time() <<std::endl;
// std::cout << ' ' << timer.time() ;
#ifdef SEGMENTS
std::cout << "Middle edges LM" ; std::cout << "Middle edges LM" ;
timer.reset(); timer.reset();
timer.start(); //START timer.start(); //START
@ -297,7 +267,6 @@ int check_point_location (Arrangement_2 &arr, Points_list &plist)
//} //}
//timer.stop(); ///END //timer.stop(); ///END
//std::cout << " location took " << timer.time() <<std::endl; //std::cout << " location took " << timer.time() <<std::endl;
#endif
std::cout << std::endl; std::cout << std::endl;
// ===> Add a call to operate the the new point location. <=== // ===> Add a call to operate the the new point location. <===
@ -434,11 +403,7 @@ int read_points(const char * points_filename, Points_list &plist)
bool test(const char* curves_filename, const char* points_filename) bool test(const char* curves_filename, const char* points_filename)
{ {
//read curves and insert them into the arrangement //read curves and insert them into the arrangement
#ifdef SEGMENTS
Segment_reader<Traits_2> reader; Segment_reader<Traits_2> reader;
#elif defined (CONICS)
Conic_reader<Traits_2> reader;
#endif
CGAL::Bbox_2 bbox; CGAL::Bbox_2 bbox;
Curve_list curve_list; Curve_list curve_list;

View File

@ -42,7 +42,7 @@
#endif #endif
#if !defined(TEST_NT) #if !defined(TEST_NT)
#define TEST_NT LEDA_RAT_NT #define TEST_NT QUOTIENT_MP_FLOAT_NT
#endif #endif
#if !defined(TEST_TRAITS) #if !defined(TEST_TRAITS)

View File

@ -1,10 +1,20 @@
#include <CGAL/basic.h>
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpq.h>
typedef CGAL::Gmpq Number_type;
#else
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
#endif
#include <CGAL/Simple_cartesian.h> #include <CGAL/Simple_cartesian.h>
#include <CGAL/MP_Float.h>
#include <CGAL/Quotient.h>
#include <CGAL/Gmpq.h>
#include <CGAL/Arr_segment_traits_2.h> #include <CGAL/Arr_segment_traits_2.h>
#include<CGAL/Arr_curve_data_traits_2.h> #include<CGAL/Arr_curve_data_traits_2.h>
#include <CGAL/Arrangement_2.h> #include <CGAL/Arrangement_2.h>
@ -45,12 +55,15 @@ public:
}; };
template <class Arrangement> template <class Arrangement>
bool are_same_results(Arrangement& arr, bool are_same_results
(Arrangement& arr,
unsigned int n_v, unsigned int n_v,
unsigned int n_e, unsigned int n_e,
unsigned int n_f, unsigned int n_f,
const std::vector<typename Arrangement::Point_2> &pts_from_file, const std::vector<typename Arrangement::Point_2>&
const std::vector<typename Arrangement::X_monotone_curve_2>& subcurves_from_file) pts_from_file,
const std::vector<typename Arrangement::X_monotone_curve_2>&
subcurves_from_file)
{ {
typedef typename Arrangement::Traits_2 Traits_2; typedef typename Arrangement::Traits_2 Traits_2;
typedef typename Arrangement::Point_2 Point_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<Traits_2>()); std::sort(curves_res.begin(), curves_res.end(), Curve_compare<Traits_2>());
Curve_equal<Traits_2> curve_eq; Curve_equal<Traits_2> 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 false;
return true; return true;
} }
typedef CGAL::Gmpq Number_type;
typedef CGAL::Simple_cartesian<Number_type> Kernel; typedef CGAL::Simple_cartesian<Number_type> Kernel;
typedef CGAL::Arr_segment_traits_2<Kernel> Base_traits_2; typedef CGAL::Arr_segment_traits_2<Kernel> Base_traits_2;
typedef Base_traits_2::Curve_2 Base_curve_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]); CGAL::insert_curve(arr, curves[i]);
} }
if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || if (! are_same_results (arr,
!CGAL::is_valid(arr)) n_vertices, n_edges, n_faces,
pts_from_file, subcurves_from_file) ||
! CGAL::is_valid(arr))
{ {
std::cout<<"ERROR : insert_curve failed\n"; std::cout<<"ERROR : insert_curve failed\n";
return false; return false;
} }
arr.clear();
arr.clear();
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// test aggregate construction // test aggregate construction
CGAL::insert_curves(arr, curves.begin(), curves.end()); 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) || if (! are_same_results (arr,
!CGAL::is_valid(arr)) n_vertices, n_edges, n_faces,
pts_from_file, subcurves_from_file) ||
! CGAL::is_valid(arr))
{ {
std::cout<<"ERROR : insert_curves failed\n"; std::cout<<"ERROR : insert_curves failed\n";
return false; return false;
} }
arr.clear(); arr.clear();
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// insert half of the curves aggregatley and than insert the rest aggregatley // insert half of the curves aggregatley and than insert the rest
//(test the addition visitor) // aggregatley (test the addition visitor)
CGAL::insert_curves(arr, curves.begin(), curves.begin() + (num_of_curves/2)); CGAL::insert_curves(arr, curves.begin(), curves.begin() + (num_of_curves/2));
CGAL::insert_curves(arr, curves.begin() + (num_of_curves/2), curves.end()); 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"; std::cout<<"ERROR : insert_curves (addition) failed\n";
return false; return false;
@ -210,8 +231,10 @@ bool test_one_file(std::ifstream& in_file)
CGAL::insert_point(arr, iso_verts[i]); CGAL::insert_point(arr, iso_verts[i]);
} }
if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || if (! are_same_results (arr,
!CGAL::is_valid(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"; std::cout<<"ERROR : insert_x_monotone_curve failed\n";
return false; return false;
@ -219,13 +242,17 @@ bool test_one_file(std::ifstream& in_file)
arr.clear(); arr.clear();
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// insert the disjoint subcurves aggregatley with insert_x_monotone_curves // 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<iso_verts.size(); ++i) for(i=0; i<iso_verts.size(); ++i)
{ {
CGAL::insert_point(arr, iso_verts[i]); CGAL::insert_point(arr, iso_verts[i]);
} }
if(!are_same_results(arr, n_vertices, n_edges, n_faces, pts_from_file, subcurves_from_file) || if (! are_same_results (arr,
!CGAL::is_valid(arr)) n_vertices, n_edges, n_faces,
pts_from_file, subcurves_from_file) ||
! CGAL::is_valid(arr))
{ {
std::cout<<"ERROR : insert_x_monotone_curves failed\n"; std::cout<<"ERROR : insert_x_monotone_curves failed\n";
return false; return false;
@ -234,16 +261,23 @@ bool test_one_file(std::ifstream& in_file)
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// insert half of the disjoint subcurves aggregatley and than insert the rest aggregatley // insert half of the disjoint subcurves aggregatley and than insert the
//with insert_x_monotone_curves(test the addition visitor) // rest aggregatley with insert_x_monotone_curves(test the addition visitor)
CGAL::insert_x_monotone_curves(arr, subcurves_from_file.begin(), subcurves_from_file.begin() + (n_edges/2)); CGAL::insert_x_monotone_curves (arr,
CGAL::insert_x_monotone_curves(arr, subcurves_from_file.begin() + (n_edges/2), subcurves_from_file.end()); subcurves_from_file.begin(),
subcurves_from_file.begin() + (n_edges/2));
CGAL::insert_x_monotone_curves (arr,
subcurves_from_file.begin() + (n_edges/2),
subcurves_from_file.end());
for(i=0; i<iso_verts.size(); ++i) for(i=0; i<iso_verts.size(); ++i)
{ {
CGAL::insert_point(arr, iso_verts[i]); 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_curves (addition) failed\n"; std::cout<<"ERROR : insert_x_monotone_curves (addition) failed\n";
return false; return false;
@ -251,7 +285,8 @@ bool test_one_file(std::ifstream& in_file)
arr.clear(); arr.clear();
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
//insert the disjoint subcurves incrementally with insert_non_intersecting_curve // insert the disjoint subcurves incrementally with
// insert_non_intersecting_curve
for(i=0; i<n_edges; ++i) for(i=0; i<n_edges; ++i)
{ {
CGAL::insert_non_intersecting_curve(arr, subcurves_from_file[i]); CGAL::insert_non_intersecting_curve(arr, subcurves_from_file[i]);
@ -260,8 +295,11 @@ bool test_one_file(std::ifstream& in_file)
{ {
CGAL::insert_point(arr, iso_verts[i]); 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_non_intersecting_curve failed\n"; std::cout<<"ERROR : insert_non_intersecting_curve failed\n";
return false; return false;
@ -269,14 +307,20 @@ bool test_one_file(std::ifstream& in_file)
arr.clear(); arr.clear();
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
// insert the disjoint subcurves aggregatley with insert_non_intersecting_curves // insert the disjoint subcurves aggregatley with
CGAL::insert_non_intersecting_curves(arr, subcurves_from_file.begin(), subcurves_from_file.end()); // insert_non_intersecting_curves
CGAL::insert_non_intersecting_curves (arr,
subcurves_from_file.begin(),
subcurves_from_file.end());
for(i=0; i<iso_verts.size(); ++i) for(i=0; i<iso_verts.size(); ++i)
{ {
CGAL::insert_point(arr, iso_verts[i]); 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_non_intersecting_curves failed\n"; std::cout<<"ERROR : insert_non_intersecting_curves failed\n";
return false; return false;
@ -285,23 +329,34 @@ bool test_one_file(std::ifstream& in_file)
// insert half of the disjoint subcurves aggregatley and than insert the rest aggregatley // insert half of the disjoint subcurves aggregatley and than insert the
//with insert_non_intersecting_curves(test the addition visitor) // rest aggregatley with insert_non_intersecting_curves (test the addition
CGAL::insert_non_intersecting_curves(arr, subcurves_from_file.begin(), subcurves_from_file.begin() + (n_edges/2)); // visitor)
CGAL::insert_non_intersecting_curves(arr, subcurves_from_file.begin() + (n_edges/2), subcurves_from_file.end()); CGAL::insert_non_intersecting_curves
(arr,
subcurves_from_file.begin(),
subcurves_from_file.begin() + (n_edges/2));
CGAL::insert_non_intersecting_curves
(arr,
subcurves_from_file.begin() + (n_edges/2),
subcurves_from_file.end());
for(i=0; i<iso_verts.size(); ++i) for(i=0; i<iso_verts.size(); ++i)
{ {
CGAL::insert_point(arr, iso_verts[i]); 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_non_intersecting_curves (addition) failed\n"; std::cout<<"ERROR : insert_non_intersecting_curves (addition) failed\n";
return false; return false;
} }
arr.clear(); arr.clear();
return true; return true;
} }
@ -356,4 +411,3 @@ int main(int argc, char **argv)
return success; return success;
} }