X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=nlsop.c;h=e9d72ab44c05e319ba6da6152eac2816eee29afc;hp=d61d2aca2868b7a95b4941198adcabb7c996ffb3;hb=5a71cbde820d64c0bca211edcdc0b6af4498e727;hpb=f271c1142da782420ef76f1f85750949094e4269;ds=sidebyside diff --git a/nlsop.c b/nlsop.c index d61d2ac..e9d72ab 100644 --- a/nlsop.c +++ b/nlsop.c @@ -87,7 +87,7 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int } } } - // printf("debug: p = %f\n",p); + printf("debug: p = %f\n",p); if(!(*thiz&AMORPH)) { if(get_rand(URAND_MAX)<=p) MAKE_AMORPH(thiz); @@ -233,6 +233,38 @@ int distrib_c(d3_lattice *d3_l,double d_r,double a,double b,char z_diff) return 1; } +int calc_pressure(d3_lattice *d3_l,int range) +{ + int i,j,off; + double count; + int x,y,z; + + for(x=0;xmax_x;x++) + { + for(y=0;ymax_y;y++) + { + for(z=0;zmax_z;z++) + { + count=0; + for(i=-range;i<=range;i++) + { + for(j=-range;j<=range;j++) + { + if(i!=0 && j!=0) + { + off=((x+d3_l->max_x+i)%d3_l->max_x)+((y+d3_l->max_y+j)%d3_l->max_x)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y; + if(*(d3_l->status+off)&AMORPH) count+=((double)*(d3_l->extra+off))/(i*i+j*j); + } + } + } + *(unsigned char *)(d3_l->v_ptr+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)=(unsigned char)(count*255/MAX_VPTR); + } + } + } + + return 1; +} + int distrib_c_old(d3_lattice *d3_l,int t_c,double a,double b) { int i,j,k,total,area; @@ -404,7 +436,7 @@ int convert_file(char *cf,d3_lattice *d3_l) int main(int argc,char **argv) { u32 x,y,z,x_c,y_c,z_c; - int i,quit,escape,nowait; + int i,quit,escape,switchmode,nowait; int refresh,resave; char z_diff; char s_file[MAX_CHARS]; @@ -431,10 +463,12 @@ int main(int argc,char **argv) char cd2_txt[MAX_TXT]; char el2_txt[MAX_TXT]; char dr_txt[MAX_TXT]; + char mode_txt[MAX_TXT]; char *arg_v[MAX_ARGV]; #endif d3_lattice d3_l; info my_info; + unsigned char mode; d3_l.max_x=X; d3_l.max_y=Y; @@ -455,11 +489,13 @@ int main(int argc,char **argv) nowait=0; quit=0; escape=0; + switchmode=0; strcpy(s_file,""); strcpy(l_file,""); strcpy(c_file,""); convert=0; strcpy(r_file,""); + mode=0; for(i=1;i