#ifndef ECG_BENCH_H #define ECG_BENCH_H #include #include #include #include #include #include #include #include #include "Input_data.h" #include class Bench { int numof_f_fails; std::ofstream htmlout,texout; struct rusage before,after; struct timeval utime,stime; bool firsttime; char *description; int vert[4],hedg[4]; int i; CGAL::Memory_sizer mem_sizer; char* Dxffile; bool ONLY_DXF; public: Bench( char *fhtml="benchmarks.html", char* ftex="benchmarks.tex",char* Dxffilename="",const bool only_dxf=false): htmlout(fhtml,std::ios::app), texout(ftex,std::ios::app) { i=0; numof_f_fails= 0; Dxffile=Dxffilename; ONLY_DXF = only_dxf; description = "Arrangement "; std::cout << ".:Starting Bench Suite:." << std::endl; std::cout << "bencmarking : " << description << std::endl; htmlout<<"Dxf file is : "<< Dxffile << std::endl; htmlout<<""<" <" <"<"; texout<<" "; } void close_cell() { htmlout <<""; texout <<" "; } void open_row() { htmlout <<""; texout <<""; } void close_row() { htmlout <<""<< std::endl; texout <<"\\\\ \\hline"<< std::endl; } void kernel(char* kernel) { this->open_row(); this->open_cell(); htmlout << kernel; texout << kernel ; this->close_cell(); } void empty_cell() { this->open_cell(); htmlout << "
Kernelgrid I(400 Circle_2)grid II(800 Circle_2)random double (100 Circle)Dxf input. Dxf file is : "<< Dxffile <<" rotation (125 Circle_2)
KernelDxf input. Dxf file is : "<< Dxffile <<"
" << std::endl << "" << "
User timeNum. of failsverticeshalfedges
" <<"-"<<"" <<"-"<< "" <<"-"<< "" <<"-"<< "
" ; texout<<"& -"; this->close_cell(); } void infotable(){ texout<< "\\hline\\hline & grid I&grid II &random double & Dxf input. Dxf file is : "<< Dxffile <<" & rotation \\\\ \\hline" << std::endl << "vertices" ; for (int k=1; k < 6 ;k++) { texout << " & "<< vert[k]; } texout<<"\\\\ \\hline"<Kernelgrid Igrid IIrandom doubleDxf input. Dxf file is : "<< Dxffile <<" rotation " <KernelDxf input. Dxf file is : "<< Dxffile <<" " <::number_of_failures(); numof_f_fails = temp - numof_f_fails; std::cout << " numbers_of_filter_fails : " << numof_f_fails << std::endl; timersub(&(after.ru_utime),&(before.ru_utime),&utime); timersub(&(after.ru_stime),&(before.ru_stime),&stime); htmlout << "" << std::endl << "" << "
User timeNum. of failsverticeshalfedges
" <" << numof_f_fails << "" << vertices << "" << hedges<< "
"; texout << " & " <::number_of_failures(); } void fail(void) { htmlout << "" <" << "
User timeNum. of failsverticeshalfedges" <<"fail"<<"" <<"fail"<< "" <<"fail"<< "" <<"fail"<< "
" ; texout << "&" <<"fail"; std::cout << " :: Abort:: "<< std::endl; } template void arrangement(const ArcContainer & ac){ bool fail=false; typedef typename CGAL::Arrangement_2 Pmwx; typedef typename CGAL::Arr_naive_point_location Point_location; std::cout << "memory size before construction" << mem_sizer.virtual_size() << std::endl; std::cout << "memory resident size before insert()" << mem_sizer.resident_size () << std::endl; Pmwx _pm; Point_location _pl(_pm); std::cout << "Construction completed"<start(); for (typename ArcContainer::const_iterator it=ac.begin(); it != ac.end(); ++it) { insert(_pm,*it,_pl,std::false_type()); }; this->stop(); } catch (...) { this->fail(); fail=true; } vert[i]=(int)_pm.number_of_vertices(); hedg[i]=(int)_pm.number_of_halfedges(); //_pl.~Point_location(); // _pm.~Pmwx(); if (!fail){this->summarize(_pm.number_of_vertices(),_pm.number_of_halfedges());} _pm.clear(); std::cout << "memory size after insert()" << mem_sizer.virtual_size () << std::endl; std::cout << "memory resident size after insert()" << mem_sizer.resident_size () << std::endl; } template void grid(){ i=1; ArcContainer ac; _bench_input_grid(ac); this->open_cell(); this->arrangement(ac); this->close_cell(); } template void grid2(){ i=2; ArcContainer ac; _bench_input_grid2(ac); this->open_cell(); this->arrangement(ac); this->close_cell(); } template void random() { i=3; ArcContainer ac; if (firsttime) { _bench_input_random(ac); std::cout << "Input from random generator!"<(ac); std::cout << "Input from file!"<open_cell(); this->arrangement(ac); this->close_cell(); firsttime = false; } template void dfx(char* Dfxfile){ i=4; ArcContainer arc; _bench_input_dfx(arc,Dfxfile); this->open_cell(); this->arrangement(arc); this->close_cell(); } template void rotation(){ i=5; ArcContainer arc; try{ _bench_input_rotation(arc); } catch (...) { std::cout << "failed before input"; } this->open_cell(); this->arrangement(arc); this->close_cell(); this->close_row(); } template void Compute(char* dxffile) { // this->grid(); // // this->grid2(); // // this->random(); this->empty_cell(); this->empty_cell(); this->empty_cell(); this->dfx(dxffile); // this->rotation(); this->empty_cell(); this->close_row(); } template void Compute_no_dxf() { this->grid(); this->grid2(); this->random(); this->empty_cell(); // this->empty_cell(); // this->empty_cell(); // this->empty_cell(); // this->empty_cell(); // this->close_row(); this->rotation(); } void empty_row() { this->empty_cell(); this->empty_cell(); this->empty_cell(); this->empty_cell(); this->empty_cell(); this->close_row(); } template void Compute_dxf(char* dxffile) { this->dfx(dxffile); this->close_row(); } }; #endif //#define ECG_BENCH_H