mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
simplified the solution a little to make use of the HDF5 internal compatibility flags.
This commit is contained in:
parent
c6d9f80f30
commit
77bbe88860
2 changed files with 5 additions and 27 deletions
|
|
@ -74,8 +74,11 @@ if(HDF5_IS_PARALLEL)
|
|||
message(STATUS "Using parallel HDF5")
|
||||
endif()
|
||||
|
||||
if(${HDF5_VERSION} VERSION_LESS "1.12.0")
|
||||
list(APPEND cxxflags -DHDF5_LEGACY)
|
||||
# Version 1.12 of HDF5 deprecates the H5Oget_info_by_idx() interface.
|
||||
# Thus, we give these flags to allow usage of the old interface in newer
|
||||
# versions of HDF5.
|
||||
if(${HDF5_VERSION} VERSION_GREATER_EQUAL "1.12.0")
|
||||
list(APPEND cxxflags -DH5Oget_info_by_idx_vers=1 -DH5O_info_t_vers=1)
|
||||
endif()
|
||||
|
||||
#===============================================================================
|
||||
|
|
|
|||
|
|
@ -251,13 +251,8 @@ int get_num_datasets(hid_t group_id)
|
|||
int ndatasets = 0;
|
||||
for (hsize_t i = 0; i < info.nlinks; ++i) {
|
||||
// Determine type of object (and skip non-group)
|
||||
#ifdef HDF5_LEGACY
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5P_DEFAULT);
|
||||
#else
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5O_INFO_BASIC, H5P_DEFAULT);
|
||||
#endif
|
||||
if (oinfo.type == H5O_TYPE_DATASET) ndatasets += 1;
|
||||
}
|
||||
|
||||
|
|
@ -276,13 +271,8 @@ int get_num_groups(hid_t group_id)
|
|||
int ngroups = 0;
|
||||
for (hsize_t i = 0; i < info.nlinks; ++i) {
|
||||
// Determine type of object (and skip non-group)
|
||||
#ifdef HDF5_LEGACY
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5P_DEFAULT);
|
||||
#else
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5O_INFO_BASIC, H5P_DEFAULT);
|
||||
#endif
|
||||
if (oinfo.type == H5O_TYPE_GROUP) ngroups += 1;
|
||||
}
|
||||
|
||||
|
|
@ -303,13 +293,8 @@ get_datasets(hid_t group_id, char* name[])
|
|||
size_t size;
|
||||
for (hsize_t i = 0; i < info.nlinks; ++i) {
|
||||
// Determine type of object (and skip non-group)
|
||||
#ifdef HDF5_LEGACY
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5P_DEFAULT);
|
||||
#else
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5O_INFO_BASIC, H5P_DEFAULT);
|
||||
#endif
|
||||
if (oinfo.type != H5O_TYPE_DATASET) continue;
|
||||
|
||||
// Get size of name
|
||||
|
|
@ -337,13 +322,8 @@ get_groups(hid_t group_id, char* name[])
|
|||
size_t size;
|
||||
for (hsize_t i = 0; i < info.nlinks; ++i) {
|
||||
// Determine type of object (and skip non-group)
|
||||
#ifdef HDF5_LEGACY
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5P_DEFAULT);
|
||||
#else
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5O_INFO_BASIC, H5P_DEFAULT);
|
||||
#endif
|
||||
if (oinfo.type != H5O_TYPE_GROUP) continue;
|
||||
|
||||
// Get size of name
|
||||
|
|
@ -370,13 +350,8 @@ member_names(hid_t group_id, H5O_type_t type)
|
|||
std::vector<std::string> names;
|
||||
for (hsize_t i = 0; i < info.nlinks; ++i) {
|
||||
// Determine type of object (and skip non-group)
|
||||
#ifdef HDF5_LEGACY
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5P_DEFAULT);
|
||||
#else
|
||||
H5Oget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, i, &oinfo,
|
||||
H5O_INFO_BASIC, H5P_DEFAULT);
|
||||
#endif
|
||||
if (oinfo.type != type) continue;
|
||||
|
||||
// Get size of name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue