removed mock particle tracking, since that is no longer used

This commit is contained in:
Paul M. Sutter 2025-04-21 16:23:25 -04:00
parent fc2d7157f4
commit d9efa15474
8 changed files with 71 additions and 173 deletions

View file

@ -34,10 +34,6 @@ int main(int argc, char *argv[]) {
int numRemoved = 0;
// PMS
int mockIndex;
// END PMS
if (argc != 5) {
printf("Wrong number of arguments.\n");
printf("arg1: number of divisions (default 2)\n");
@ -57,10 +53,6 @@ int main(int argc, char *argv[]) {
suffix = argv[2];
outDir = argv[3];
if (sscanf(argv[4],"%d",&mockIndex) != 1) {
printf("That's no mock galaxy index; try again.\n");
exit(0);
}
np = -1; nvpmax = -1; nvpsum = 0;
@ -92,10 +84,6 @@ int main(int argc, char *argv[]) {
printf("We have %d particles to tie together.\n",np); fflush(stdout);
printf("The maximum number of particles in a file is %d.\n",nvpmax);
// PMS
if (mockIndex == -1) mockIndex = np;
// END PMS
cnt_adj = (int *)malloc(np*sizeof(int));
if (cnt_adj == NULL)
printf("Could not allocate cnt_adj.\n");
@ -137,7 +125,7 @@ int main(int argc, char *argv[]) {
for (p=0;p<nvp;p++) {
fread(&volstemp,1,sizeof(float),part);
if (vols[orig[p]] > -1.)
if (fabs(vols[orig[p]]-volstemp)/volstemp > 1.5e-3 && orig[p] < mockIndex) {
if (fabs(vols[orig[p]]-volstemp)/volstemp > 1.5e-3) {
printf("Inconsistent volumes for p. %d: (%10g,%10g)!\n",
orig[p],vols[orig[p]],volstemp);
//exit(0);
@ -183,16 +171,10 @@ int main(int argc, char *argv[]) {
// PMS : remove mock galaxies and anything adjacent to a mock galaxy
printf("\nRemoving mock galaxies...\n");
// completely unlink mock particles
for (i = mockIndex; i < np; i++) {
vols[i] = 1.e-29;
adjs[i].nadj = 0;
}
// unlink particles adjacent to mock galaxies
for (i = 0; i < mockIndex; i++) {
for (i = 0; i < np; i++) {
for (j = 0; j < adjs[i].nadj; j++) {
if (adjs[i].adj[j] > mockIndex) {
if (adjs[i].adj[j] > np) {
//printf("KILLING %d\n", i);
vols[i] = 1.e-29;
adjs[i].nadj = 0;
@ -203,7 +185,7 @@ int main(int argc, char *argv[]) {
}
// update all other adjacencies
for (i = 0; i < mockIndex; i++) {
for (i = 0; i < np; i++) {
int numAdjSaved = 0;
for (j = 0; j < adjs[i].nadj; j++) {
@ -217,10 +199,6 @@ int main(int argc, char *argv[]) {
adjs[i].nadj = numAdjSaved;
}
printf("Removed %d mock galaxies and %d adjacent galaxies.\n", np-mockIndex,
numRemoved);
printf("There are %d galaxies remaining.\n", mockIndex-numRemoved);
// END PMS
*/
@ -254,19 +232,19 @@ int main(int argc, char *argv[]) {
printf("Unable to open %s\n",adjfile);
exit(0);
}
fwrite(&mockIndex,1, sizeof(int),adj);
fwrite(&np,1, sizeof(int),adj);
/* Adjacencies: first the numbers of adjacencies,
and the number we're actually going to write per particle */
// Recount the number of adjacencies after merge
for(i=0;i<mockIndex;i++)
for(i=0;i<np;i++)
cnt_adj[i] = adjs[i].nadj;
for (i=0;i<mockIndex;i++)
for (i=0;i<np;i++)
fwrite(&cnt_adj[i],1,sizeof(int),adj);
/* Now the lists of adjacencies (without double counting) */
for (i=0;i<mockIndex;i++) {
for (i=0;i<np;i++) {
nout = 0;
for (j=0;j<adjs[i].nadj; j++)
if (adjs[i].adj[j] > i)
@ -287,12 +265,8 @@ int main(int argc, char *argv[]) {
printf("Unable to open %s\n",volfile);
exit(0);
}
// PMS
fwrite(&mockIndex,1, sizeof(int),vol);
fwrite(vols,sizeof(float),mockIndex,vol);
//fwrite(&np,1, sizeof(int),vol);
//fwrite(vols,sizeof(float),np,vol);
// END PMS
fwrite(&np,1, sizeof(int),vol);
fwrite(vols,sizeof(float),np,vol);
fclose(vol);