From 8cf7ff563eb8959bae481a2f25ae3d50274bd56e Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Sat, 2 Jul 2011 07:35:00 -0500 Subject: [PATCH] Fixes for single file gadget snapshots --- mytools/generateMock.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mytools/generateMock.cpp b/mytools/generateMock.cpp index a03d9fa..37ef208 100644 --- a/mytools/generateMock.cpp +++ b/mytools/generateMock.cpp @@ -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 *d, *outd; + bool singleFile = false; try { d = loadFunction(gadgetname, -1, 0); + singleFile = true; } catch (const NoSuchFileException& e) { @@ -102,7 +104,7 @@ SimuData *doLoadSimulation(const char *gadgetname, int velAxis, bool goRedshift, outd->Vel[2] = new float[outd->NumPart]; delete d; - int curCpu = 0; + int curCpu = singleFile ? -1 : 0; cout << "loading file 0 " << endl; 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.; delete d; + if (singleFile) + break; curCpu++; cout << "loading file " << curCpu << endl; }