Clear EOF bits before seeking otherwise we get garbage data
This commit is contained in:
parent
450a9a4185
commit
ed602dad09
2
external/external_build.cmake
vendored
2
external/external_build.cmake
vendored
@ -7,7 +7,7 @@ SET(EIGEN_URL "http://bitbucket.org/eigen/eigen/get/3.1.4.tar.gz" CACHE URL "URL
|
||||
SET(GENGETOPT_URL "ftp://ftp.gnu.org/gnu/gengetopt/gengetopt-2.22.5.tar.gz" CACHE STRING "URL to download gengetopt from")
|
||||
SET(HDF5_URL "http://www.hdfgroup.org/ftp/HDF5/releases/hdf5-1.8.15/src/hdf5-1.8.15.tar.gz" CACHE STRING "URL to download HDF5 from")
|
||||
SET(NETCDF_URL "http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.1.3.tar.gz" CACHE STRING "URL to download NetCDF from")
|
||||
SET(BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz/download" CACHE STRING "URL to download Boost from")
|
||||
SET(BOOST_URL "http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz/download" CACHE STRING "URL to download Boost from")
|
||||
SET(GSL_URL "ftp://ftp.gnu.org/gnu/gsl/gsl-1.15.tar.gz" CACHE STRING "URL to download GSL from ")
|
||||
mark_as_advanced(FFTW_URL EIGEN_URL HDF5_URL NETCDF_URL BOOST_URL GSL_URL)
|
||||
|
||||
|
@ -78,6 +78,7 @@ int64_t UnformattedRead::position() const
|
||||
|
||||
void UnformattedRead::seek(int64_t pos)
|
||||
{
|
||||
f->clear();
|
||||
f->seekg(pos, istream::beg);
|
||||
checkPointRef = checkPointAccum = 0;
|
||||
}
|
||||
|
@ -51,8 +51,9 @@ using namespace std;
|
||||
void loadGadgetHeader(UnformattedRead *f, GadgetHeader& h, SimuData *data, int id)
|
||||
{
|
||||
f->beginCheckpoint();
|
||||
for (int i = 0; i < 6; i++)
|
||||
for (int i = 0; i < 6; i++) {
|
||||
h.npart[i] = f->readInt32();
|
||||
}
|
||||
for (int i = 0; i < 6; i++)
|
||||
h.mass[i] = f->readReal64();
|
||||
data->time = h.time = f->readReal64();
|
||||
@ -146,6 +147,7 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
|
||||
f->endCheckpoint();
|
||||
blockTable[block] = f->position();
|
||||
f->skip(blocksize);
|
||||
cout << "Got block '" << block << "', position = " << blockTable[block] << endl;
|
||||
}
|
||||
} catch (EndOfFileException&) {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user