Diploma Thesis Percolation Simulation C++ Sourcecode Documentation |
00001 00002 // clcount.cpp 00003 // throws random spheres and counts the clusters of overlapping ones 00004 // 00005 // (c) Andreas Krueger (25.1.2000) 00006 // version 8.0 00007 // last change 29.1.2001 00008 00009 // #define TIMEMEASUREMENT 00010 00011 #include "configuration.h" 00012 00013 // this is only necessary for the konsole version 00014 #include "optimizealgo.h" 00015 #include "frontend.h" 00016 #include "speedtest.h" 00017 #include "starters.h" 00018 #include "batch.h" 00019 #include "commandline.h" 00020 00021 #include "old.h" // this should NOT be included, 00022 // if not absolutely necessary (old procedures) 00023 00024 int main(int argc, char* argv[]) { 00025 00026 cout <<version<<" compiled: "<<__DATE__<<" "<<__TIME__; 00027 #ifdef _WIN32 00028 cout<<"(Win32)"; 00029 #endif 00030 #ifdef __unix 00031 cout<<"(Unix)"; 00032 #endif 00033 cout <<"\n"; 00034 00035 //#ifdef TIMEMEASUREMENT 00036 //optimize::testspeed_divide_cellcount_combine(); 00037 //#endif 00038 00039 using namespace starters; 00040 using namespace optimize; 00041 using namespace commandline; 00042 00043 bool endofprg=false; 00044 clock_t runningtime=0; 00045 00046 cout_command_wo_path(argc, argv); cout <<"\n"; 00047 cline_par param; 00048 if (recognized_switch(argc, argv, param)){ 00049 if (range_ok(param)){ 00050 cerr <<"Parameters accepted. Now I run in direct mode:"<<endl; 00051 cerr <<param<<" [<<cerr]"<<endl; 00052 cout <<param<<" [<<cout]"<<endl; 00053 start_subprg(param, runningtime); 00054 cout <<"\nRunning time: "<<ms(runningtime)/1000<<" seconds\n"<<endl; 00055 endofprg=true; 00056 } 00057 else cerr <<"commandlineParameters wrong. Now I run in MENU mode."<<endl; 00058 } 00059 else cerr <<"commandlineParameters missing or unknown subprogram. Now I run in MENU mode."<<endl; 00060 00061 00062 while (!endofprg){ 00063 cout <<"\n*\n**\n***\n****\n*****\n****\n***\n**\n*\n"; 00064 cout << "--------------------------------------------"<<endl; 00065 00066 int dim; 00067 cout <<"Please type in dimension of space (2-"<<MAXDIM<<"): "; 00068 do{ 00069 cin >> dim; 00070 } while ((dim<=1)||(dim>MAXDIM)); 00071 if (dim>7) cout<<"Please forgive me:\nThe new algorithm isn't tuned for best performance yet.\nFor high dimensions it might be slower than possible!"<<endl; 00072 00073 cout <<"\n\t----------------------------------------------------------\n"; 00074 cout <<"\tClusterCount "<<version<<" (cpp__at__AndreasKrueger__dot__de) in "<<dim; 00075 cout <<" Dimensions\n"; 00076 cout <<"\t----------------------------------------------------------\n\n"; 00077 cout <<"This programm randomly throws rings(spheres) on a \"table\" of "; 00078 cout <<"[0,"<<GRIDSIZE<<"]^"<<dim<<"\n"; 00079 cout <<"then it counts the clusters of overlapping spheres"<<endl; 00080 00081 char a; 00082 cout <<"\nOutput to screen:"; 00083 cout <<"\n (NAIVE ALGO) arraycount (a)"; 00084 cout <<"\n (NAIVE ALGO) listcount (z)"; 00085 cout <<"\n (NAIVE ALGO) recursion vs. (Stoddard)iteration(i)"; 00086 cout <<"\n (DNC ALGO) vs. (NAIVE ALGO) (v)"; 00087 cout <<"\n (DNC ALGO): choose dividings per direction (d)"; 00088 // cout <<"\n (DNC ALGO): choose totalnumber of cuts (c)"; 00089 cout <<"\n (DNC ALGO): choose cuts & compare with old algo (w)"; 00090 cout <<"\n (DNC ALGO): test all faster cuts (t)"; 00091 // cout <<"\nor test(t) the vector dataset "<<endl; 00092 // cout <<"\nor test the LIST of spheres (s)"<<endl; 00093 // cout <<"\nor show the volume of n-dimensional unitspheres(u) ? "; 00094 // cout <<"\nor show the maximal fillingfactor for n-dimensions (m) ? "; 00095 00096 cout <<"\nOutput to file:"; 00097 cout <<"\n (NAIVE ALGO) file1- many loops per radius (l) "; 00098 cout <<"\n (NAIVE ALGO) file2- sweep all radii per 1 loop (r)"; 00099 cout <<"\n (DNC ALGO) test all faster cuts and double N (o)"; 00100 cout <<"\n (DNC ALGO): test specified cuts and double N (p)"; 00101 cout <<"\n (DNC ALGO): test predefined cuts with averaging FFC (j)"; 00102 cout <<"\n (DNC ALGO): test predefined cuts with averaging FFS (k)"; 00103 cout <<"\nor (DNC ALGO) file7- start once(7)"; 00104 cout <<"\nor (DNC ALGO) file8- start once(8)"; 00105 cout <<"\nor (DNC ALGO) file8- the holiday session (h)"; 00106 cout <<"\nor (DNC ALGO) find the critical fillingfactors (f)"; 00107 cout <<"\nor (DNC ALGO) find the fillingfactor for which 90% * N = noc (9)"; 00108 cout <<"\nor (NEW) create graphics files in SVG (g)"; 00109 cout <<"\n"; 00110 cout <<"\nor (INFO) show the commandline options (x)"; 00111 cout<<endl; 00112 cin >>a; 00113 cout <<endl; 00114 00115 switch (a) { 00116 // a c d f g h i j k l m o p r s t u v w z 7 8 9 00117 case 'a': into_screen(dim); break; 00118 case 'z': listcount(dim); break; 00119 case 'i': compare_recursion_and_Stoddard_iteration(dim); break; 00120 case 'v': new_vs_old_algo(dim); break; 00121 case 'd': choose_dividings(dim); break; 00122 // case 'c': choose_cuts(dim); break; 00123 case 'w': choose_cuts_with_reference_algo(dim); break; 00124 case 't': run_different_cuts(dim); break; 00125 case 'o': double_N_and_run_all_faster_cuts(dim,"c:\\results\\doublenumber1.txt"); break; 00126 case 'p': double_N_and_run_specified_cuts(dim,"c:\\results\\doublenumber2.txt"); break; 00127 case 'j': frontend_cuts_test_average_time(1,1); break; 00128 case 'k': frontend_cuts_test_average_time(2,1); break; 00129 00130 case 'l': 00131 cout <<"\nPlease now make a directory k:\\results\t !!! otherwise crash !!!"<<endl; 00132 into_file(dim); 00133 break; 00134 00135 case 'r': 00136 cout <<"\nPlease now make a directory k:\\results\t !!! otherwise crash !!!"<<endl; 00137 into_file2(dim); 00138 break; 00139 00140 case '7': 00141 cout <<"\nPlease now make two directories (at least one!):\n"; 00142 cout <<FILEHEAD1<<endl; 00143 cout <<FILEHEAD2<<endl; 00144 cout <<"for the results and the results backup\n!!! otherwise nonsense !!!\n"<<endl; 00145 into_file7_starter(dim); 00146 break; 00147 00148 case '8': 00149 cout <<"\nPlease now make two directories (at least one!):\n"; 00150 cout <<FILEHEAD1<<endl; 00151 cout <<FILEHEAD2<<endl; 00152 cout <<"for the results and the results backup\n!!! otherwise nonsense !!!\n"<<endl; 00153 into_file8_starter(dim); 00154 break; 00155 00156 case 'h': 00157 cout <<"\nPlease now make two directories (at least one!):\n"; 00158 cout <<FILEHEAD1<<endl; 00159 cout <<FILEHEAD2<<endl; 00160 cout <<"for the results and the results backup\n!!! otherwise nonsense !!!\n"<<endl; 00161 into_file8(); 00162 break; 00163 00164 case 'f': 00165 cout <<"\nYEAH - it finds the critical ff\nPlease now make a directory:\n"; 00166 cout <<FILEHEAD2<<endl; 00167 cout <<"for the results \n!!! otherwise nonsense !!!\n"<<endl; 00168 ff::find_ffc_frontend(); 00169 break; 00170 00171 00172 case '9': 00173 cout <<"\nYEAH - it finds the ff where the number-of-cluster = 90% * N\nPlease now make a directory:\n"; 00174 cout <<FILEHEAD2<<endl; 00175 cout <<"for the results \n!!! otherwise nonsense !!!\n"<<endl; 00176 ff::find_ff_with_criterion_frontend(); 00177 break; 00178 00179 case 'g': 00180 cout <<"\nSVG-Graphics file creation."; 00181 cout <<"\n SORRY: Disabled because of lack of <sstream> in some compilers\n\n"<<endl; 00182 cout <<" Please create a folder:\n"<<FILEHEAD2<<endl; 00183 cout <<"for the results \n!!! otherwise nonsense !!!\n"<<endl; 00184 frontend::svg_frontend(); 00185 break; 00186 00187 case 'x': 00188 commandline::show_commandline_options(argv[0]); 00189 endofprg=true; 00190 00191 break; 00192 00193 //case 't': testvectorsphere(dim);break; 00194 //case 's': test_list(dim);break; 00195 case 'u': unitspheredimensions(1,22);break; 00196 case 'm': max_ff(1,22);break; 00197 default: { 00198 cout<<"\nYou don't want to? OK, then I do nothing!\n"<<endl;; 00199 endofprg=true; 00200 } 00201 } 00202 00203 } // until (endofprg == false); 00204 return 0; 00205 }
Diploma Thesis Sourcecode
Documentation check out the text and the executable binaries |