Updated for newer ramses

This commit is contained in:
Guilhem Lavaux 2012-06-26 15:40:19 -04:00
parent 134f4413eb
commit 83753a9479
2 changed files with 24 additions and 5 deletions

View File

@ -433,7 +433,7 @@ CosmoTool::SimuData *CosmoTool::loadRamsesSimu(const char *basename, int outputI
CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename, int outputId, bool quiet) CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename, int outputId, bool quiet, bool dp)
{ {
PurePositionData *gd = (PurePositionData *)malloc(sizeof(PurePositionData)); PurePositionData *gd = (PurePositionData *)malloc(sizeof(PurePositionData));
int id = 1; int id = 1;
@ -542,6 +542,25 @@ CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename,
nPar = infile.readInt32(); nPar = infile.readInt32();
infile.endCheckpoint(); infile.endCheckpoint();
infile.beginCheckpoint();
for (int i = 0; i < 4; i++) infile.readInt32();
infile.endCheckpoint();
infile.beginCheckpoint();
infile.readInt32();
infile.endCheckpoint();
infile.beginCheckpoint();
infile.readReal64();
infile.endCheckpoint();
infile.beginCheckpoint();
infile.readReal64();
infile.endCheckpoint();
infile.beginCheckpoint();
infile.readInt32();
infile.endCheckpoint();
FCoordinates *s = new FCoordinates[nPar]; FCoordinates *s = new FCoordinates[nPar];
@ -550,7 +569,7 @@ CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename,
infile.beginCheckpoint(); infile.beginCheckpoint();
for (uint32_t i = 0; i < nPar; i++) for (uint32_t i = 0; i < nPar; i++)
{ {
s[i][k] = infile.readReal32(); s[i][k] = dp ? infile.readReal64() : infile.readReal32();
s[i][k] *= gd->BoxSize; s[i][k] *= gd->BoxSize;
} }
infile.endCheckpoint(); infile.endCheckpoint();
@ -561,7 +580,7 @@ CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename,
infile.beginCheckpoint(); infile.beginCheckpoint();
for (uint32_t i = nPar; i > 0; i--) for (uint32_t i = nPar; i > 0; i--)
{ {
infile.readReal32(); (dp ? infile.readReal64() : infile.readReal32());
} }
infile.endCheckpoint(); infile.endCheckpoint();
} }
@ -570,7 +589,7 @@ CosmoTool::PurePositionData *CosmoTool::loadRamsesPosition(const char *basename,
infile.beginCheckpoint(); infile.beginCheckpoint();
for (uint32_t i = nPar; i > 0; i--) for (uint32_t i = nPar; i > 0; i--)
{ {
float dummyF = infile.readReal32(); float dummyF = dp ? infile.readReal64() : infile.readReal32();
if (dummyF < minMass) minMass = dummyF; if (dummyF < minMass) minMass = dummyF;
} }
infile.endCheckpoint(); infile.endCheckpoint();

View File

@ -7,7 +7,7 @@
namespace CosmoTool { namespace CosmoTool {
GadgetData *loadRamses(const char *name, bool quiet = false); GadgetData *loadRamses(const char *name, bool quiet = false);
PurePositionData *loadRamsesPosition(const char *fname, int id, bool quiet = false); PurePositionData *loadRamsesPosition(const char *fname, int id, bool quiet = false, bool dp = true);
PhaseSpaceData *loadRamsesPhase(const char *fname, int id, bool quiet = false); PhaseSpaceData *loadRamsesPhase(const char *fname, int id, bool quiet = false);
PhaseSpaceDataID *loadRamsesPhase1(const char *fname, int id, int cpuid, bool quiet = false); PhaseSpaceDataID *loadRamsesPhase1(const char *fname, int id, int cpuid, bool quiet = false);