X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=main.c;h=2ac8d6a9ac86d2331786445218e7eb9199b42066;hb=2fc464b1e03445cd60e9305dc9b75471ebdb04af;hp=2e9cc0c46f0f06189e32fd4719a5de44af903a40;hpb=4dc55f36080bc8cc78c07efe25bf3f222c3d0a9a;p=physik%2Fmorpheus.git diff --git a/main.c b/main.c index 2e9cc0c..2ac8d6a 100644 --- a/main.c +++ b/main.c @@ -26,6 +26,8 @@ #include "display.h" /* global variables */ +u32 *rand_buf,*rand_current; +char random_file[MAX_CHARS_RANDOM_FILE]; u32 gr; int random_fd; /* /dev/urandom file descriptor */ @@ -48,6 +50,7 @@ int usage() printf("-p \t p0 for probability of cell getting amorph (default %f)\n",DEFAULT_A_P_P0); printf("-C \t C start concentration (default %d)\n",DEFAULT_C_DIST_START_CONC); printf("-S \t slope of linear C distribution (default %d)\n",DEFAULT_C_DIST_SLOPE); + puts("-R \t read random datat from file (default not used)"); return -23; } @@ -65,10 +68,8 @@ int make_cryst(cell *cell) int distrib_c_conc(cell *cell_p,int c_c0,int c_slope,u32 c_conc,u32 x_max,u32 y_max,u32 z_max) { - /* cryst. c to distribute */ - int i,j; - u32 area,c_area,total; + u32 area,c_area,total,count; u32 x,y,z,sum_c_z; total=0; @@ -77,17 +78,22 @@ int distrib_c_conc(cell *cell_p,int c_c0,int c_slope,u32 c_conc,u32 x_max,u32 y_ for(i=0;istatus&AMORPH) count++; + } + for(j=0;jstatus&AMORPH) { - (cell_p+j+i*area)->conc=c_area/area; - total+=c_area/area; + (cell_p+j+i*area)->conc=c_area/count; + total+=c_area/count; } } j=0; - while(jconc; if(this_cell->status&AMORPH) { /* wrong probability! just test by now ...*/ @@ -192,6 +201,7 @@ int main(int argc,char **argv) display_y=y_cell/2; display_z=z_cell/2; display_refresh_rate=DEFAULT_DISPLAY_REF_RATE; + strcpy(random_file,""); /* parse command args */ for(i=1;i