I'm not having much success. Let me be pretty concrete about the steps I'm
taking, and maybe it will be clear where I'm going wrong.

fileId = H5Fcreate(<filename>, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
compoundType = H5Tcreate(HST_COMPOUND, <overall message size>);
H5Tinsert(compoundType, "dummy", 0, HST_NATIVE_INT); // hack so that
H5Dcreate2 doesn't fail
ctSpace = H5Screate_simple(1, dim, NULL);
ctDataSet = H5Dcreate2(fileId, "messageData", compoundType, ctSpace,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
status = H5Dwrite(ctDataSet, compoundType, H5S_ALL, H5S_ALL, H5P_DEFAULT,
&dummyData);
.
.
.
// for each message field
valueDT = H5Tcreate(H5T_COMPOUND, dtSize);
H5Tinsert(valueDT, valueName, 0, dataType);
H5Tinsert(compoundType, valueName, runningOffset, dataType);
runningOffset += dtSize;
status = H5Dwrite(ctDataSet, valueDT, H5S_ALL, ctSpace, H5P_DEFAULT,
&value);
status = H5Tclose(valueDT);
.
.
.
status = H5Fflush(fileId, H5F_SCOPE_LOCAL);
status = H5Tclose(compoundType);
status = H5Sclose(ctSpace);
status = H5Dclose(ctDataSet);
status = H5Fclose(fileId);

I've left out error checking and initializations of a few variables for
clarity.

There are a dozen or so values that I'm attempting to write out, but the
only value that shows up in the output is the dummy that I put in initially.


On Thu, Jul 18, 2013 at 9:26 AM, Josiah Slack <[email protected]> wrote:

> Thanks - that seems pretty straightforward.
>
> -Josiah
>
>
>
> On Thu, Jul 18, 2013 at 8:57 AM, Gerd Heber <[email protected]> wrote:
>
>> Reading or writing a compound type partially can be controlled via the
>> mem_type_id argument. Let's say you have a compound type in the file
>> with components A, B, and C. If you'd like to read only A or write to A,
>> just construct an in memory compound type with just an A component.
>> The library will match components by name between the file type and the
>> memory type.
>>
>> G.
>>
>>
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org

Reply via email to