-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write fails for custom structs of length >3 #10
Comments
Thank you for a clear bug report! The error you are getting is due to h5pp only having support for structs with 2 or 3 elements "out of the box", called Scalar2 and Scalar3 (template classes defining that define HDF5 types). These are defined here. The list of "ScalarN" types could in principle be expanded to N=4,5..., but as they are initialized at the start of the first call to an h5pp file, I'd like to keep them to a minimum. In any case, the approach you should look at for now is the one in example 04a. There, you have to manually register the struct layout with HDF5 before passing it to h5pp (these are essentially the steps I automated for Scalar2 and Scalar3). |
Thanks for the reply. I see that expanding these manually built types does not scale, however, I think that it should be documented more explicitly that the whole mechanism shown in the example is built upon these internally defined types and does not work with anything else out of the box. Currently, the example says:
which sounds like the shown technique works for any POD struct. Also thanks for pointing me to example 04a, which showed exactly what I needed :) |
Yes that example is confusing, thanks for pointing that out! I'll edit the examples affected. |
Bug Report
Description
I was looking at
example-02d-stdvector-struct.cpp
.Suppose we want to have even more than 3 fields, so I extended the
struct Double3
by a fourth valuea
and called the resulting typeDouble4
:If I now create a data vector and then call
writeThenRead()
with it, the writing of the data fails (error message see bottom)Seems weird that this fails as soon as the
struct
is larger than 4 elements (happens fordouble
orfloat
and even for three when the struct is annotated with__attribute__((aligned(32)))
.)I'm happy to provide further info if needed.
Error Message
Additional Info
1.9.0
libhdf5-dev/bionic 1.10.0-patch1+docs-4
The text was updated successfully, but these errors were encountered: