Diploma Thesis Percolation Simulation
C++ Sourcecode Documentation

www.AndreasKrueger.de/thesis/code

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

analyze Namespace Reference


Functions

void erasehisto (NUMBER *histo, NUMBER first, NUMBER last)
NUMBER show_shorthisto (NUMBER *histogram, NUMBER first, NUMBER last)
void show_histo (NUMBER *histo1, NUMBER last)
void show_twohisto (NUMBER *histo1, NUMBER *histo2, NUMBER last)
void show_threehisto (NUMBER *histo1, NUMBER *histo2, NUMBER *histo3, NUMBER last)
void show_fourhisto (NUMBER *histo1, NUMBER *histo2, NUMBER *histo3, NUMBER *histo4, NUMBER last)
void show_fivehisto (NUMBER *histo1, NUMBER *histo2, NUMBER *histo3, NUMBER *histo4, NUMBER *histo5, NUMBER last)
void show_sixhisto (NUMBER *histo1, NUMBER *histo2, NUMBER *histo3, NUMBER *histo4, NUMBER *histo5, NUMBER *histo6, NUMBER last)
void show_sevenhisto (NUMBER *histo1, NUMBER *histo2, NUMBER *histo3, NUMBER *histo4, NUMBER *histo5, NUMBER *histo6, NUMBER *histo7, NUMBER last)
NUMBER mstfreqcluster (NUMBER *histogram, NUMBER first, NUMBER last)
bool sameresult (NUMBER *histo1, NUMBER *histo2, NUMBER first, NUMBER last)
void makehistogram (NUMBER *tableofclusters, NUMBER *histogram, NUMBER &biggest, NUMBER &biggestcl_no)
NUMBER makehistogram (cluson *clusters, NUMBER firstclno, NUMBER lastclno, NUMBER *histogram, NUMBER &biggestcluster_clno, NUMBER &biggestcluster_size, REAL &averagecluster_size)
NUMBER analyze_clusters (cluson *clst, NUMBER firstclno, NUMBER lastclno, NUMBER *histogram, NUMBER N, NUMBER &biggestcl, REAL &averagecl)
void edgespheres (sphere *array, NUMLIST &original, NUMLIST &edgelist, COORDFLOAT border, REAL radius, int direction)
void occuring_clusternumbers (sphere *spheres, NUMLIST all, NUMLIST &clusternumbers)
COUNTER intersection_of_unsortedlists (NUMLIST list_one, NUMLIST list_two, NUMLIST &result)
COUNTER intersection_of_sortedlists (NUMLIST list_one, NUMLIST list_two, NUMLIST &result)
COUNTER find_spanningclusters (sphere *spheres, NUMLIST all, NUMLIST &spclusters, unsigned int direction, COORDFLOAT left, COORDFLOAT right, REAL radius)
LONGBITS spanning_dirs_and_clusters (sphere *spheres, NUMLIST all, COORDFLOAT left, COORDFLOAT right, REAL radius, int dim, cluson *clusters, NUMLIST &L_spanningclusters)
LONGBITS spanning_directions (sphere *spheres, NUMLIST all, COORDFLOAT left, COORDFLOAT right, REAL radius, int dim)
REAL mean_without_lr_spanningcls (REAL mean_clsz, NUMBER N, cluson *clusters, NUMLIST &L_spanningclusters, LONGBITS spcl_dirs)
NUMBER mass_of_all_spanningclusters (cluson *clusters, NUMLIST &L_spanningclusters)

Variables

clock_t time1
clock_t time2
clock_t time3


Function Documentation

NUMBER analyze_clusters cluson   clst,
NUMBER    firstclno,
NUMBER    lastclno,
NUMBER *    histogram,
NUMBER    N,
NUMBER &    biggestcl,
REAL &    averagecl
 

Definition at line 170 of file analyze.h.

References erasehisto(), makehistogram(), NUMBER, and REAL.

Referenced by counters::divide_d_times_count_and_analyze(), counters::divide_once_count_and_analyze(), counters::divide_three_times_count_and_analyze(), and counters::divide_two_times_count_and_analyze().

