From 5dd0956650b7b034823ef69b4a76b11157be9a98 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Fri, 14 Sep 2018 16:14:29 -0500 Subject: [PATCH 1/2] Resolved issue #1072, which came about due to changes made in #1068 that caused old h5 files to no longer work due to missing 'redundant' attribute --- src/reaction.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/reaction.cpp b/src/reaction.cpp index 3539fed1ae..671440a9f9 100644 --- a/src/reaction.cpp +++ b/src/reaction.cpp @@ -17,8 +17,16 @@ Reaction::Reaction(hid_t group, const std::vector& temperatures) int tmp; read_attribute(group, "center_of_mass", tmp); scatter_in_cm_ = (tmp == 1); - read_attribute(group, "redundant", tmp); - redundant_ = (tmp == 1); + + // Checks if redudant attribute exists before loading + // (for compatibiltiy with legacy .h5 libraries) + htri_t exists = H5Aexists(group, "redundant"); + if( exists ) { + read_attribute(group, "redundant", tmp); + redundant_ = (tmp == 1); + } else { + redundant_ = false; + } // Read cross section and threshold_idx data for (auto t : temperatures) { From 00154b1e6b5122a55c46b5a001a83e8a648f2068 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Fri, 14 Sep 2018 16:28:56 -0500 Subject: [PATCH 2/2] Uses existing interface function rather than calling HDF5 library directly --- src/reaction.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/reaction.cpp b/src/reaction.cpp index 671440a9f9..94dc7f4377 100644 --- a/src/reaction.cpp +++ b/src/reaction.cpp @@ -20,8 +20,7 @@ Reaction::Reaction(hid_t group, const std::vector& temperatures) // Checks if redudant attribute exists before loading // (for compatibiltiy with legacy .h5 libraries) - htri_t exists = H5Aexists(group, "redundant"); - if( exists ) { + if (attribute_exists(group, "redundant")) { read_attribute(group, "redundant", tmp); redundant_ = (tmp == 1); } else {