Adding an Array to Compound Types

Is there some reason I shouldn't be able to add an array to a compound type?

Here's some test code. To complicate matters it's using the HDF5DotNet interface. And up to this point I have not tested it in pure HDF5. And I had to write a H5Tarray_create wrapper.

            H5DataTypeId HStypeId2 = H5T.create(H5T.CreateClass.COMPOUND, structSz);
            H5DataTypeId aType = H5T.copy(H5T.H5Type.NATIVE_UINT);
            ulong[] dim = { ARRAY_LEN };
            H5DataTypeId arrayType = H5T.array_create(aType, 1, dim);

            // Create the dataset.
            H5PT arrayOnlyTest = new H5PT();
            arrayOnlyTest.create(fileId, "array", arrayType, 100, 0);

             // Insert members.
             // Insert members.
            H5T.insert(HStypeId2, "uint", 0, H5T.H5Type.NATIVE_UINT);
            H5T.insert(HStypeId2, "array1", 4, arrayType);
            H5T.insert(HStypeId2, "array2", 4+ARRAY_LEN*sizeof(uint), arrayType);

            // Create the dataset.
            H5PT arrayTest = new H5PT();
            arrayTest.create(fileId, "arrayStruct", HStypeId2, 100, 0);

When I run this. The arrayType seems to be created ok. And I successfully build a PT dataset. However when I try to insert the arrayType into the Compound type, I get a failure (-1) with no real information.

Am I missing something or is this a known deficiency?

For me, it is a reasonable but less than optimal solution to break out the arrays into different datasets.

Thanks,
Scott

···

________________________________
This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

Hi Scott,

Is there some reason I shouldn’t be able to add an array to a compound type?

  Nope, this is fine at the C API layer.

    Quincey

···

On Sep 30, 2009, at 2:39 PM, Mitchell, Scott - AES wrote:

Here’s some test code. To complicate matters it’s using the HDF5DotNet interface. And up to this point I have not tested it in pure HDF5. And I had to write a H5Tarray_create wrapper.

            H5DataTypeId HStypeId2 = H5T.create(H5T.CreateClass.COMPOUND, structSz);
            H5DataTypeId aType = H5T.copy(H5T.H5Type.NATIVE_UINT);
            ulong[] dim = { ARRAY_LEN };
            H5DataTypeId arrayType = H5T.array_create(aType, 1, dim);

            // Create the dataset.
            H5PT arrayOnlyTest = new H5PT();
            arrayOnlyTest.create(fileId, "array", arrayType, 100, 0);

             // Insert members.
            H5T.insert(HStypeId2, "uint", 0, H5T.H5Type.NATIVE_UINT);
            H5T.insert(HStypeId2, "array1", 4, arrayType);
            H5T.insert(HStypeId2, "array2", 4+ARRAY_LEN*sizeof(uint), arrayType);

            // Create the dataset.
            H5PT arrayTest = new H5PT();
            arrayTest.create(fileId, "arrayStruct", HStypeId2, 100, 0);

When I run this. The arrayType seems to be created ok. And I successfully build a PT dataset. However when I try to insert the arrayType into the Compound type, I get a failure (-1) with no real information.

Am I missing something or is this a known deficiency?

For me, it is a reasonable but less than optimal solution to break out the arrays into different datasets.

Thanks,
Scott

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org