From: hackbard Date: Tue, 4 Oct 2005 12:51:50 +0000 (+0000) Subject: added cbox creation tool X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=commitdiff_plain;h=a88f447ec667b6270fda759bf57041e8c75580b6;ds=inline added cbox creation tool --- diff --git a/nlsop_create_cbox.c b/nlsop_create_cbox.c new file mode 100644 index 0000000..962abc3 --- /dev/null +++ b/nlsop_create_cbox.c @@ -0,0 +1,102 @@ +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include "nlsop.h" +#include "dfbapi.h" + +int main(int argc,char **argv) { + + int fd; + double atp; + int area,size,x,y,z,d; + int i,j,k; + d3_lattice d3l; + info info; + unsigned char *status; + int *conc; + double sigma; + int C,C0; + + if(argc!=5) { + printf("usage: %s \n",argv[0]); + return -23; + } + + if((fd=open("cbox.save",O_WRONLY))<0) { + perror("open"); + printf("unable to open save file!\n"); + return -23; + } + + x=atoi(argv[1]); + y=atoi(argv[2]); + z=atoi(argv[3]); + d=500/3; /* maximum 180keV, so ... */ + atp=atof(argv[4]); + area=x*y; + size=area*z; + C=(1.0*atp*SI_PER_VOLUME)/(1-atp); + sigma=(1.0*((700-500)/3)*((700-500)/3))/(log(C)); + + printf("sanity checks ...\n"); + + if(z=1) { + printf("even more stupid!\n"); + return -23; + } + + printf("malloc ...\n"); + + status=malloc(size*sizeof(unsigned char)); + memset(status,0,size*sizeof(unsigned char)); + conc=malloc(size*sizeof(int)); + + printf("computing c profile ...\n"); + + i=area*(d+1); + C0=C; + printf(" first constant part -> %d\n",C0); + for(k=0;k