00177 {
00178         NUMBER biggestcl_no;
00179 
00180         erasehisto(histogram,1,N);
00181         makehistogram ( clst,firstclno,lastclno,
00182                                                 histogram, 
00183                                                 biggestcl_no, 
00184                                                 biggestcl,
00185                                                 averagecl);
00186         return (biggestcl_no);
00187 }

void edgespheres sphere   array,
NUMLIST   original,
NUMLIST   edgelist,
COORDFLOAT    border,
REAL    radius,
int    direction
 

Definition at line 189 of file analyze.h.

References sphere::c, COORDFLOAT, getdim(), lower(), and REAL.

Referenced by counters::combine(), find_spanningclusters(), find_spanningclusters(), and starters::test_list().

00195 {
00196         int sign=(direction/abs(direction)); 
00197         NUMLIST::iterator iter1=original.begin();
00198         sphere sph(getdim(array[*iter1].c));
00199 
00200         if (sign<0) {
00201                 COORDFLOAT cut=border+(COORDFLOAT)radius;
00202                 for (iter1 ; iter1 != original.end(); ++iter1){
00203                         sph=array[*iter1];
00204                         if ( lower(sph.c, cut, abs(direction) )   ) 
00205                                 edgelist.insert(edgelist.end(), *iter1);
00206                 }
00207         }
00208         else    {
00209                 COORDFLOAT cut=border-(COORDFLOAT)radius;
00210                 for (iter1 ; iter1 != original.end(); ++iter1){
00211                         sph=array[*iter1];
00212                         if (! lower(sph.c, cut, abs(direction) )   ) 
00213                                 edgelist.insert(edgelist.end(), *iter1);
00214                 }
00215         }
00216 }

void erasehisto NUMBER *    histo,
NUMBER    first,
NUMBER    last
 

Definition at line 9 of file analyze.h.

References NUMBER.

Referenced by analyze_clusters(), grid::boxcount_analyze_and_return_clusters(), optimize::compare_recursion_and_Stoddard_iteration(), counters::count_analyze_and_return_clusters(), counters::divide_count_and_analyze(), counters::naive_arraycount_and_analyze(), counters::naive_count_and_analyze(), counters::naive_listcount_and_analyze(), and optimize::new_vs_old_algo().

00009                                                         {
00010         for (NUMBER i=first;i<=last;i++){
00011                 histo[i]=0;
00012         }
00013 }

COUNTER find_spanningclusters sphere   spheres,
NUMLIST    all,
NUMLIST   spclusters,
unsigned int    direction,
COORDFLOAT    left,
COORDFLOAT    right,
REAL    radius
 

Definition at line 279 of file analyze.h.

References COORDFLOAT, COUNTER, edgespheres(), intersection_of_sortedlists(), occuring_clusternumbers(), REAL, time1, time2, and time3.

Referenced by spanning_directions(), and spanning_dirs_and_clusters().

00284 {
00285 
00286         NUMLIST left_edgespheres;
00287         NUMLIST right_edgespheres;
00288         time1=clock();
00289         edgespheres(spheres, all, left_edgespheres, left, radius, -(int)direction);
00290         edgespheres(spheres, all, right_edgespheres, right, radius, direction);
00291         time1=clock()-time1;
00292 
00293         NUMLIST left_edgeclusters;
00294         NUMLIST right_edgeclusters;
00295         time2=clock();
00296         occuring_clusternumbers(spheres, left_edgespheres, left_edgeclusters);
00297         occuring_clusternumbers(spheres, right_edgespheres, right_edgeclusters);
00298         time2=clock()-time2;
00299 
00300         time3=clock();
00301         COUNTER found=intersection_of_sortedlists(left_edgeclusters, right_edgeclusters, spclusters);
00302         time3=clock()-time3;
00303 
00304         return found;        // and spanningclusters
00305 }

COUNTER intersection_of_sortedlists NUMLIST    list_one,
NUMLIST    list_two,
NUMLIST   result
 

Definition at line 246 of file analyze.h.

References COUNTER.

Referenced by find_spanningclusters().

