Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 21, 2023
1 parent f61263b commit 3d1190b
Showing 1 changed file with 32 additions and 13 deletions.
45 changes: 32 additions & 13 deletions src/IO/HDF5/HDF5IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2216,21 +2216,37 @@ void HDF5IOHandlerImpl::readAttribute(
}
else if (H5Tequal(attr_type, m_H5T_LONG_DOUBLE_80_BE))
{
// worst case, sizeof(long double) is only 8, so allocate enough memory to fit 16 bytes per member
std::vector<long double> vld80be(dims[0]*2, 0);
// worst case, sizeof(long double) is only 8, so allocate enough
// memory to fit 16 bytes per member
std::vector<long double> vld80be(dims[0] * 2, 0);
status = H5Aread(attr_id, attr_type, vld80be.data());
H5Tconvert(attr_type, H5T_NATIVE_LDOUBLE, dims[0],
vld80be.data(), nullptr, H5P_DEFAULT);
std::cout << attr_name << " size " << dims[0] << ", " << vld80be[0] << " " << vld80be[1] << " " << vld80be[2] << std::endl;
H5Tconvert(
attr_type,
H5T_NATIVE_LDOUBLE,
dims[0],
vld80be.data(),
nullptr,
H5P_DEFAULT);
std::cout << attr_name << " size " << dims[0] << ", " << vld80be[0]
<< " " << vld80be[1] << " " << vld80be[2] << std::endl;
a = Attribute(vld80be);
}
else if (H5Tequal(attr_type, m_H5T_LONG_DOUBLE_80_LE))
{
// worst case, sizeof(long double) is only 8, so allocate enough memory to fit 16 bytes per member
std::vector<long double> vld80le(dims[0]*2, 0);
// worst case, sizeof(long double) is only 8, so allocate enough
// memory to fit 16 bytes per member
std::vector<long double> vld80le(dims[0] * 2, 0);
status = H5Aread(attr_id, attr_type, vld80le.data());
H5Tconvert(attr_type, H5T_NATIVE_LDOUBLE, dims[0], vld80le.data(), nullptr, H5P_DEFAULT);
std::cout << attr_name << sizeof(long double) << " size " << dims[0] << ", " << vld80le[0] << " " << vld80le[1] << " " << vld80le[2] << std::endl;
H5Tconvert(
attr_type,
H5T_NATIVE_LDOUBLE,
dims[0],
vld80le.data(),
nullptr,
H5P_DEFAULT);
std::cout << attr_name << sizeof(long double) << " size " << dims[0]
<< ", " << vld80le[0] << " " << vld80le[1] << " "
<< vld80le[2] << std::endl;
a = Attribute(vld80le);
}
else if (H5Tget_class(attr_type) == H5T_STRING)
Expand Down Expand Up @@ -2281,12 +2297,15 @@ void HDF5IOHandlerImpl::readAttribute(

std::cout << "order " << std::to_string(order) << std::endl
<< "prec " << std::to_string(prec) << std::endl
<< "ebias " << std::to_string(ebias) << std::endl
<< "fields " << std::to_string(spos) << " " << std::to_string(epos) << " " << std::to_string(esize) << " " << std::to_string(mpos) << " " << std::to_string(msize)
<< "norm " << std::to_string(norm) << std::endl
<< "ebias " << std::to_string(ebias) << std::endl
<< "fields " << std::to_string(spos) << " "
<< std::to_string(epos) << " " << std::to_string(esize)
<< " " << std::to_string(mpos) << " "
<< std::to_string(msize) << "norm "
<< std::to_string(norm) << std::endl
<< "cset " << std::to_string(cset) << std::endl
<< "sign " << std::to_string(sign) << std::endl
<< std::endl;
<< std::endl;

throw error::ReadError(
error::AffectedObject::Attribute,
Expand Down

0 comments on commit 3d1190b

Please sign in to comment.