Merge branch 'master' of bitbucket.org:cosmicvoids/void_identification

This commit is contained in:
P.M. Sutter 2013-03-07 10:44:11 -06:00
commit 5746e76d46
6 changed files with 51 additions and 17 deletions

View file

@ -125,6 +125,7 @@ void metricTransform(SimuData *data, int axis, bool reshift, bool pecvel, double
float z_old = z;
double reduced_red = (z + baseComovingDistance)*100./LIGHT_SPEED;
double reduced_base = (reshift ? (baseComovingDistance*100./LIGHT_SPEED) : 0);
try
{
@ -134,7 +135,7 @@ void metricTransform(SimuData *data, int axis, bool reshift, bool pecvel, double
else if (cosmo_flag)
z = (z_vs_D.compute(reduced_red)-z_base)*LIGHT_SPEED/100.;
else
z = reduced_red*LIGHT_SPEED/100.0;
z = (reduced_red-reduced_base)*LIGHT_SPEED/100.0;
if (expfact)
expfact[i] = z / z_old;

View file

@ -69,7 +69,6 @@ public:
return num_splitting;
}
int64_t getStart(int id)
{
return sdf_header->TotalNumPart * int64_t(id) / num_splitting;
@ -87,7 +86,7 @@ public:
#define INFINITY std::numeric_limits<float>::max()
float shift = 0.5*d->BoxSize;
rescale_position /= d->time;
float min_pos[3] = {INFINITY,INFINITY, INFINITY}, max_pos[3] = {-INFINITY,-INFINITY,-INFINITY};
// float min_pos[3] = {INFINITY,INFINITY, INFINITY}, max_pos[3] = {-INFINITY,-INFINITY,-INFINITY};
if (d->Pos[0] != 0)
{
@ -96,10 +95,10 @@ public:
for (int64_t i = 0; i < d->NumPart; i++)
{
d->Pos[k][i] = (d->Pos[k][i]*rescale_position + shift);
min_pos[k] = std::min(min_pos[k], d->Pos[k][i]);
max_pos[k] = std::max(max_pos[k], d->Pos[k][i]);
// min_pos[k] = std::min(min_pos[k], d->Pos[k][i]);
// max_pos[k] = std::max(max_pos[k], d->Pos[k][i]);
}
cout << boost::format("min[%d] = %g, max[%d] = %g") % k % min_pos[k] % k %max_pos[k] << endl;
// cout << boost::format("min[%d] = %g, max[%d] = %g") % k % min_pos[k] % k %max_pos[k] << endl;
}
}
if (d->Vel[0] != 0)
@ -115,6 +114,20 @@ public:
}
void enforceBoxSize(SimuData *d)
{
for (int k = 0; k < 3; k++)
{
for (int64_t i = 0; i < d->NumPart; i++)
{
while (d->Pos[k][i]<0)
d->Pos[k][i] += d->BoxSize;
while (d->Pos[k][i]>=d->BoxSize)
d->Pos[k][i] -= d->BoxSize;
}
}
}
SimuData *loadFile(int id) {
SimuData *d;
int64_t starts[7];
@ -177,6 +190,7 @@ public:
if (load_flags & (NEED_POSITION | NEED_VELOCITY))
rescaleParticles(d, d->Hubble*1e-5, one_kpc/one_Gyr);
enforceBoxSize(d);
applyTransformations(d);
basicPreprocessing(d, preproc);