Make gadget use fully buffered I/O

This commit is contained in:
Guilhem Lavaux 2017-05-13 15:25:38 +02:00
parent 0451d8e650
commit 835ba96fa2

View File

@ -248,7 +248,7 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
try try
{ {
ENSURE("POS "); ENSURE("POS ");
f->beginCheckpoint(); f->beginCheckpoint(true); // Use more memory but faster I/O
if (f->getBlockSize() != NumPart*float_size*3) { if (f->getBlockSize() != NumPart*float_size*3) {
// Check that single would work // Check that single would work
if (f->getBlockSize() == NumPart*sizeof(float)*3) { if (f->getBlockSize() == NumPart*sizeof(float)*3) {
@ -299,7 +299,7 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
try try
{ {
ENSURE("VEL "); ENSURE("VEL ");
f->beginCheckpoint(); f->beginCheckpoint(true);
for(int k = 0, p = 0; k < 6; k++) { for(int k = 0, p = 0; k < 6; k++) {
for(int n = 0; n < h.npart[k]; n++) { for(int n = 0; n < h.npart[k]; n++) {
// THIS IS GADGET 1 // THIS IS GADGET 1
@ -343,7 +343,7 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
throw InvalidUnformattedAccess(); throw InvalidUnformattedAccess();
} }
f->beginCheckpoint(); f->beginCheckpoint(true);
data->Id = new int64_t[data->NumPart]; data->Id = new int64_t[data->NumPart];
if (data->Id == 0) if (data->Id == 0)
{ {