1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2024-11-10 08:55:37 +00:00

Hdf5File: random generator state I/O fix

This commit is contained in:
Antonin Portelli 2015-11-18 19:46:08 +00:00
parent abd8bfc91c
commit 4f2e87cf4f

View File

@ -124,8 +124,8 @@ void Hdf5File::save(const RandGenState &state, const string &name)
group = h5File_->createGroup(name.c_str() + nameOffset(name));
attr = group.createAttribute("type", PredType::NATIVE_SHORT, attrSpace);
attr.write(PredType::NATIVE_SHORT, &rgStateType);
dataset = group.createDataSet("data", PredType::NATIVE_DOUBLE, dataSpace);
dataset.write(state.data(), PredType::NATIVE_DOUBLE);
dataset = group.createDataSet("data", PredType::NATIVE_INT, dataSpace);
dataset.write(state.data(), PredType::NATIVE_INT);
}
// read first name ////////////////////////////////////////////////////////////
@ -262,7 +262,7 @@ void Hdf5File::load(RandGenState &state, const DataSet &d)
dataspace.getSimpleExtentDims(dim);
if (dim[0] != RLXG_STATE_SIZE)
{
// error here
LATAN_ERROR(Io, "random generator state has a wrong length");
}
d.read(state.data(), PredType::NATIVE_INT);
}