Fix reading of vector attributes with only one contained value#1085
Fix reading of vector attributes with only one contained value#1085ax3l merged 9 commits intoopenPMD:devfrom
Conversation
1) single values to 1-value vectors 2) vectors to arrays 3) arrays to vectors
1) Simplify types in DoConvert, remove unnecessary template parameter 2) Replace a long if-then-else chain by variantSrc::visit
Make more widely compile-able.
|
Thanks, good idea!
👍 CI: note that we see a double free in one of the tests currently. |
This avoids some warnings
They don't like it
7b7dde1 to
9f2bc40
Compare
It looks like |
Done that now, but I'm leaving this one in to stay on the safe side and always read |
ax3l
left a comment
There was a problem hiding this comment.
I think that's a good approach and the PR looks great, thanks a lot!
I'll just slightly modify the ICC guard and then it can go in.
As defined in CMake for compiler identification.
|
@franzpoeschel given the original issue that @PrometheusPi saw: what backend and attribute exactly was that? |
|
@ax3l This is triggered by 0.6.0-dev PIConGPU data created with openPMD-api using the adios2 backend. The error appeared when using the latest openPMD-viewer (see also discussion on SLACK): Most likely caused by reading |
|
Clarified offline:
|
…MD#1085) * Failing test * Conversions in Attribute.hpp 1) single values to 1-value vectors 2) vectors to arrays 3) arrays to vectors * Some cleanup in Attribute.hpp 1) Simplify types in DoConvert, remove unnecessary template parameter 2) Replace a long if-then-else chain by variantSrc::visit * CoreTest: Fix std::array constructors Make more widely compile-able. * Explicit casting in some places This avoids some warnings * Intel compilers: Don't use variantSrc::visit They don't like it * Remove scattered checks for vector attributes * Generalize icpc guard As defined in CMake for compiler identification. * Doc ICC version (2021.3.0)
* Bug fix: Don't forget closing files (#1083) * Failing test * Bug fix: Don't forget closing files * HDF5: Fix String Vlen Attribute Reads (#1084) We inofficially try to also support HDF5 variable lengths strings in reading, just to increase compatibility. This was never working it seems. * Fix reading of vector attributes with only one contained value (#1085) * Failing test * Conversions in Attribute.hpp 1) single values to 1-value vectors 2) vectors to arrays 3) arrays to vectors * Some cleanup in Attribute.hpp 1) Simplify types in DoConvert, remove unnecessary template parameter 2) Replace a long if-then-else chain by variantSrc::visit * CoreTest: Fix std::array constructors Make more widely compile-able. * Explicit casting in some places This avoids some warnings * Intel compilers: Don't use variantSrc::visit They don't like it * Remove scattered checks for vector attributes * Generalize icpc guard As defined in CMake for compiler identification. * Doc ICC version (2021.3.0) * setAttribute: Reject Empty Strings (#1087) * setAttribute: Reject Empty Strings Some backends, especially HDF5, do not allow us to define zero-sized strings. We thus need to catch this in the frontend and forward the restriction to the user. * Test: setAttribute("key", "") throws * setAttribute Check: C++14 compatible * Don't read iterations if they have already been parsed (#1089) * Release: 0.14.2 Co-authored-by: Franz Pöschel <franz.poeschel@gmail.com>
Noticed by @PrometheusPi
Some of our backends can't distinguish attributes of scalar types and attributes of vector types containing only a single value
We already check for that situation in some places, in others we forget it.
We will keep forgetting it, so this PR modifies the
Attribute::get()function template to do some more automatic conversions:std::vectorandstd::arraytypes (some backends cannot distinguish those either, so I'll take the chance to cover that)First commit has a failing test, I'll push the fix afterwards. I will also take the freedom to do some simplifications in
Attribute.hpp.TODO: