From: hackbard Date: Thu, 22 Jul 2004 09:11:42 +0000 (+0000) Subject: implemented TEM like bmp's (1-3) + c concentration bmp's (4-6), added new run X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=ac8af737383695808832d74f318fbaad901895bd;p=physik%2Fnlsop.git implemented TEM like bmp's (1-3) + c concentration bmp's (4-6), added new run --- diff --git a/dfbapi.c b/dfbapi.c index b9b2656..5d1dfe7 100644 --- a/dfbapi.c +++ b/dfbapi.c @@ -367,6 +367,7 @@ int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc,int *switch if(ke.key_id==DIKI_3) *bmp=3; if(ke.key_id==DIKI_4) *bmp=4; if(ke.key_id==DIKI_5) *bmp=5; + if(ke.key_id==DIKI_6) *bmp=6; if(ke.key_id==DIKI_A) *ac_distr=1; if(ke.key_id==DIKI_C) *ac_distr=2; if(ke.key_id==DIKI_B) *ac_distr=3; diff --git a/nlsop.c b/nlsop.c index 07313e4..2945c14 100644 --- a/nlsop.c +++ b/nlsop.c @@ -371,52 +371,27 @@ int write_ac_distr(d3_lattice *d3_l,int ac_distr) return 1; } -int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) +int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z,int max) { - int fd,i,j,size=0,foo=0,end=0; + int fd,i,j,size=0,foo=0,k,sum; int width=0,height=0; char bmpfile[MAX_CHARS]; char buf[128]; - if(((window==4)||(window==5))&&(d3_l->max_zmax_x; - if(window==1) - { - size=(foo+(4-foo%4))*d3_l->max_z; - height=d3_l->max_z; - } - else - { - size=(foo+(4-foo%4))*FFT_HEIGHT; - end=d3_l->max_z-FFT_HEIGHT; - height=FFT_HEIGHT; - } + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; width=d3_l->max_x; } - if(window%3==2) + if(window==2) { sprintf(bmpfile,"y-z_%d.bmp",x); foo=3*d3_l->max_y; - if(window==2) - { - size=(foo+(4-foo%4))*d3_l->max_z; - height=d3_l->max_z; - } - else - { - size=(foo+(4-foo%4))*FFT_HEIGHT; - end=d3_l->max_z-FFT_HEIGHT; - height=FFT_HEIGHT; - } + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; width=d3_l->max_y; } if(window==3) @@ -427,6 +402,30 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) width=d3_l->max_x; height=d3_l->max_y; } + if(window==4) + { + sprintf(bmpfile,"x-z_cdistr_%d.bmp",y); + foo=3*d3_l->max_x; + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; + width=d3_l->max_x; + } + if(window==5) + { + sprintf(bmpfile,"y-z_cdistr_%d.bmp",x); + foo=3*d3_l->max_y; + size=(foo+(4-foo%4))*d3_l->max_z; + height=d3_l->max_z; + width=d3_l->max_y; + } + if(window==6) + { + sprintf(bmpfile,"x-y_cdistr_%d.bmp",z); + foo=3*d3_l->max_x; + size=(foo+(4-foo%4))*d3_l->max_y; + width=d3_l->max_x; + height=d3_l->max_y; + } if((fd=open(bmpfile,O_WRONLY|O_CREAT))<0) { @@ -471,14 +470,17 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) puts("failed writing bmp header"); return -1; } - if(window%3==1) + if(window==1) { - for(j=0;jmax_z-end;j++) + for(j=0;jmax_z;j++) { for(i=0;imax_x;i++) { - if(*(d3_l->status+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); - else memset(buf,0,3); + sum=0; + for(k=-2;k<=2;k++) + if(*(d3_l->status+i+(((y+k+d3_l->max_y)%d3_l->max_y)*d3_l->max_x)+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) sum+=0xff; + sum/=5; + memset(buf,(unsigned char)sum,3); if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file"); @@ -496,14 +498,17 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } } } - if(window%3==2) + if(window==2) { - for(j=0;jmax_z-end;j++) + for(j=0;jmax_z;j++) { for(i=0;imax_y;i++) { - if(*(d3_l->status+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) memset(buf,0xff,3); - else memset(buf,0,3); + sum=0; + for(k=-2;k<=2;k++) + if(*(d3_l->status+((x+k+d3_l->max_x)%d3_l->max_x)+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y)&RED) sum+=0xff; + sum/=5; + memset(buf,(unsigned char)sum,3); if(write(fd,buf,3)<3) { puts("failed writing rgb values to bmp file"); @@ -546,6 +551,84 @@ int write_bmp(d3_lattice *d3_l,int window,u32 x,u32 y,u32 z) } } } + if(window==4) + { + for(j=0;jmax_z;j++) + { + for(i=0;imax_x;i++) + { + sum=*(d3_l->extra+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y); + sum=sum*255/max; + memset(buf,(unsigned char)sum,3); + if(write(fd,buf,3)<3) + { + puts("failed writing rgb values to bmp file"); + return-1; + } + } + if(foo%4) + { + memset(buf,0,4-foo%4); + if(write(fd,buf,4-foo%4)<4-foo%4) + { + puts("failed writing 4 byte ending"); + return -1; + } + } + } + } + if(window==5) + { + for(j=0;jmax_z;j++) + { + for(i=0;imax_x;i++) + { + sum=*(d3_l->extra+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y); + sum=sum*255/max; + memset(buf,(unsigned char)sum,3); + if(write(fd,buf,3)<3) + { + puts("failed writing rgb values to bmp file"); + return-1; + } + } + if(foo%4) + { + memset(buf,0,4-foo%4); + if(write(fd,buf,4-foo%4)<4-foo%4) + { + puts("failed writing 4 byte ending"); + return -1; + } + } + } + } + if(window==6) + { + for(j=0;jmax_z;j++) + { + for(i=0;imax_x;i++) + { + sum=*(d3_l->extra+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y); + sum=sum*255/max; + memset(buf,(unsigned char)sum,3); + if(write(fd,buf,3)<3) + { + puts("failed writing rgb values to bmp file"); + return-1; + } + } + if(foo%4) + { + memset(buf,0,4-foo%4); + if(write(fd,buf,4-foo%4)<4-foo%4) + { + puts("failed writing 4 byte ending"); + return -1; + } + } + } + } close(fd); return 1; @@ -1154,7 +1237,7 @@ int main(int argc,char **argv) bmp=0; ac_distr=0; scan_event(&d3_l,&x,&y,&z,&quit,&escape,&switchmode,&bmp,&ac_distr); - if(bmp) write_bmp(&d3_l,bmp,x,y,z); + if(bmp) write_bmp(&d3_l,bmp,x,y,z,max_extra); if(ac_distr) write_ac_distr(&d3_l,ac_distr); } diff --git a/runs.txt b/runs.txt index 3168769..4295e8c 100644 --- a/runs.txt +++ b/runs.txt @@ -12,3 +12,5 @@ ./nlsop -S data_23_06_2004/default_D_0.01_e10000_f0.00005.save -D 0.01 -e 10000 -f 0.00005 -n -i -Z ./nlsop -S data_21_07_2004/default.save -n -i -Z + +./nlsop -S data_21_07_2004/default_e1000000.save -e 1000000 -n -i -Z