00246                                                                                         {
00247         COUNTER found = 0;
00248         NUMLIST::iterator one, two;
00249         one=list_one.begin();
00250         two=list_two.begin();
00251 
00252         while ( (one != list_one.end()) && (two != list_two.end()) ) {
00253 
00254                 while ( (*one < *two) && ( one != list_one.end()) ) one++;
00255                   // if ( one == list_one.end() && *one==*two) Beep(50,5000); 
00256                   //  this was the reason for a non(!)spanning spanningcluster!!!
00257                   //  so the next line (if... break) is necessary!!!
00258                 if ( one == list_one.end() ) break;
00259 
00260                 if ( *one==*two) {
00261                         found++;
00262                         result.push_back(*one);
00263                         two++;
00264                 }
00265                 else {
00266                         while ((*two<*one)&&(two!=list_two.end())) two++;
00267                         // here it is not necessary because of the main-while condition
00268                 }
00269         }
00270         return found;
00271 }

COUNTER intersection_of_unsortedlists NUMLIST    list_one,
NUMLIST    list_two,
NUMLIST   result
 

Definition at line 232 of file analyze.h.

References COUNTER.

00232                                                                                           {
00233         COUNTER found = 0;
00234         NUMLIST::iterator one, two;
00235         for (one=list_one.begin();one!=list_one.end(); one++){
00236                 for (two=list_two.begin();two!=list_two.end(); two++){
00237                         if (*one==*two){
00238                                 result.push_back(*one);
00239                                 found++;
00240                         }
00241                 }
00242         }
00243         return found;
00244 }

NUMBER makehistogram cluson   clusters,
NUMBER    firstclno,
NUMBER    lastclno,
NUMBER *    histogram,
NUMBER &    biggestcluster_clno,
NUMBER &    biggestcluster_size,
REAL &    averagecluster_size
 

Definition at line 141 of file analyze.h.

References NUMBER, REAL, and cluson::sphlist.

00148 {
00149         NUMBER size; 
00150         NUMBER totalnumber=0;
00151         biggestcluster_clno=0, biggestcluster_size=0; 
00152         averagecluster_size=0;
00153 
00154         for (NUMBER clno=firstclno;clno<=lastclno;clno++){
00155                 size = clusters[clno].sphlist.size();
00156                 histogram[size]++;
00157 
00158                 if (size>biggestcluster_size) {
00159                         biggestcluster_size=size;
00160                         biggestcluster_clno=clno;
00161                 }
00162                 totalnumber +=size;
00163                 averagecluster_size += (REAL) size * (REAL) size;   // e.g. size 173 is mentioned 173 times
00164         }
00165         averagecluster_size /= (REAL) totalnumber;             // each sphere belongs to this clustersize by average
00166         return totalnumber;
00167 }

void makehistogram NUMBER *    tableofclusters,
NUMBER *    histogram,
NUMBER &    biggest,
NUMBER &    biggestcl_no
 

Definition at line 117 of file analyze.h.

References NUMBER.

Referenced by analyze_clusters().

00117                                                                                                     : size=0)
00118                                    NUMBER *histogram,                                           // how many of that size ?
00119                                    NUMBER& biggest,
00120                                    NUMBER& biggestcl_no) {
00121         
00122 
00123         NUMBER clusterno=1;
00124         biggest=0;
00125 
00126         NUMBER size = tableofclusters[clusterno];
00127         while ( !(size==0) ){
00128                 histogram[size]++;                                                      // count all of that size
00129 
00130                 if (size>biggest) {
00131                         biggest=size;                                                   
00132                         biggestcl_no=clusterno;                                 // biggest cluster up to here
00133                 }
00134 
00135                 clusterno++;
00136                 size = tableofclusters[clusterno];
00137         }
00138 }

NUMBER mass_of_all_spanningclusters cluson   clusters,
NUMLIST   L_spanningclusters
 

Definition at line 384 of file analyze.h.

References NUMBER, and cluson::sphlist.

