Hi all,
I have a dataset where each element is defined by this struct
struct data
{
unsigned short value;
char buf[500];
};
A compound datatype is defined with one subtype being native unsigned short
and other being opaque ( H5T_OPAQUE of length 500) .
I am able to select a single element and do a H5Dread but i am not able to
read a block of elements . A block read only reads the first element in the
dataset .
the number of elements in the dataset is 12 for the use case i am
testing
data* d1= new data[numOfElements];
for(size_t i=0; i<numOfElements; ++i)
{
offset[0]=i;
dspace = H5Dget_space(dataset);
//status = H5Sselect_all(dspace);
//! Select the dataspace to which the information has to be read
status = H5Sselect_elements(dspace, H5S_SELECT_SET, 1, offset) ;
status = H5Dread(dataset, type, memspace, dspace, H5P_DEFAULT,
&d1[i]);
H5Sclose(dspace);
}
but this doesn't work
//cord is a 1d array with values from 0 to 11.
status = H5Sselect_elements(dspace, H5S_SELECT_SET, 12, coord) ;
status = H5Dread(dataset, type, memspace, dspace, H5P_DEFAULT, &d1[0]);
neither this works
hsize_t start=0;
hsize_t stride=1;
hsize_t count = 12;
hsize_t block=1;
status = H5Sselect_hyperslab(dspace, H5S_SELECT_SET, offset, &stride,
&count,&block );
status = H5Dread(dataset, type, memspace, dspace, H5P_DEFAULT, &d1[0]);
I only get the correct value for d1[0[] - d1[1] to d1[11] are garbage
values .
There is no error returned by H5Dread .
Any suggestions as to how can the entire dataset be read in one read ?
Regards
Ram