Hi,

you probably want a different datatype in the file than in memory, i.e. in memory you want a datatype that describes the entire class, but for the file type one that only refers to the components written.

       Werner

On 22.07.2016 00:22, Aman Verma wrote:

I want to write, in a single line, the elements: ObjectArray[i].Element (0<=i<n) without having to copy the elements into a separate array altogether.

Using CompType and insertMember, I am writing just a subset (including Element) of an array of a compound datatype ObjectArray (a class/object in my case).

H5::CompTypemtype(sizeof(Class));

mtype.insertMember("MD", HOFFSET(Class, dMD), datatype);

H5::DataSetdataset = solution.createDataSet( "/Well", mtype, dataspace, ds_creatplist );

dataset.write( ObjectArray, mtype );

This works fine. However, not unexpectedly, since I am defining the CompType with the size of the whole class (Class), while writing out only a subset (Element), my .h5 file is bigger (sizeof(Class)) than it should be (sizeof(Element)). I am already using compression. Is there a way to ‘delete’ this unused space? Or is there a better way to do what I’m trying to achieve? Is using hyperslab the right answer?

Thanks



_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

--
___________________________________________________________________________
Dr. Werner Benger                Visualization Research
Center for Computation & Technology at Louisiana State University (CCT/LSU)
2019  Digital Media Center, Baton Rouge, Louisiana 70803
Tel.: +1 225 578 4809                        Fax.: +1 225 578-5362

_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to