00384                                                                                  {
00385         NUMBER temp=0;
00386         NUMLIST::iterator spcl;
00387         for (spcl=L_spanningclusters.begin();spcl!=L_spanningclusters.end();spcl++){
00388                 temp+=clusters[*spcl].sphlist.size();
00389         }
00390         return temp;
00391 }

REAL mean_without_lr_spanningcls REAL    mean_clsz,
NUMBER    N,
cluson   clusters,
NUMLIST   L_spanningclusters,
LONGBITS    spcl_dirs
 

Definition at line 362 of file analyze.h.

References LONGBITS, NUMBER, REAL, cluson::sp_lr(), and cluson::sphlist.

Referenced by counters::setR_count_analyze_step().

00363                                                                                                           {
00364 
00365         if (spcl_dirs&1==0) return mean_clsz;   // no spanningcluster in left-right direction
00366 
00367         REAL temp=mean_clsz;
00368         temp *= (REAL)N;
00369 
00370         NUMBER clno, clsz;
00371         NUMLIST::iterator spcl;
00372         for (spcl=L_spanningclusters.begin();spcl!=L_spanningclusters.end();spcl++){
00373                 clno=*spcl;
00374                 if (clusters[clno].sp_lr()) {                   // subtract only left-right spanningclusters
00375                         clsz=clusters[clno].sphlist.size();
00376                         temp-= clsz * clsz;
00377                 }
00378         }
00379         temp/=(REAL)N;
00380         return temp;
00381 }

NUMBER mstfreqcluster NUMBER *    histogram,
NUMBER    first,
NUMBER    last
 

Definition at line 96 of file analyze.h.

References NUMBER.

00096                                                                     {
00097         NUMBER mstfreq=0;
00098         NUMBER highest=0;
00099         for (NUMBER i=first; i<=last; i++) {
00100                 if (histogram[i] >= highest) {
00101                         highest=histogram[i];
00102                         mstfreq=i;
00103                 }
00104         }
00105         return mstfreq;
00106 }

void occuring_clusternumbers sphere   spheres,
NUMLIST    all,
NUMLIST   clusternumbers
 

Definition at line 219 of file analyze.h.

Referenced by find_spanningclusters().

00219                                                                                    {
00220         
00221         NUMLIST::iterator sph;
00222         for (sph=all.begin(); sph!=all.end(); sph++){
00223                 clusternumbers.push_back(spheres[*sph].clno);
00224         }
00225         clusternumbers.sort();
00226         clusternumbers.unique();  // throws out doubles
00227 }

bool sameresult NUMBER *    histo1,
NUMBER *    histo2,
NUMBER    first,
NUMBER    last
 

Definition at line 109 of file analyze.h.

References NUMBER.

Referenced by optimize::choose_cuts_with_reference_algo(), optimize::choose_dividings(), optimize::compare_recursion_and_Stoddard_iteration(), optimize::double_N_and_run_all_faster_cuts(), starters::listcount(), optimize::new_vs_old_algo(), counters::reference_test(), and optimize::run_different_cuts().

00109                                                                            {
00110         for (NUMBER i=first;i<=last;i++){
00111                 if (histo1[i]!=histo2[i]) return 0;
00112         }
00113         return 1;
00114 }

void show_fivehisto NUMBER *    histo1,
NUMBER *    histo2,
NUMBER *    histo3,
NUMBER *    histo4,
NUMBER *    histo5,
NUMBER    last
 

Definition at line 65 of file analyze.h.

References NUMBER.

00065                                                                                                                  {
00066         cout <<"size\t\tcount1\tcount2\tcount3\tcount4\tcount4 number of these clusters"<<endl;
00067         for (NUMBER i=1; i<=last; i++) {
00068                 if ((histo1[i]!=0) || (histo2[i]!=0) || (histo3[i]!=0) || (histo4[i]!=0) || (histo5[i]!=0) ){
00069                         cout << i << "\t\t" << histo1[i] << "\t" << histo2[i];
00070                         cout << "\t" << histo3[i] << "\t" << histo4[i] << "\t" << histo4[i] <<endl;
00071                 }
00072         }
00073 }

