Fixes for single file gadget snapshots

This commit is contained in:
Guilhem Lavaux 2011-07-02 07:35:00 -05:00
parent 69ba427705
commit 8cf7ff563e

View file

@ -71,10 +71,12 @@ SimuData *myLoadGadget(const char *fname, int id, int flags)
SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift, SimuData *(*loadFunction)(const char *fname, int id, int flags)) SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift, SimuData *(*loadFunction)(const char *fname, int id, int flags))
{ {
SimuData *d, *outd; SimuData *d, *outd;
bool singleFile = false;
try try
{ {
d = loadFunction(gadgetname, -1, 0); d = loadFunction(gadgetname, -1, 0);
singleFile = true;
} }
catch (const NoSuchFileException& e) catch (const NoSuchFileException& e)
{ {
@ -102,7 +104,7 @@ SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift,
outd->Vel[2] = new float[outd->NumPart]; outd->Vel[2] = new float[outd->NumPart];
delete d; delete d;
int curCpu = 0; int curCpu = singleFile ? -1 : 0;
cout << "loading file 0 " << endl; cout << "loading file 0 " << endl;
try try
{ {
@ -123,6 +125,8 @@ SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift,
outd->Pos[velAxis][d->Id[i]-1] += d->Vel[velAxis][i]/100.; outd->Pos[velAxis][d->Id[i]-1] += d->Vel[velAxis][i]/100.;
delete d; delete d;
if (singleFile)
break;
curCpu++; curCpu++;
cout << "loading file " << curCpu << endl; cout << "loading file " << curCpu << endl;
} }