Merge branch 'master' of bitbucket.org:glavaux/cosmotool

This commit is contained in:
Guilhem Lavaux 2017-05-05 09:09:55 +02:00
commit 6c74ca6504

View File

@ -172,9 +172,9 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
ssize_t NumPart = 0, NumPartTotal = 0; ssize_t NumPart = 0, NumPartTotal = 0;
#define ENSURE2(name,out_sz) { \ #define ENSURE2(name,out_sz) { \
int64_t sz; \
if (GadgetFormat == 2) { \ if (GadgetFormat == 2) { \
BlockMap::iterator iter = blockTable.find(name); \ BlockMap::iterator iter = blockTable.find(name); \
int64_t sz; \
if (iter == blockTable.end()) { \ if (iter == blockTable.end()) { \
std::cerr << "GADGET2: Cannot find block named '" << name << "'" << endl; \ std::cerr << "GADGET2: Cannot find block named '" << name << "'" << endl; \
if (data) delete data; \ if (data) delete data; \
@ -184,7 +184,14 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
f->seek(iter->second.position); \ f->seek(iter->second.position); \
sz = iter->second.size; \ sz = iter->second.size; \
out_sz = sz;\ out_sz = sz;\
} else if (GadgetFormat==1) { \
int64_t oldpos = f->position(); \
f->beginCheckpoint(); \
out_sz = f->getBlockSize(); \
f->endCheckpoint(true); \
f->seek(oldpos); \
} \ } \
\
} }
#define ENSURE(name) ENSURE2(name,sz); #define ENSURE(name) ENSURE2(name,sz);