puts("usage:");
puts("-h \t\t help");
puts("-n \t\t no user interaction");
- printf("-a <value> \t slope of nuclear energy loss (default %d)\n",A_EL);
- printf("-b <value> \t nuclear energy loss offset (default %d)\n",B_EL);
+ printf("-a <value> \t slope of nuclear energy loss (default %f)\n",A_EL);
+ printf("-b <value> \t nuclear energy loss offset (default %f)\n",B_EL);
printf("-x <value> \t # x cells (default %d)\n",X);
printf("-y <value> \t # x cells (default %d)\n",Y);
printf("-z <value> \t # x cells (default %d)\n",Z);
int distrib_c(3d_lattice *3d_l,int t_c,double a,double b)
{
- int i,j,total,area;
+ int i,j,k,total,area,sum;
+ int temp,left;
+ int *area_h;
+ u32 x,y,z;
+ area=d3_l->max_x*d3_l->max_y;
+ area_h=(int *)malloc(d3_l->max_z*sizeof(int));
+
+ total=0;
+ sum=0;
for(i=0;i<d3_l->max_z;i++)
{
-
+ area_h[i]=0;
+ for(j=0;j<area;j++)
+ {
+ if(!(*(d3_l->status+(i*area)+j)&AMORPH))
+ {
+ sum+=(i+1)*a+b;
+ area_h[i]+=1;
+ }
+ }
+ }
+ for(i=0;i<d3_l->max_z;i++)
+ {
+ temp=((i+1)*a+b)*t_c/(sum+area_h[i]);
+ if(temp>1)
+ {
+ for(j=0;j<area;j++)
+ {
+ if(!(*(d3_l->status+(i*area)+j)&AMORPH))
+ {
+ *(d3_l->extra+(i*area)+j)=temp;
+ total+=temp;
+ }
+ }
+ }
+ left=(((i+1)*a+b)*t_c/sum)%area_h[i];
+ while(left)
+ {
+ x=get_rand(d3_l->max_x);
+ y=get_rand(d3_l->max_y);
+ if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
+ {
+ *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
+ total+=1;
+ left-=1;
+ }
+ }
+ left=t_c-total;
+ while(left)
+ {
+ x=get_rand(d3_l->max_x);
+ y=get_rand(d3_l->max_y);
+ z=get_rand_lgp(d3_l->max_z,a,b);
+ if(!(*(d3_l->status+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&AMORPH))
+ {
+ *(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
+ left-=1;
+ total+=1;
+ }
}
+ return 1;
+}
+
+int main(int argc,char **argv)
+{
+ u32 max_x,max_y,max_z,x,y,z,x_c,y_c,z_c;
+ int i,quit,escape,nowait;
+ double a_el,b_el,a_cd,b_cd,a_ap,b_ap;
+ int cc,steps,range,refresh;
+ char s_file[MAX_CHARS];
+ char l_file[MAX_CHARS];
+ char r_file[MAX_CHARS];
+ d3_lattice d3_l;
+
+ max_x=X;
+ max_y=Y;
+ max_z=Z;
+ x=X/2-1;
+ y=Y/2-1;
+ z=Z/2-1;
+ steps=STEPS;
+ range=RANGE;
+ refresh=REFRESH;
+ a_el=A_EL;
+ b_el=B_EL;
+ a_cd=A_CD;
+ b_cd=B_CD;
+ a_ap=A_AP;
+ b_ap=B_AP;
+ cc=CC;
+ nowait=0;
+ strcpy(s_file,"");
+ strcpy(l_file,"");
+ strcpy(r_file,"");
+
+ for(i=1,i<argc,i++)
+ {
+ if(argv[i][0]=='-')
+ {
+ switch(argv[i][1])
+ {
+ case 'h':
+ usage();
+ return -1;
+ case 'n':
+ nowait=1;
+ break;
+ case 'a':
+ a_el=atof(argv[++i]);
+ break;
+ case 'b':
+ b_el=atof(argv[++i]);
+ break;
+ case 'x':
+ max_x=atoi(argv[++i]);
+ break;
+ case 'y':
+ max_y=atoi(argv[++i]);
+ break;
+ case 'z':
+ max_z=atoi(argv[++i]);
+ break;
+ case 'X':
+ x=atoi(argv[++i]);
+ break;
+ case 'Y':
+ y=atoi(argv[++i]);
+ break;
+ case 'Z':
+ z=atoi(argv[++i]);
+ break;
+ case 's':
+ steps=atoi(argv[++i]);
+ break;
+ case 'd':
+ refresh=atoi(argv[++i]);
+ break;
+ case 'r':
+ range=atoi(argv[++i]);
+ break;
+ case 'f':
+ a_ap=atof(argv[++i]);
+ break;
+ case 'p':
+ b_ap=atof(argv[++i]);
+ break;
+ case 'A':
+ a_cd=atof(argv[++i]);
+ break;
+ case 'B':
+ b_cd=atof(argv[++i]);
+ break;
+ case 'C':
+ cc=atoi(argv[++i]);
+ break;
+ case 'L':
+ strcpy(l_file,argv[++i]);
+ break;
+ case 'S':
+ strcpy(s_file,argv[++i]);
+ break;
+ case 'R':
+ strcpy(r_file,argv[++i]);
+ break;
+ default:
+ usage();
+ return -1;
+ }
+ } else usage();
+ }
+
+
return 1;
}