From: hackbard Date: Wed, 14 May 2003 23:41:38 +0000 (+0000) Subject: - X-Git-Tag: fpb~54 X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cae1c91bf6b8d41d5a436f48f6e18514eeedbfb9;p=physik%2Fnlsop.git - --- diff --git a/dfbapi.c b/dfbapi.c index dfb3ae8..138f7e4 100644 --- a/dfbapi.c +++ b/dfbapi.c @@ -232,7 +232,7 @@ int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v) d3_l->p_surface->SetColor(d3_l->p_surface,r,g,b,a); d3_l->p_surface->DrawRectangle(d3_l->p_surface, x_c*d3_l->fakt_x+X_GAP, - y_c*d3_l->fakt_x+d3_l->info_x, + y_c*d3_l->fakt_y+d3_l->info_y, d3_l->fakt_x,d3_l->fakt_y); } } @@ -272,6 +272,9 @@ int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v) } } + /* now we flip all to surface */ + d3_l->p_surface->Flip(d3_l->p_surface,NULL,0); + return 1; } diff --git a/nlsop.c b/nlsop.c index 736003a..1d2e6d6 100644 --- a/nlsop.c +++ b/nlsop.c @@ -99,7 +99,8 @@ int process_cell(d3_lattice *d3_l,u32 x,u32 y,u32 z,int r,double a,double b,int int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) { - int i,j,k,total,area,sum; + int i,j,k,total,area; + double sum; int temp,left; int *area_h; u32 x,y,z; @@ -108,7 +109,7 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) area_h=(int *)malloc(d3_l->max_z*sizeof(int)); total=0; - sum=0; + sum=b*d3_l->max_z+a*d3_l->max_z*(d3_l->max_z+1)/2; for(i=0;imax_z;i++) { area_h[i]=0; @@ -116,15 +117,11 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) { if(!(*(d3_l->status+(i*area)+j)&AMORPH)) { - sum+=(i+1)*a+b; area_h[i]+=1; } } - } - for(i=0;imax_z;i++) - { - temp=((i+1)*a+b)*t_c/(sum+area_h[i]); - if(temp>1) + temp=(int)((i+1)*a+b)*t_c/(sum*area_h[i]); + if(temp) { for(j=0;jmax_x); y=get_rand(d3_l->max_y); - if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH)) + if(!(*(d3_l->status+(i*area)+j)&AMORPH)) { *(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1; total+=1; @@ -158,9 +155,9 @@ int distrib_c(d3_lattice *d3_l,int t_c,double a,double b) { *(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1; left-=1; - total+=1; } } + free(area_h); return 1; } @@ -251,7 +248,7 @@ int main(int argc,char **argv) char conc_txt[MAX_TXT]; char steps_txt[MAX_TXT]; char cc_txt[MAX_TXT]; - char **arg_v; + char *arg_v[MAX_ARGV]; d3_lattice d3_l; max_x=X; @@ -382,6 +379,7 @@ int main(int argc,char **argv) if(!strcmp(l_file,"")) { + i=0; while((i