void show_fourhisto NUMBER *    histo1,
NUMBER *    histo2,
NUMBER *    histo3,
NUMBER *    histo4,
NUMBER    last
 

Definition at line 55 of file analyze.h.

References NUMBER.

00055                                                                                                  {
00056         cout <<"size\t\tcount1\tcount2\tcount3\tcount4 number of these clusters"<<endl;
00057         for (NUMBER i=1; i<=last; i++) {
00058                 if ((histo1[i]!=0) || (histo2[i]!=0) || (histo3[i]!=0) || (histo4[i]!=0) ){
00059                         cout << i << "\t\t" << histo1[i] << "\t" << histo2[i];
00060                         cout << "\t" << histo3[i] << "\t" << histo4[i] <<endl;
00061                 }
00062         }
00063 }

void show_histo NUMBER *    histo1,
NUMBER    last
 

Definition at line 31 of file analyze.h.

References NUMBER.

00031                                              {
00032         cout <<"size\t\tnumber of these clusters"<<endl;
00033         for (NUMBER i=1; i<=last; i++) {
00034                 if (histo1[i]!=0)
00035                         cout << i << "\t\t" << histo1[i] <<endl;
00036         }
00037 }

void show_sevenhisto NUMBER *    histo1,
NUMBER *    histo2,
NUMBER *    histo3,
NUMBER *    histo4,
NUMBER *    histo5,
NUMBER *    histo6,
NUMBER *    histo7,
NUMBER    last
 

Definition at line 85 of file analyze.h.

References NUMBER.

Referenced by optimize::new_vs_old_algo().

00085                                                                                                                                                   {
00086         cout <<"size\t\tcount1\tcount2\tcount3\tcount4\tcount5\tcount6\tcount7 number of these clusters"<<endl;
00087         for (NUMBER i=1; i<=last; i++) {
00088                 if ((histo1[i]!=0) || (histo2[i]!=0) || (histo3[i]!=0) || (histo4[i]!=0) || (histo5[i]!=0) || (histo6[i]!=0) || (histo7[i]!=0) ){
00089                         cout << i << "\t\t" << histo1[i] << "\t" << histo2[i];
00090                         cout << "\t" << histo3[i] << "\t" << histo4[i] << "\t" << histo5[i] << "\t" << histo6[i] << "\t" << histo7[i]<<endl;
00091                 }
00092         }
00093 }

NUMBER show_shorthisto NUMBER *    histogram,
NUMBER    first,
NUMBER    last
 

Definition at line 15 of file analyze.h.

References NUMBER.

00015                                                                      {
00016         NUMBER clusters=0;                      // the number of clusters
00017         NUMBER counted=0;                       // the number of spheres
00018 
00019         cout <<"size\t\tnumber of these clusters"<<endl;
00020         for (NUMBER i=first; i<=last; i++) {
00021                 if (histogram[i]!=0) {                                  // the last entry in "histogram" must be 0 !
00022                         cout << i << "\t\t" << histogram[i] <<endl;
00023                         clusters += histogram[i];
00024                         counted += histogram[i]*i; if (counted>=last) break;
00025                 }
00026         }
00027         return clusters;                                        
00028 }

void show_sixhisto NUMBER *    histo1,
NUMBER *    histo2,
NUMBER *    histo3,
NUMBER *    histo4,
NUMBER *    histo5,
NUMBER *    histo6,
NUMBER    last
 

Definition at line 75 of file analyze.h.

References NUMBER.

00075                                                                                                                                 {
00076         cout <<"size\t\tcount1\tcount2\tcount3\tcount4\tcount5\tcount6 number of these clusters"<<endl;
00077         for (NUMBER i=1; i<=last; i++) {
00078                 if ((histo1[i]!=0) || (histo2[i]!=0) || (histo3[i]!=0) || (histo4[i]!=0) || (histo5[i]!=0) ){
00079                         cout << i << "\t\t" << histo1[i] << "\t" << histo2[i];
00080                         cout << "\t" << histo3[i] << "\t" << histo4[i] << "\t" << histo5[i] << "\t" << histo6[i] <<endl;
00081                 }
00082         }
00083 }

