}
}
}
- *(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);
+ *((unsigned int *)(d3_l->v_ptr)+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)=(count*500/max);
}
}
}
char file[32];
int si_count;
- si_count=d3_l->max_x*d3_l->max_y*SI_PER_VOLUME;
if(ac_distr==1) strcpy(file,"carbon_in_av.plot");
if(ac_distr==2) strcpy(file,"carbon_in_cv.plot");
if(ac_distr==3) strcpy(file,"carbon.plot");
for(z=0;z<d3_l->max_z;z++)
{
count=0;
+ si_count=0;
for(x=0;x<d3_l->max_x;x++)
{
for(y=0;y<d3_l->max_y;y++)
{
offset=x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y;
if(ac_distr==1)
- if(*(d3_l->status+offset)&AMORPH) count+=*(d3_l->extra+offset);
+ if(*(d3_l->status+offset)&AMORPH)
+ {
+ count+=*(d3_l->extra+offset);
+ si_count+=1;
+ }
if(ac_distr==2)
- if(!(*(d3_l->status+offset)&AMORPH)) count+=*(d3_l->extra+offset);
- if(ac_distr==3) count+=*(d3_l->extra+offset);
+ if(!(*(d3_l->status+offset)&AMORPH))
+ {
+ count+=*(d3_l->extra+offset);
+ si_count+=1;
+ }
+ if(ac_distr==3)
+ {
+ count+=*(d3_l->extra+offset);
+ si_count+=1;
+ }
if(ac_distr==4)
if(*(d3_l->status+offset)&AMORPH) count+=1;
}
}
+ si_count*=SI_PER_VOLUME;
if(ac_distr==4) dprintf(fd,"%d %d\n",z*CELL_LENGTH,count);
#ifdef ATPROZ
- else dprintf(fd,"%d %f\n",z*CELL_LENGTH,100.0*count/si_count);
+ else
+ {
+ if(si_count)
+ dprintf(fd,"%d %f\n",z*CELL_LENGTH,100.0*count/(si_count+count));
+ else
+ dprintf(fd,"%d 0\n",z*CELL_LENGTH);
+ }
#else
else dprintf(fd,"%d %d\n",z*CELL_LENGTH,count/(d3_l->max_x*d3_l->max_y));
#endif
}
if(window==7)
{
- sprintf(bmpfile,"x-z_a_cdistr_%d.bmp",y);
+ sprintf(bmpfile,"x-z_pressure_%d.bmp",y);
foo=3*d3_l->max_x;
size=(foo+(4-foo%4))*d3_l->max_z;
height=d3_l->max_z;
}
if(window==8)
{
- sprintf(bmpfile,"y-z_a_cdistr_%d.bmp",x);
+ sprintf(bmpfile,"y-z_pressure_%d.bmp",x);
foo=3*d3_l->max_y;
size=(foo+(4-foo%4))*d3_l->max_z;
height=d3_l->max_z;
}
if(window==9)
{
- sprintf(bmpfile,"x-y_a_cdistr_%d.bmp",z);
+ sprintf(bmpfile,"x-y_pressure_%d.bmp",z);
foo=3*d3_l->max_x;
size=(foo+(4-foo%4))*d3_l->max_y;
height=d3_l->max_y;
{
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);
+ memset(buf+1,(unsigned char)sum,2);
+ buf[0]=0xff;
if(write(fd,buf,3)<3)
{
puts("failed writing rgb values to bmp file");
{
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);
+ memset(buf+1,(unsigned char)sum,2);
+ buf[0]=0xff;
if(write(fd,buf,3)<3)
{
puts("failed writing rgb values to bmp file");
{
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);
+ memset(buf+1,(unsigned char)sum,2);
+ buf[0]=0xff;
if(write(fd,buf,3)<3)
{
puts("failed writing rgb values to bmp file");
{
for(i=0;i<d3_l->max_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) sum=*(d3_l->extra+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
- else sum=0;
- sum=sum*255/max;
- memset(buf,(unsigned char)sum,3);
+ sum=*((unsigned int *)(d3_l->v_ptr)+i+y*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
+ buf[0]=0;
+ if(sum<=255) {
+ buf[1]=0;
+ buf[2]=sum;
+ } else {
+ buf[1]=(sum-255);
+ buf[2]=0xff;
+ }
if(write(fd,buf,3)<3)
{
puts("failed writing rgb values to bmp file");
{
for(i=0;i<d3_l->max_x;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) sum=*(d3_l->extra+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
- else sum=0;
- sum=sum*255/max;
- memset(buf,(unsigned char)sum,3);
+ sum=*((unsigned int *)(d3_l->v_ptr)+x+i*d3_l->max_x+(d3_l->max_z-j-1)*d3_l->max_x*d3_l->max_y);
+ buf[0]=0;
+ if(sum<=255) {
+ buf[1]=0;
+ buf[2]=sum;
+ } else {
+ buf[1]=(sum-255);
+ buf[2]=0xff;
+ }
if(write(fd,buf,3)<3)
{
puts("failed writing rgb values to bmp file");
{
for(i=0;i<d3_l->max_x;i++)
{
- if(*(d3_l->status+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)&RED) sum=*(d3_l->extra+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y);
- else sum=0;
- sum=sum*255/max;
- memset(buf,(unsigned char)sum,3);
+ sum=*((unsigned int *)(d3_l->v_ptr)+i+(d3_l->max_y-j-1)*d3_l->max_x+z*d3_l->max_x*d3_l->max_y);
+ buf[0]=0;
+ if(sum<=255) {
+ buf[1]=0;
+ buf[2]=sum;
+ } else {
+ buf[1]=(sum-255);
+ buf[2]=0xff;
+ }
+ printf("sum = %d => r: %02x g: %02x b: %02x\n",sum,buf[2],buf[1],buf[0]);
if(write(fd,buf,3)<3)
{
puts("failed writing rgb values to bmp file");
#ifdef USE_DFB_API
/* allocating buffer for pressure values */
printf("allocating buffer for preassure values ...");
- if((d3_l.v_ptr=malloc(d3_l.max_x*d3_l.max_y*d3_l.max_z*sizeof(unsigned char)))==NULL)
+ if((d3_l.v_ptr=malloc(d3_l.max_x*d3_l.max_y*d3_l.max_z*sizeof(unsigned int)))==NULL)
{
puts("cannot allocate buffer for pressure values");
return -1;