mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
std::vector serialisation in hdf5 uses a different format if the vector is ragged. When reading back std::vector we need to check which format we're reading (since we don't know a priori) and this involves looking for attributes that may not exist. The c++ API: a) throws; and b) prints voluminous logging. Switched to non-throwing, non-logging, C version of the API after code review.
This commit is contained in:
parent
9b73dacf50
commit
ef0ddd5d04
@ -285,20 +285,8 @@ namespace Grid
|
||||
typename std::enable_if<element<std::vector<U>>::is_number, void>::type
|
||||
Hdf5Reader::readDefault(const std::string &s, std::vector<U> &x)
|
||||
{
|
||||
bool bRagged{ false };
|
||||
H5E_auto2_t h5at;
|
||||
void * f5at_p;
|
||||
::H5::Exception::getAutoPrint(h5at, &f5at_p);
|
||||
::H5::Exception::dontPrint();
|
||||
try {
|
||||
push(s); // This is what might throw
|
||||
try {
|
||||
bRagged = group_.attrExists(HDF5_GRID_GUARD "vector_size");
|
||||
} catch(...) {}
|
||||
pop();
|
||||
} catch(...) {}
|
||||
::H5::Exception::setAutoPrint(h5at, f5at_p);
|
||||
if (bRagged)
|
||||
if (H5Lexists (group_.getId(), s.c_str(), H5P_DEFAULT) > 0
|
||||
&& H5Aexists_by_name(group_.getId(), s.c_str(), HDF5_GRID_GUARD "vector_size", H5P_DEFAULT ) > 0)
|
||||
{
|
||||
readRagged(s, x);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user