void show_threehisto NUMBER *    histo1,
NUMBER *    histo2,
NUMBER *    histo3,
NUMBER    last
 

Definition at line 47 of file analyze.h.

References NUMBER.

Referenced by optimize::choose_dividings().

00047                                                                                   {
00048         cout <<"size\t\tcount1\tcount2\tcount3 number of these clusters"<<endl;
00049         for (NUMBER i=1; i<=last; i++) {
00050                 if (histo1[i]!=0 || histo2[i]!=0 || histo3[i]!=0)
00051                         cout << i << "\t\t" << histo1[i] << "\t" << histo2[i] << "\t" << histo3[i] <<endl;
00052         }
00053 }

void show_twohisto NUMBER *    histo1,
NUMBER *    histo2,
NUMBER    last
 

Definition at line 39 of file analyze.h.

References NUMBER.

Referenced by optimize::choose_cuts_with_reference_algo(), starters::listcount(), and optimize::run_different_cuts().

00039                                                                 {
00040         cout <<"size\t\tcount1\tcount2 number of these clusters"<<endl;
00041         for (NUMBER i=1; i<=last; i++) {
00042                 if (histo2[i]!=0 && histo2[i]!=0)
00043                         cout << i << "\t\t" << histo1[i] << "\t" << histo2[i] <<endl;
00044         }
00045 }

LONGBITS spanning_directions sphere   spheres,
NUMLIST    all,
COORDFLOAT    left,
COORDFLOAT    right,
REAL    radius,
int    dim
 

Definition at line 341 of file analyze.h.

References COORDFLOAT, COUNTER, errorout(), find_spanningclusters(), LONGBITS, pow(), and REAL.

00347 {
00348         if (dim>sizeof(LONGBITS)*8-1) {
00349                 errorout("too many directions-bits necessary");
00350                 exit(1);
00351         }
00352         NUMLIST spanningclusters;
00353         LONGBITS bits=0; 
00354         for (COUNTER direction=1;direction<=dim;direction++){
00355                 if(find_spanningclusters(spheres, all, spanningclusters, direction, left, right, radius)){
00356                         bits|=(LONGBITS)pow(2,direction-1);
00357                 }
00358         }
00359         return bits;
00360 }

LONGBITS spanning_dirs_and_clusters sphere   spheres,
NUMLIST    all,
COORDFLOAT    left,
COORDFLOAT    right,
REAL    radius,
int    dim,
cluson   clusters,
NUMLIST   L_spanningclusters
 

Definition at line 310 of file analyze.h.

References add_spanning_dir_to_clusters(), COORDFLOAT, errorout(), find_spanningclusters(), LONGBITS, pow(), and REAL.

00318 {
00319         if (dim>sizeof(LONGBITS)*8-1) {
00320                 errorout("too many directions-bits necessary");
00321                 exit(1);
00322         }
00323         NUMLIST L_spanning_this_direction;
00324         LONGBITS bits=0; 
00325 
00326         for (int direction=1;direction<=dim;direction++){
00327                 if(0!=find_spanningclusters(spheres, all, L_spanning_this_direction, direction, left, right, radius)){
00328                         add_spanning_dir_to_clusters(clusters, L_spanning_this_direction, direction);
00329                         L_spanningclusters.splice(L_spanningclusters.end(), L_spanning_this_direction);
00330                         bits|=(LONGBITS)pow(2,direction-1);
00331                 }
00332         }
00333         L_spanningclusters.sort();
00334         L_spanningclusters.unique();  // throws out doubles
00335 
00336         return bits;            // and L_spanningclusters
00337 }


Variable Documentation

clock_t analyze::time1
 

Definition at line 277 of file analyze.h.

Referenced by find_spanningclusters().

clock_t analyze::time2
 

Definition at line 277 of file analyze.h.

Referenced by find_spanningclusters().

clock_t analyze::time3
 

Definition at line 277 of file analyze.h.

Referenced by find_spanningclusters().




Diploma Thesis Sourcecode Documentation
check out the text and the executable binaries

www.AndreasKrueger.de/thesis/code