diff --git a/Curved_kernel/Benchmarks/README_benchmark_CK2.txt b/Curved_kernel/Benchmarks/README_benchmark_CK2.txt new file mode 100644 index 00000000000..628c4a121d6 --- /dev/null +++ b/Curved_kernel/Benchmarks/README_benchmark_CK2.txt @@ -0,0 +1,71 @@ +The usage is: +./example ${alpha} ${beta} + +where alpha: +1: means to bench the BBox(CK) with Vartraits +2: means to bench the Lazy(CK) with Vartraits +3: means to bench the CK with Vartraits +4: means to bench the BBox(CK) with Circulartraits +5: means to bench the Lazy(CK) with Circulartraits +6: means to bench the CK(CK) with Circulartraits +(le 1 est interne) + +beta: +0: Compute the arrangement of DXF/51.dxf with the kernel ${alpha} +1: Compute the arrangement of DXF/cad_l1.dxf with the kernel ${alpha} +2: Compute the arrangement of DXF/cad_l2.dxf +3: Compute the arrangement of DXF/che_mod1.dxf +4: Compute the arrangement of DXF/CIOnZDraw.dxf +5: Compute the arrangement of DXF/mask1.dxf +6: Compute the arrangement of DXF/elekonta.dxf +7: Compute the arrangement of DXF/netlist_signal_1.dxf +8: Compute the arrangement of DXF/painttrack.dxf +9: Compute the arrangement of ${Scenario1} +a: Compute the arrangement of ${Scenario2} +b: Compute the arrangement of ${Scenario3} +c: Compute the arrangement of ${Scenario4} +d: Compute the arrangement of ${Scenario5} + +${Scenario1}: +- Circles with center in [0,10]x[0,10], +- 0.5 of distance between each circle +- unitary radius + +${Scenario2}: +- Circles with center in [0,0.2]x[0,0.2], +- 0.01 of distance between each circle +- unitary radius + +${Scenario3}: +Only one circle + +${Scenario4} +100 Random Circles with +- Center in [0,1]x[0,1] +- Radius in [0,1] + +${Scenario5} +Lattice, like: +o o o o o o o o o o o o o o o o + o o o o o o o o o o o o o o o +o o o o o o o o o o o o o o o o + o o o o o o o o o o o o o o o +o o o o o o o o o o o o o o o o + o o o o o o o o o o o o o o o +with no intersection. + +The output: + +In std::cout : +The number of elements to compute the arrangement +The number of circles and polygons (wich the side may be circular arcs) +The time needed to compute it, +The number of Vertices, Edges and Faces of the arrangement + +In std::cerr : +Only the time needed to compute it. (it is useful to benchmark a lot of cases and redirect it on a .txt) + +ATTENTION: +1) dont use ./example a b +with 0 > a > 3 and 0 < b < 9, we cannot use the Circulartraits to handle the files +2) The files have to be put on a folder name DXF where the program is located diff --git a/Curved_kernel/Benchmarks/benchmark_CK2.C b/Curved_kernel/Benchmarks/benchmark_CK2.C new file mode 100644 index 00000000000..0a60eaf979d --- /dev/null +++ b/Curved_kernel/Benchmarks/benchmark_CK2.C @@ -0,0 +1,246 @@ +//#define CGAL_INTERSECTION_MAP_FOR_SUPPORTING_CIRCLES + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CURVED KERNEL TYPEDEFS +typedef CGAL::MP_Float RT; +typedef CGAL::Quotient NT1; +typedef CGAL::Cartesian Linear_k1; +typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k1; +typedef CGAL::Circular_kernel_2 CircularKernel; +typedef CGAL::Arr_circular_arc_traits CircularK_CA_Traits; +typedef CircularKernel::Circular_arc_2 CircularKArc; +typedef std::vector CircularKArcContainer; +typedef CircularKernel::Circular_arc_2 Circular_arc_2; +typedef CircularKernel::Line_arc_2 Line_arc_2; +typedef CGAL::Arr_circular_line_arc_traits CircularK_Variant_Traits; +typedef boost::variant< Circular_arc_2, Line_arc_2 > CircularKVarArc; +typedef std::vector CircularKVarArcContainer; + +// LAZY KERNEL TYPEDEFS +typedef CGAL::Interval_nt_advanced NT3; +typedef CGAL::Cartesian Linear_k3; +typedef CGAL::Algebraic_kernel_for_circles_2_2 Algebraic_k3; +typedef CGAL::Circular_kernel_2 CK3_; +typedef CGAL::Lazy_curved_kernel LazyCurvedK; +typedef CGAL::Arr_circular_arc_traits LazyCurvedK_CA_Traits; +typedef LazyCurvedK::Circular_arc_2 LazyArc; +typedef std::vector LazyArcContainer; +typedef LazyCurvedK::Circular_arc_2 Circular_arc_3; +typedef LazyCurvedK::Line_arc_2 Line_arc_3; +typedef boost::variant LazyVarArc; +typedef std::vector LazyVarContainer; +typedef CGAL::Arr_circular_line_arc_traits LazyCurvedK_Variant_Traits; + +// BBOX TYPEDEFS +typedef CGAL::Filtered_bbox_curved_kernel + BBCircularKernel ; +typedef CGAL::Arr_circular_arc_traits + BBCircularKernel_CA_Traits; +typedef BBCircularKernel::Circular_arc_2 + BBCircularKernelArc; +typedef std::vector + BBCircularKernelArcContainer; +typedef BBCircularKernel::Circular_arc_2 + Circular_arc_6; +typedef BBCircularKernel::Line_arc_2 + Line_arc_6; +typedef boost::variant + BBCircVarArc; +typedef std::vector + BBCircVarContainer; +typedef CGAL::Arr_circular_line_arc_traits BBCircVariantTraits; + +template +void do_main(char *s) { + + // TYPEDEFS + typedef typename CK::Circular_arc_2 C2; + typedef typename CK::Line_arc_2 L2; + typedef typename CGAL::Arrangement_2 Pmwx; + typedef typename CGAL::Arr_naive_point_location Point_location; + + // LOADING CURVES + ArcContainer ac; + std::ifstream fin; + fin.open (s); + CGAL::variant_load( + fin, std::back_inserter(ac)); + fin.close(); + + std::cout << "Size:" << ac.size() << std::endl; + + // BENCHMARKING + Pmwx _pm; + Point_location _pl(_pm); + struct rusage before, after; + struct timeval utime, stime; + getrusage(RUSAGE_SELF,&before); + insert_curves(_pm,ac.begin(),ac.end()); + getrusage(RUSAGE_SELF,&after); + timersub(&(after.ru_utime),&(before.ru_utime),&utime); + timersub(&(after.ru_stime),&(before.ru_stime),&stime); + std::cout<<"Time="<< utime.tv_sec<<"."<< std::setw(6) << + std::setfill('0')<< utime.tv_usec <= 0 && j < 9)) { + if(i == 1) do_main(dxf_filename[j]); + if(i == 2) do_main(dxf_filename[j]); + if(i == 3) do_main(dxf_filename[j]); + if((i >= 4) || (i <= 0)) std::cout << "INVALID PARAMETERS" << std::endl; + } else { + int k; + if(j == 9) k = 0; + if(j == ('a'-'0')) k = 1; + if(j == ('b'-'0')) k = 2; + if(j == ('c'-'0')) k = 3; + if(j == ('d'-'0')) k = 4; + if(i == 1) do_main(k); + if(i == 2) do_main(k); + if(i == 3) do_main(k); + if(i == 4) do_main(k); + if(i == 5) do_main(k); + if(i == 6) do_main(k); + } + } else std::cout << "INVALID PARAMETERS" << std::endl; + + return 0; +} diff --git a/Curved_kernel/Benchmarks/makefile b/Curved_kernel/Benchmarks/makefile index 415ece794d1..8196612419a 100644 --- a/Curved_kernel/Benchmarks/makefile +++ b/Curved_kernel/Benchmarks/makefile @@ -46,13 +46,18 @@ LDFLAGS = \ #---------------------------------------------------------------------# all: \ + benchmark_CK2$(EXE_EXT)\ benchmarks_arrangement$(EXE_EXT) benchmarks_arrangement$(EXE_EXT): benchmarks_arrangement$(OBJ_EXT) $(CGAL_CXX) $(LIBPATH) $(EXE_OPT)benchmarks_arrangement benchmarks_arrangement$(OBJ_EXT) $(LDFLAGS) +benchmark_CK2$(EXE_EXT): benchmark_CK2$(OBJ_EXT) + $(CGAL_CXX) $(LIBPATH) $(EXE_OPT)benchmark_CK2 benchmark_CK2$(OBJ_EXT) $(LDFLAGS) + clean: \ - benchmarks_arrangement.clean + benchmarks_arrangement.clean\ + benchmark_CK2.clean #---------------------------------------------------------------------# # suffix rules