diff --git a/zobov/jozov.c b/zobov/jozov.c
index db6909f..a4ee12b 100644
--- a/zobov/jozov.c
+++ b/zobov/jozov.c
@@ -124,19 +124,26 @@ int main(int argc,char **argv) {
fread(&j,1,sizeof(pid_t),adj);
if (j < np) {
/* Set both halves of the pair */
- assert(i < j);
+ assert(i < j);
if (p[i].ncnt == p[i].nadj)
{
- p[i].adj = (pid_t *)realloc(p[i].adj, (p[i].nadj+1)*sizeof(pid_t));
- p[i].nadj++;
+ int q;
+ printf("OVERFLOW for particle %d (pending %d). List of accepted:\n", i, j);
+ for (q=0;q
0.5) rtemp[d] --;
if (rtemp[d] < -0.5) rtemp[d] ++;
isitinmain = isitinmain && (fabs(rtemp[d]) <= width2);
@@ -186,7 +186,7 @@ int main(int argc, char *argv[]) {
isitinmain = 1;
DL {
- rtemp[d] = r[i][d] - c[d];
+ rtemp[d] = (realT)r[i][d] - (realT)c[d];
if (rtemp[d] > 0.5) rtemp[d] --;
if (rtemp[d] < -0.5) rtemp[d] ++;
isitinbuf = isitinbuf && (fabs(rtemp[d])
#include
#include
#include
@@ -96,7 +97,11 @@ int main(int argc, char *argv[]) {
exit(0);
}
for (p=0;p -1.)
-// PMS
if (fabs(vols[orig[p]]-volstemp)/volstemp > 1.5e-3 && orig[p] < mockIndex) {
- //if (fabs(vols[orig[p]]-volstemp)/volstemp > 1.5e-3) {
-// END PMS
printf("Inconsistent volumes for p. %d: (%10g,%10g)!\n",
orig[p],vols[orig[p]],volstemp);
-// TEST
//exit(0);
}
vols[orig[p]] = volstemp;
@@ -132,10 +133,13 @@ int main(int argc, char *argv[]) {
for (p=0;p 0) {
+ assert(adjs[pid].nadj == 0);// || adjs[pid].nadj == na);
adjs[orig[p]].nadj = na;
- adjs[orig[p]].adj = (pid_t *)malloc(na*sizeof(pid_t));
- if (adjs[orig[p]].adj == NULL) {
+ if (adjs[pid].adj == 0)
+ adjs[orig[p]].adj = (pid_t *)malloc(na*sizeof(pid_t));
+ if (adjs[orig[p]].adj == 0) {
printf("Couldn't allocate adjs[orig[%d]].adj.\n",p);
exit(0);
}
@@ -160,51 +164,37 @@ int main(int argc, char *argv[]) {
adjs[i].nadj = 0;
}
- // unlink particles adjacent to mock galaxies
- for (i = 0; i < mockIndex; i++) {
- for (j = 0; j < adjs[i].nadj; j++) {
- if (adjs[i].adj[j] > mockIndex) {
-//printf("KILLING %d\n", i);
- vols[i] = 1.e-29;
- adjs[i].nadj = 0;
- numRemoved++;
- break;
- }
- }
- }
-
- // update all other adjacencies
- for (i = 0; i < mockIndex; i++) {
-
- int numAdjSaved = 0;
- for (j = 0; j < adjs[i].nadj; j++) {
-
- //if ( vols[adjs[i].adj[j]] != -99) {
- if ( adjs[adjs[i].adj[j]].nadj != 0) {
- adjs[i].adj[numAdjSaved] = adjs[i].adj[j];
- numAdjSaved++;
- }
-
- }
- adjs[i].nadj = numAdjSaved;
-
- }
-
-/*
+ // unlink particles adjacent to mock galaxies
for (i = 0; i < mockIndex; i++) {
-printf("ADJ: %d %d : ", i, adjs[i].nadj);
for (j = 0; j < adjs[i].nadj; j++) {
-printf(" %d", adjs[i].adj[j]);
+ if (adjs[i].adj[j] > mockIndex) {
+//printf("KILLING %d\n", i);
+ vols[i] = 1.e-29;
+ adjs[i].nadj = 0;
+ numRemoved++;
+ break;
+ }
}
-printf("\n");
}
-*/
-
+ // update all other adjacencies
+ for (i = 0; i < mockIndex; i++) {
+
+ int numAdjSaved = 0;
+ for (j = 0; j < adjs[i].nadj; j++) {
- printf("Removed %d mock galaxies and %d adjacent galaxies.\n", np-mockIndex,
+ if ( adjs[adjs[i].adj[j]].nadj != 0) {
+ adjs[i].adj[numAdjSaved] = adjs[i].adj[j];
+ numAdjSaved++;
+ }
+
+ }
+ 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);
+ printf("There are %d galaxies remaining.\n", mockIndex-numRemoved);
// END PMS
@@ -238,10 +228,7 @@ printf("\n");
printf("Unable to open %s\n",adjfile);
exit(0);
}
-// PMS
fwrite(&mockIndex,1, sizeof(int),adj);
- //fwrite(&np,1, sizeof(int),adj);
-// END OMS
/* Adjacencies: first the numbers of adjacencies,
and the number we're actually going to write per particle */
@@ -249,19 +236,15 @@ printf("\n");
for(i=0;i 0) {
-// END PMS
nout = 0;
- for (j=0;j i) nout++;
+ for (j=0;j i)
+ nout++;
fwrite(&nout,1,sizeof(int),adj);
for (j=0;j