mirror of
https://bitbucket.org/cosmicvoids/vide_public.git
synced 2025-07-05 15:51:12 +00:00
FIXED zobov bug when only using one subdomain; added zobov buffer as tunable parameter
This commit is contained in:
parent
8730193e71
commit
23d665f7bd
6 changed files with 139 additions and 83 deletions
|
@ -28,8 +28,11 @@ int main(int argc, char *argv[]) {
|
|||
int numGuards;
|
||||
int b[3];
|
||||
int numThreads;
|
||||
int isObs = 0;
|
||||
|
||||
if (argc != 9) {
|
||||
printf("Routine: vozinit\n");
|
||||
|
||||
if (argc != 10) {
|
||||
printf("Wrong number of arguments.\n");
|
||||
printf("arg1: position file\n");
|
||||
printf("arg2: buffer size (default 0.1)\n");
|
||||
|
@ -39,6 +42,7 @@ int main(int argc, char *argv[]) {
|
|||
printf("arg6: number of parallel threads\n");
|
||||
printf("arg7: location of voboz executables\n");
|
||||
printf("arg8: output directory\n");
|
||||
printf("arg9: observation flag (set to 1 for observation mode)\n");
|
||||
exit(0);
|
||||
}
|
||||
posfile = argv[1];
|
||||
|
@ -70,8 +74,13 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
vobozPath = argv[7];
|
||||
outDir = argv[8];
|
||||
if (sscanf(argv[9],"%d",&isObs) != 1) {
|
||||
printf("That's no observation mode; try again.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* Read the position file */
|
||||
printf("Reading particle file and calculating box sizes...\n");
|
||||
np = posread(posfile,&rfloat,1./boxsize);
|
||||
/* Boxsize should be the range in r, yielding a range 0-1 */
|
||||
|
||||
|
@ -96,61 +105,67 @@ int main(int argc, char *argv[]) {
|
|||
printf("s = %f, bf = %f, g = %f.\n",s,bf,g);
|
||||
|
||||
nvpmax = 0; nvpbufmax = 0; nvpmin = np; nvpbufmin = np;
|
||||
|
||||
|
||||
// count particles in each sub-domain
|
||||
printf("Counting particles in each subdomain...\n");
|
||||
for (b[0] = 0; b[0] < numdiv; b[0]++) {
|
||||
c[0] = ((float)b[0]+0.5)*width;
|
||||
for (b[1] = 0; b[1] < numdiv; b[1]++) {
|
||||
c[0] = ((float)b[0]+0.5)*width;
|
||||
for (b[1] = 0; b[1] < numdiv; b[1]++) {
|
||||
c[1] = ((float)b[1]+0.5)*width;
|
||||
for (b[2] = 0; b[2] < numdiv; b[2]++) {
|
||||
c[2] = ((float)b[2]+0.5)*width;
|
||||
for (b[2] = 0; b[2] < numdiv; b[2]++) {
|
||||
c[2] = ((float)b[2]+0.5)*width;
|
||||
|
||||
nvp = 0; /* Number of particles excluding buffer */
|
||||
nvpbuf = 0; /* Number of particles to tesselate, including
|
||||
buffer */
|
||||
xmin = BF; xmax = -BF; ymin = BF; ymax = -BF; zmin = BF; zmax = -BF;
|
||||
for (i=0; i<np; i++) {
|
||||
isitinbuf = 1; isitinmain = 1;
|
||||
for (d=0; d<3; d++) {
|
||||
rtemp[d] = rfloat[i][d] - c[d];
|
||||
if (rtemp[d] > 0.5) rtemp[d] --;
|
||||
if (rtemp[d] < -0.5) rtemp[d] ++;
|
||||
isitinbuf = isitinbuf && (fabs(rtemp[d]) < totwidth2);
|
||||
isitinmain = isitinmain && (fabs(rtemp[d]) <= width2);
|
||||
}
|
||||
if (isitinbuf) {
|
||||
nvpbuf++;
|
||||
}
|
||||
if (isitinmain) {
|
||||
nvp++;
|
||||
if (rtemp[0] < xmin) xmin = rtemp[0];
|
||||
if (rtemp[0] > xmax) xmax = rtemp[0];
|
||||
if (rtemp[1] < ymin) ymin = rtemp[1];
|
||||
if (rtemp[1] > ymax) ymax = rtemp[1];
|
||||
if (rtemp[2] < zmin) zmin = rtemp[2];
|
||||
if (rtemp[2] > zmax) zmax = rtemp[2];
|
||||
}
|
||||
}
|
||||
if (nvp > nvpmax) nvpmax = nvp;
|
||||
if (nvpbuf > nvpbufmax) nvpbufmax = nvpbuf;
|
||||
if (nvp < nvpmin) nvpmin = nvp;
|
||||
if (nvpbuf < nvpbufmin) nvpbufmin = nvpbuf;
|
||||
|
||||
printf("b=(%d,%d,%d), c=(%f,%f,%f), nvp=%d, nvpbuf=%d\n",
|
||||
b[0],b[1],b[2],c[0],c[1],c[2],nvp,nvpbuf);
|
||||
nvp = 0; /* Number of particles excluding buffer */
|
||||
nvpbuf = 0; /* Number of particles to tesselate, including buffer */
|
||||
xmin = BF; xmax = -BF; ymin = BF; ymax = -BF; zmin = BF; zmax = -BF;
|
||||
|
||||
for (i=0; i<np; i++) {
|
||||
isitinbuf = 1; isitinmain = 1;
|
||||
for (d=0; d<3; d++) {
|
||||
rtemp[d] = rfloat[i][d] - c[d];
|
||||
//if (isObs == 0) {
|
||||
if (rtemp[d] > 0.5) rtemp[d] --;
|
||||
if (rtemp[d] < -0.5) rtemp[d] ++;
|
||||
//}
|
||||
isitinbuf = isitinbuf && (fabs(rtemp[d]) < totwidth2);
|
||||
isitinmain = isitinmain && (fabs(rtemp[d]) <= width2);
|
||||
}
|
||||
if (isitinbuf) { nvpbuf++; }
|
||||
if (isitinmain) {
|
||||
nvp++;
|
||||
if (rtemp[0] < xmin) xmin = rtemp[0];
|
||||
if (rtemp[0] > xmax) xmax = rtemp[0];
|
||||
if (rtemp[1] < ymin) ymin = rtemp[1];
|
||||
if (rtemp[1] > ymax) ymax = rtemp[1];
|
||||
if (rtemp[2] < zmin) zmin = rtemp[2];
|
||||
if (rtemp[2] > zmax) zmax = rtemp[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nvp > nvpmax) nvpmax = nvp;
|
||||
if (nvpbuf > nvpbufmax) nvpbufmax = nvpbuf;
|
||||
if (nvp < nvpmin) nvpmin = nvp;
|
||||
if (nvpbuf < nvpbufmin) nvpbufmin = nvpbuf;
|
||||
|
||||
printf("Subdomain: b=(%d,%d,%d), c=(%f,%f,%f)\n",
|
||||
b[0],b[1],b[2],c[0],c[1],c[2]);
|
||||
printf(" nvp=%d, nvpbuf=%d\n", nvp,nvpbuf);
|
||||
printf(" Particle ranges: x: %f,%f; y: %f,%f; z:%f,%f\n",
|
||||
xmin,xmax,ymin,ymax,zmin,zmax);
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Nvp range: %d,%d\n",nvpmin,nvpmax);
|
||||
printf("Nvpbuf range: %d,%d\n",nvpbufmin,nvpbufmax);
|
||||
|
||||
numGuards = 6*(NGUARD+1)*(NGUARD+1);
|
||||
printf("Num guards = %d\n", numGuards);
|
||||
printf("Total max particles: %d\n" , nvpbufmax+numGuards);
|
||||
if (nvpbufmax+numGuards >= QHULL_MAX_PARTICLES)
|
||||
{
|
||||
if (nvpbufmax+numGuards >= QHULL_MAX_PARTICLES) {
|
||||
printf("Too many particles to tesselate per division (Qhull will overflow). Increase divisions or reduce buffer size.\n");
|
||||
fflush(stdout);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Output script file */
|
||||
sprintf(scrfile,"scr%s",suffix);
|
||||
|
@ -164,23 +179,19 @@ int main(int argc, char *argv[]) {
|
|||
fprintf(scr,"#!/bin/bash -f\n");
|
||||
p = 0;
|
||||
for (b[0]=0;b[0]<numdiv; b[0]++) {
|
||||
for (b[1] = 0; b[1] < numdiv; b[1]++) {
|
||||
for (b[2] = 0; b[2] < numdiv; b[2]++) {
|
||||
//fprintf(scr,"%s/../c_tools/zobov2/voz1b1/voz1b1_2 %s %f %f %f %f %s %d %d %d %d %d %d %s&\n",
|
||||
// vobozPath,
|
||||
// posfile,border,boxsize,boxsize,boxsize,suffix,numdiv,numdiv, numdiv,b[0],b[1],b[2],
|
||||
// outDir);
|
||||
fprintf(scr,"%s/voz1b1 %s %f %f %s %d %d %d %d %s&\n",
|
||||
for (b[1] = 0; b[1] < numdiv; b[1]++) {
|
||||
for (b[2] = 0; b[2] < numdiv; b[2]++) {
|
||||
fprintf(scr,"%s/voz1b1 %s %f %f %s %d %d %d %d %s %d\n",
|
||||
vobozPath,
|
||||
posfile,border,boxsize,suffix,numdiv,b[0],b[1],b[2],
|
||||
outDir);
|
||||
outDir, isObs);
|
||||
p++;
|
||||
if ((p == numThreads)) { fprintf(scr, "wait\n"); p = 0; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(scr,"wait\n");
|
||||
fprintf(scr,"%s/voztie %d %s %s %d\n", vobozPath, numdiv,suffix, outDir);
|
||||
fprintf(scr,"%s/voztie %d %s %s %d\n", vobozPath, numdiv,suffix, outDir, isObs);
|
||||
fclose(scr);
|
||||
|
||||
sprintf(systemstr,"chmod u+x %s",scrfile);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue