I tried to include my code in the original message, but it doesn't seem to have made it - sorry about that. Here is the struct I'm working with:
typedef struct {
char name[50];
int partType;
int faceType;
int materialNumber;
float thickness;
unsigned int numberOfPolygons;
APolygon *facets; //array of polygons
} ASubGroup;
The last memeber, .facets, is what's causing me problems. When I'm setting up my compound datatype, how do I account for this member, but not write it to the H5 file?
This is how I'm setting up the datatype now:
ASubGroup tempGroup;
hid_t tPartID = H5Tcreate(H5T_COMPOUND, sizeof(tempGroup));
hsize_t arrDim = {50};
hid_t tPartNameID = H5Tarray_create2(H5T_NATIVE_CHAR,1,arrDim);
H5Tinsert(tPartID, "Name", HOFFSET(ASubGroup, name),
tPartNameID);
H5Tinsert(tPartID, "PartType",HOFFSET(ASubGroup, partType),
H5T_NATIVE_INT);
H5Tinsert(tPartID, "FaceType",HOFFSET(ASubGroup, faceType),
H5T_NATIVE_INT);
H5Tinsert(tPartID, "Material",HOFFSET(ASubGroup, materialNumber),
H5T_NATIVE_INT);
H5Tinsert(tPartID, "Thickness",HOFFSET(ASubGroup, thickness),
H5T_NATIVE_FLOAT);
H5Tinsert(tPartID, "NumberOfFacets",HOFFSET(ASubGroup,
numberOfPolygons),
H5T_NATIVE_UINT);
H5Tinsert(tPartID, "reference", HOFFSET(ASubGroup, facets),
H5T_NATIVE_UINT32);
···
On 11/22/2011 09:30 AM, Werner Benger wrote:
Hi,
you just need a different HDF5 type for the memory (the struct including
your pointer) and for the layout on disk (struct with same member names
and compatible data types, but omitting the pointer member). Then HDF5
will just do this conversion and write only those disk-struct members,
reading data from the memory-struct, except your pointer which is not
used for disk output then.
Werner
On Tue, 22 Nov 2011 08:21:34 -0600, jwomble <jwomble@trideum.com> wrote:
Hello,
I have an array of structs that I need to write to a dataset. One of the
members of the struct is a pointer to an array of floats. Right now I am
creating a compound datatype and treating the pointer as an unsigned int,
and this works, but the pointer information is obviously useless data. Is
there a way to write this array, but skip the pointer memeber?
Here is what I am currently doing:
Thanks!
--
View this message in context: http://hdf-forum.184993.n3.nabble.com/How-to-skip-a-member-in-a-struct-tp3527822p3527822.html
Sent from the hdf-forum mailing list archive at Nabble.com.
_______________________________________________
Hdf-forum is for HDF software users discussion.
Hdf-forum@hdfgroup.org
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org