Fixed HDF5 support in cmake. Fixed fortran.
This commit is contained in:
parent
537a68b668
commit
d720854361
8 changed files with 63 additions and 106 deletions
|
@ -76,7 +76,6 @@ if(YORICK_SUPPORT)
|
|||
include_directories(${NETCDF_INCLUDE_PATH} ${NETCDFCPP_INCLUDE_PATH})
|
||||
endif(YORICK_SUPPORT)
|
||||
|
||||
message(STATUS "HDF5 ? ${HDF5_FOUND}")
|
||||
if (HDF5_FOUND)
|
||||
set(CosmoTool_LIBS ${CosmoTool_LIBS} ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${ZLIB})
|
||||
include_directories(${HDF5_INCLUDE_DIRS})
|
||||
|
|
|
@ -136,8 +136,9 @@ void UnformattedRead::endCheckpoint(bool autodrop)
|
|||
{
|
||||
if (checkPointRef != checkPointAccum)
|
||||
{
|
||||
if (!autodrop || checkPointAccum > checkPointRef)
|
||||
if (!autodrop || checkPointAccum > checkPointRef) {
|
||||
throw InvalidUnformattedAccess();
|
||||
}
|
||||
f->seekg(checkPointRef-checkPointAccum, ios::cur);
|
||||
}
|
||||
|
||||
|
@ -145,10 +146,11 @@ void UnformattedRead::endCheckpoint(bool autodrop)
|
|||
|
||||
checkPointRef = (cSize == Check_32bits) ? 4 : 8;
|
||||
checkPointAccum = 0;
|
||||
checkPointRef = (cSize == Check_32bits) ? readInt32() : readInt64();
|
||||
checkPointRef = (cSize == Check_32bits) ? readUint32() : readInt64();
|
||||
|
||||
if (oldCheckPoint != checkPointRef)
|
||||
if (oldCheckPoint != checkPointRef) {
|
||||
throw InvalidUnformattedAccess();
|
||||
}
|
||||
|
||||
checkPointAccum = checkPointRef = 0;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,9 @@ namespace CosmoTool
|
|||
{
|
||||
class InvalidUnformattedAccess : public Exception
|
||||
{
|
||||
public:
|
||||
InvalidUnformattedAccess()
|
||||
: Exception("Invalid unformatted fortran file format") {}
|
||||
};
|
||||
|
||||
class FortranTypes
|
||||
|
|
|
@ -146,14 +146,14 @@ SimuData *CosmoTool::loadGadgetMulti(const char *fname, int id,
|
|||
if (GadgetFormat == 2) {
|
||||
int64_t startBlock = 0;
|
||||
char block[5];
|
||||
int32_t blocksize;
|
||||
uint32_t blocksize;
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
f->beginCheckpoint();
|
||||
f->readOrderedBuffer(block, 4);
|
||||
block[4] = 0;
|
||||
blocksize = f->readInt32();
|
||||
blocksize = f->readUint32();
|
||||
f->endCheckpoint();
|
||||
blockTable[block].position = f->position();
|
||||
blockTable[block].size = blocksize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue