Added a test for void tree. Fixed gadget support in generateMock

This commit is contained in:
Guilhem Lavaux 2011-03-17 13:06:38 -05:00
parent 8515e712da
commit 59e57921b1
2 changed files with 21 additions and 8 deletions

View file

@ -84,7 +84,7 @@ SimuData *doLoadGadget(const char *gadgetname, int velAxis, bool goRedshift)
outd = new SimuData;
outd->NumPart = d->TotalNumPart;
outd->BoxSize = d->BoxSize;
outd->BoxSize = d->BoxSize/1000;
outd->TotalNumPart = outd->NumPart;
outd->Hubble = d->Hubble;
outd->Omega_Lambda = d->Omega_Lambda;
@ -108,7 +108,7 @@ SimuData *doLoadGadget(const char *gadgetname, int velAxis, bool goRedshift)
{
assert(d->Id[i] >= 1);
assert(d->Id[i] <= outd->TotalNumPart);
outd->Pos[k][d->Id[i]-1] = d->Pos[k][i];
outd->Pos[k][d->Id[i]-1] = d->Pos[k][i]/1000;
outd->Vel[2][d->Id[i]-1] = d->Vel[velAxis][i];
}
@ -210,14 +210,25 @@ void metricTransform(SimuData *data, int axis, bool reshift, bool pecvel, double
float z_old = z;
double reduced_red = (z + baseComovingDistance)*100./LIGHT_SPEED;
try
{
// Distorted redshift
if (reduced_red == 0)
z = 0;
else
z = (z_vs_D.compute(reduced_red)-z_base)*LIGHT_SPEED/100.;
expfact[i] = z / z_old;
// Add peculiar velocity
if (pecvel)
z += v/100;
}
catch(const InvalidRangeException& e) {
cout << "Trying to interpolate out of the tabulated range." << endl;
cout << "The offending value is z=" << reduced_red << endl;
abort();
}
}
}
void generateOutput(SimuData *data, int axis,

View file

@ -224,6 +224,8 @@ public:
}
VoidNode *getRoot() { return rootNode; }
template<typename T>
void walkNode(VoidNode *node, T& traverse)
{