#include #include #include #include #include #include #include #include #include #ifdef CGAL_USE_LEDA #include #include typedef CGAL::Homogeneous_d LHKernel; typedef CGAL::Convex_hull_d LHConvex_hull_d; typedef CGAL::Cartesian_d LCKernel; typedef CGAL::Convex_hull_d LCConvex_hull_d; #endif #ifdef CGAL_USE_GMP #include typedef CGAL::Homogeneous_d GKernel; typedef CGAL::Convex_hull_d GConvex_hull_d; #endif #include typedef CGAL::Homogeneous_d DHKernel; typedef CGAL::Convex_hull_d DHConvex_hull_d; typedef CGAL::Cartesian_d DCKernel; typedef CGAL::Convex_hull_d DCConvex_hull_d; typedef int* p_int; typedef p_int* pp_int; static std::ofstream* p_table_file; CGAL::Timer timer; void random_d_tuple_in_range(p_int V, int d, int l, int h) { for(int i = 0; i> d >> n; create(V,n,d);int i=0,c; while ( In >> c ) { V[i/d][i%d]=c; ++i;} In.close(); } template void time_insertion_and_check(pp_int V, int n, int d, CGAL::Convex_hull_d& C, std::string s, bool check=true) { typedef typename CGAL::Convex_hull_d::chull_has_local_non_convexity chull_has_local_non_convexity; typedef typename CGAL::Convex_hull_d::chull_has_double_coverage chull_has_double_coverage; typedef typename CGAL::Convex_hull_d:: chull_has_center_on_wrong_side_of_hull_facet chull_has_center_on_wrong_side_of_hull_facet; std::cout << " timing of " << s << std::endl; std::vector< CGAL::Point_d > P(n); int i; for(i=0; i(d,V[i],V[i]+d,1); timer.reset(); timer.start(); // float ti = used_time(); for(i=0; iflush(); } int main(int argc, char* argv[]) { // first param is dimension // second param is number of points int d = 4; int n = 100; int range = 100; unsigned which(255); if (argc > 1 && std::string(argv[1])=="-h") { std::cout << "usage: " << argv[0] << " [which] [dim] [#points] [range]\n"; std::cout << " which=0 create testset in "< 1) which = atoi(argv[1]); if (argc > 2) d = atoi(argv[2]); if (argc > 3) n = atoi(argv[3]); if (argc > 4) range = atoi(argv[4]); p_table_file = new std::ofstream( (std::string(argv[0])+".rts").c_str(), std::ios::app); int** V; if ( which == 0 ) { create(V,n,d); random_d_tuples_in_range(V,n,d,-range,range); print_to_file(V,n,d,std::string(argv[0])+".ch"); exit(0); } else { read_from_file(V,n,d,std::string(argv[0])+".ch"); } if ( which & 1 ) { DCConvex_hull_d DCC(d); time_insertion_and_check(V,n,d,DCC,"double cartesian "); } if ( which & 2 ) { DHConvex_hull_d DHC(d); time_insertion_and_check(V,n,d,DHC,"double homogeneous "); } #ifdef CGAL_USE_LEDA if ( which & 4 ) { LHConvex_hull_d LHC(d); time_insertion_and_check(V,n,d,LHC,"LEDA integer homogeneous"); } #endif #ifdef CGAL_USE_GMP if ( which & 8 ) { GConvex_hull_d GC(d); time_insertion_and_check(V,n,d,GC,"GNU mpz homogeneous "); } #endif #ifdef CGAL_USE_LEDA if ( which & 16 ) { LCConvex_hull_d LCC(d); time_insertion_and_check(V,n,d,LCC,"LEDA real cartesian ",false); } #endif #ifdef CGAL_USE_LEDA #if defined(LEDA_NAMESPACE) leda::print_statistics(); #else print_statistics(); #endif #endif destroy(V,n); return 0; }