Hi Sahar,

Please try using PredType::NATIVE_FLOAT instead of the C type
H5T_NATIVE_FLOAT in the following statement:
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

Thanks,
Binh-Minh

-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of sghanavati
Sent: Friday, March 11, 2011 5:45 PM
To: [email protected]
Subject: [Hdf-forum] error reading hdf5 in C++

I'm trying to read in from an hdf5 generated with HDF5 Version: 1.8.4 on
ubuntu x86_64-pc-linux-gnu system in C++.
     
     H5::H5File h5file = H5::H5File();
     h5file.openFile(dbfile, H5F_ACC_RDWR );
     H5::Group group = h5file.openGroup("/vessel_graph/vertex_properties");
     H5::DataSet dataset_centre = group.openDataSet( "centre");
     H5::DataSpace dataspace = dataset_centre.getSpace();
     int rank = dataspace.getSimpleExtentNdims();
     hsize_t dims_out[2];
     int ndims = dataspace.getSimpleExtentDims( dims_out, NULL);

     // Define the memory dataspace.
     H5::DataSpace memspace( rank, dims_out );
     float centres[(unsigned long)(dims_out[0])][(unsigned
long)(dims_out[1])];
     dataset_centre.read(centres,H5T_NATIVE_FLOAT,memspace, dataspace);

     dataset_centre.close();
     group.close();
     h5file.close();

The code is reading the centers correctly into the float centres however ad
the line "dataset_centre.read()" it's throwing this error:
     HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 139812794677152:
       #000: ../../../src/H5T.c line 1707 in H5Tclose(): immutable datatype
         major: Invalid arguments to routine
         minor: Bad value
     DataType::~DataType - H5Tclose failed

It seems to be a warning since the code continues to execute and read
correctly. But I don't understand where this error is coming from or how to
fix it. Any idea?
Thank you in advance,
Sahar 

--
View this message in context:
http://hdf-forum.184993.n3.nabble.com/error-reading-hdf5-in-C-tp2667201p2667
201.html
Sent from the hdf-forum mailing list archive at Nabble.com.

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org


-- 
Internal Virus Database is out-of-date.
Checked by AVG. 
Version: 7.5.549 / Virus Database: 270.9.0/1778 - Release Date: 11/9/2008
2:14 PM



_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to