fixed distrib_c
authorhackbard <hackbard>
Thu, 15 May 2003 10:51:08 +0000 (10:51 +0000)
committerhackbard <hackbard>
Thu, 15 May 2003 10:51:08 +0000 (10:51 +0000)
nlsop.c

diff --git a/nlsop.c b/nlsop.c
index 1d2e6d6..7dc862c 100644 (file)
--- a/nlsop.c
+++ b/nlsop.c
@@ -38,9 +38,11 @@ int usage(void)
  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);
+ /*
  printf("-X <value> \t display x (default %d)\n",X/2-1);
  printf("-Y <value> \t display y (default %d)\n",Y/2-1);
  printf("-Z <value> \t display z (default %d)\n",Z/2-1);
+ */
  printf("-s <value> \t steps (default %d)\n",STEPS);
  printf("-d <value> \t refresh display (default %d)\n",REFRESH);
  printf("-r <value> \t amorphous influence range (default %d)\n",RANGE);
@@ -76,12 +78,14 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int
    } 
   }
  }
- p*=*conc;
+ // p*=*conc;
+ // printf("debug: p * conc = %f\n",p);
  if(!(*thiz&AMORPH))
  {
   if(get_rand(URAND_MAX)<=p)
   {
    MAKE_AMORPH(thiz);
+   printf("debug: c->a %d - %d\n",*t_c,*conc);
    *t_c=*t_c+1-*conc;
   } else *t_c+=1;
  } else
@@ -90,6 +94,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int
   if(get_rand(URAND_MAX)>p)
   {
    MAKE_CRYST(thiz);
+   printf("debug: a->c %d - %d\n",*t_c,*conc);
    *t_c=*t_c+1+*conc;
   } else *t_c+=1;
  }
@@ -121,8 +126,8 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b)
    }
   }
   temp=(int)((i+1)*a+b)*t_c/(sum*area_h[i]);
-  if(temp)
-  {
+  // if(temp)
+  // {
    for(j=0;j<area;j++)
    {
     if(!(*(d3_l->status+(i*area)+j)&AMORPH))
@@ -131,13 +136,13 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b)
      total+=temp;
     }
    }
-  }
+  // }
   left=(int)(((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)+j)&AMORPH))
+   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;
@@ -151,9 +156,9 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b)
   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))
+  if(!(*(d3_l->status+x+y*d3_l->max_x+z*area)&AMORPH))
   {
-   *(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
+   *(d3_l->extra+x+y*d3_l->max_x+z*area)+=1;
    left-=1;
   }
  }
@@ -254,9 +259,6 @@ int main(int argc,char **argv)
  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;
@@ -301,6 +303,7 @@ int main(int argc,char **argv)
     case 'z':
      max_z=atoi(argv[++i]);
      break;
+    /*
     case 'X':
      x=atoi(argv[++i]);
      break;
@@ -310,6 +313,7 @@ int main(int argc,char **argv)
     case 'Z':
      z=atoi(argv[++i]);
      break;
+    */
     case 's':
      steps=atoi(argv[++i]);
      break;
@@ -350,6 +354,10 @@ int main(int argc,char **argv)
   } else usage();
  }
 
+ x=max_x/2-1;
+ y=max_y/2-1;
+ z=max_z/2-1;
+
  if(!strcmp(r_file,"")) rand_init(NULL);
  else rand_init(r_file);
 
@@ -407,7 +415,7 @@ int main(int argc,char **argv)
     arg_v[9]=steps_txt;
     arg_v[10]=cc_txt;
     d3_lattice_draw(&d3_l,x,y,z,10,arg_v);
-    scan_event(&d3_l,&x,&y,&z,&quit,&escape);
+    // scan_event(&d3_l,&x,&y,&z,&quit,&escape);
    }
    i++;
   }