I suspect you'd be better off abandoning the nested

  std::vector< std::vector< std::vector< double > > > 

construct in favor of either 

(A) A single

  std::valarray< double >

manipulated through a 3D std::slice

or (B) A single 

  boost::multi_array< double, 3 >

Either way should enable you to read from an HDF file into a 3D array of
type double.

Regards.
Greg

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, June 30, 2010 3:11 AM
To: [email protected]
Subject: [Hdf-forum] Read to a vector, read a single element

Hello programmers :-),

I'm still new to this HDF file format, and what I could do is run the
C++
examples given in the tutorial to read a pressures data file given to me
by someone.

My first question is, is it possible to read the values of my H5 file to
a
vector? all I've seen is array works, which is not convenient when
working
generally with different sizes of data files (the files I'm using are 3D
matrices).

So what I would like to do, is having a program in this scheme:

1-Read the file and determine the data type and size
2-create a 3D vector for reading the data (like vector< vector< vector<
double > > > data;)
3-copy the data from the file to this vector.

is this possible with the current library?

My second question, is there a function in the library to read a single
element? I just found a function for reading a whole set into an array
in
the tutorial:

status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
H5P_DEFAULT,
dset_data);

If there's a tutorial that is more detailed than this, or let's say a
manual, I'd be so happy to know about its existence.

Thank you, any efforts are highly appreciated.

Best regards,
Samer


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

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

Reply via email to