Emit the particle id and not its rank. At the moment the two are equivalent but will change.

This commit is contained in:
Guilhem Lavaux 2012-11-20 09:56:24 -05:00
parent 9e79c784f3
commit 03782c8843

View file

@ -115,6 +115,7 @@ SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift,
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
outd->Pos[k] = new float[outd->NumPart]; outd->Pos[k] = new float[outd->NumPart];
outd->Vel[2] = new float[outd->NumPart]; outd->Vel[2] = new float[outd->NumPart];
outd->Id = new int[outd->NumPart];
delete d; delete d;
int curCpu = singleFile ? -1 : 0; int curCpu = singleFile ? -1 : 0;
@ -127,15 +128,20 @@ SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift,
for (int k = 0; k < 3; k++) for (int k = 0; k < 3; k++)
for (int i = 0; i < d->NumPart; i++) for (int i = 0; i < d->NumPart; i++)
{ {
assert(d->Id[i] >= 1); int pid = d->Id[i]-1;
assert(d->Id[i] <= outd->TotalNumPart); assert(pid >= 0);
outd->Pos[k][d->Id[i]-1] = d->Pos[k][i]/1000; assert(pid < outd->TotalNumPart);
outd->Vel[2][d->Id[i]-1] = d->Vel[velAxis][i]; outd->Pos[k][pid] = d->Pos[k][i]/1000;
outd->Vel[2][pid] = d->Vel[velAxis][i];
outd->Id[pid] = pid+1;
} }
if (goRedshift) if (goRedshift)
for (int i = 0; i < d->NumPart; i++) for (int i = 0; i < d->NumPart; i++)
outd->Pos[velAxis][d->Id[i]-1] += d->Vel[velAxis][i]/100.; {
int pid = d->Id[i]-1;
outd->Pos[velAxis][pid] += d->Vel[velAxis][i]/100.;
}
delete d; delete d;
if (singleFile) if (singleFile)
@ -476,7 +482,7 @@ void makeBox(SimuData *simu, double *efac, SimuData *&boxed, generateMock_info&
assert(boxed->Pos[j][k] > 0); assert(boxed->Pos[j][k] > 0);
assert(boxed->Pos[j][k] < 1); assert(boxed->Pos[j][k] < 1);
} }
particle_id[k] = i; particle_id[k] = simu->Id[i]-1;
expansion_fac[k] = efac[i]; expansion_fac[k] = efac[i];
k++; k++;
} }