Difficulty loading compound dataset values

Hi, there. I am using HDF5 to store a variety of datasets, including a compound type dataset. For unit testing, I need to read a compound dataset, and while I can successfully open the dataset, it is not reading the desired double type value (instead, I get -9.2559631349317831e+61). Below is the function I have created to perform the read, following the example found here:

My function:

static void readCompoundValue(char* filename, char* datasetname, char* paramname, double& value)
H5File* file = new H5File(filename, H5F_ACC_RDONLY);
DataSet* dataset = new DataSet(file->openDataSet(datasetname));
CompType mtype(sizeof(double));
mtype.insertMember(paramname, 0, PredType::NATIVE_DOUBLE);
double savedValue[1];
dataset->read(savedValue, mtype);
value = *savedValue;

Can anyone spot the issue? Thanks in advance.

Hi Patrick,
while I can’t help you directly with your question because I am not familiar with the official C++ api. However if you are starting a new project I suggest you to give a try to H5CPP, it was introduced last year in Chicago C++ meeting group as well as on this webinar. This implementation embraces modern C++ patterns and comes with an LLVM based compile time reflection making all compund datatype related operations as simple as can be.
If any interest: you find examples on this page and download the packages from here.
best: steven

Hi Patrick,

Have you been able to figure out the problem yet?

Hi, bmribler. Thanks for reaching out. I had to move on and so put the issue on the backburner. I am hopeful that by using the H5Cpp project that was pointed out to me, I will indeed be able to solve the issue when I get some time to try it out.

Take care,

  • Patrick