From 6a7db1917afd3de504bb37c5a50016785478064c Mon Sep 17 00:00:00 2001 From: georgmichel Date: Fri, 26 Aug 2016 10:06:24 +0000 Subject: [PATCH] clean up HDF5 interface for v1.8+, hdf5readatt_octave.cc still needs to be done but has to wait for upstream Octave fix --- CMakeLists.txt | 3 --- tools/hdf5_file_reader.cpp | 4 ++-- tools/hdf5_file_writer.cpp | 14 +++++++------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f72ed4..4a2d86d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,9 +112,6 @@ find_package(HDF5 1.8 COMPONENTS C HL REQUIRED) INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIR}) link_directories(${HDF5_LIBRARY_DIRS}) -# hdf5 compat -ADD_DEFINITIONS( -DH5_USE_16_API ) - # boost find_package(Boost 1.46 COMPONENTS thread diff --git a/tools/hdf5_file_reader.cpp b/tools/hdf5_file_reader.cpp index 5e81614..a6e1359 100644 --- a/tools/hdf5_file_reader.cpp +++ b/tools/hdf5_file_reader.cpp @@ -68,7 +68,7 @@ bool HDF5_File_Reader::OpenGroup(hid_t &file, hid_t &group, string groupName) return 0; } - group = H5Gopen(file, groupName.c_str() ); + group = H5Gopen(file, groupName.c_str(), H5P_DEFAULT ); if (group<0) { cerr << "HDF5_File_Reader::OpenGroup: can't open group """ << groupName << """" << endl; @@ -198,7 +198,7 @@ bool HDF5_File_Reader::ReadDataSet(string ds_name, hsize_t &nDim, hsize_t* &dims return false; } - hid_t dataset = H5Dopen(hdf5_file, ds_name.c_str() ); + hid_t dataset = H5Dopen(hdf5_file, ds_name.c_str(), H5P_DEFAULT ); if (dataset<0) { cerr << "HDF5_File_Reader::ReadDataSet: dataset not found" << endl; diff --git a/tools/hdf5_file_writer.cpp b/tools/hdf5_file_writer.cpp index 81c5692..e3a2113 100644 --- a/tools/hdf5_file_writer.cpp +++ b/tools/hdf5_file_writer.cpp @@ -52,7 +52,7 @@ hid_t HDF5_File_Writer::OpenGroup(hid_t hdf5_file, string group) vector results; boost::split(results, group, boost::is_any_of("/")); - hid_t grp=H5Gopen(hdf5_file,"/"); + hid_t grp=H5Gopen(hdf5_file,"/", H5P_DEFAULT); if (grp<0) { cerr << "HDF5_File_Writer::OpenGroup: Error, opening root group " << endl; @@ -66,7 +66,7 @@ hid_t HDF5_File_Writer::OpenGroup(hid_t hdf5_file, string group) { if (H5Lexists(grp, results.at(n).c_str(), H5P_DEFAULT)) { - grp = H5Gopen(grp, results.at(n).c_str()); + grp = H5Gopen(grp, results.at(n).c_str(), H5P_DEFAULT); H5Gclose(old_grp); if (grp<0) { @@ -76,7 +76,7 @@ hid_t HDF5_File_Writer::OpenGroup(hid_t hdf5_file, string group) } else { - grp = H5Gcreate(grp,results.at(n).c_str(),0); + grp = H5Gcreate(grp,results.at(n).c_str(), H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Gclose(old_grp); if (grp<0) { @@ -140,7 +140,7 @@ bool HDF5_File_Writer::WriteRectMesh(unsigned int const* numLines, float const* return false; } - hid_t mesh_grp = H5Gcreate(hdf5_file,"/Mesh",0); + hid_t mesh_grp = H5Gcreate(hdf5_file,"/Mesh", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (mesh_grp<0) { cerr << "HDF5_File_Writer::WriteRectMesh: Error, creating group ""/Mesh"" failed" << endl; @@ -165,7 +165,7 @@ bool HDF5_File_Writer::WriteRectMesh(unsigned int const* numLines, float const* { hsize_t dims[1]={numLines[n]}; hid_t space = H5Screate_simple(1, dims, NULL); - hid_t dataset = H5Dcreate(mesh_grp, names[n].c_str(), H5T_NATIVE_FLOAT, space, H5P_DEFAULT); + hid_t dataset = H5Dcreate(mesh_grp, names[n].c_str(), H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); float* array = new float[numLines[n]]; for (unsigned int i=0; i