/* $Author$ $Log$ $Revision$ */ #include #include #include #include "macros_gen.h" #include "macros_6.h" #include "parameters.h" #define NZMAX 10000000 #define RAND1 (float) ran1(&seed) long seed; void gravitate(g,flag, nx, ny, solid, lattice ) float g; char flag; int nx, ny; unsigned char *solid, *lattice; { /*---------------------------------------------------------------* * Gravity: * flag can be 'i', meaning "initialize;" in that case, various * static variables are initialized; or 'f', meaning "force." * nx, ny dimsion of lattice * solid, lattice are selfexplanatory *---------------------------------------------------------------*/ float ran1(); static int states, gravitons; static float dgextra, gextra; switch (flag) { case 'i': /*initialize*/ { int i, j, size; states = 0; size = nx*ny; for (i=0; i NZMAX) { fprintf(stderr,"nz too large\n"); exit(1); } if(!(latt = (unsigned char *) malloc(nz*sizeof(unsigned char)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } if(!(newlatt = (unsigned char *) malloc(nz*sizeof(unsigned char)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } if(!(table = (unsigned char *) malloc(256*sizeof(unsigned char)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } if(!(solid = (unsigned char *) malloc(nz*sizeof(unsigned char)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } if(!(xmom=(int *) calloc(nz,sizeof(int)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } if(!(ymom=(int *) calloc(nz,sizeof(int)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } if(!(mass=(int *) calloc(nz,sizeof(int)))) { fprintf(stderr,"%s:%d allocation error\n",__FILE__,__LINE__); exit(-1); } tabgen(table); /* Initialize the lattice with density dens */ for(iz=0;iz ny - WALL_THICKNESS -1) ) solid[iz] = 1; } #endif #if DISK fprintf(stderr,"disk with radius: %d at x=%d, y=%d\n", RADIUS,XC,YC); /* opening file with solid */ for(iR=1;iR<1*RADIUS;iR++) { dR=(float) iR/1.; nAngles=(int) (2*PI*(RADIUS)); nAngles *= 20; for(iAngle=1;iAngleTMAX) { for(iy=0;iy