Skip to content

Commit

Permalink
Have HDF5 write raise error if operator(s) requested (#3951)
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertnash committed Dec 12, 2023
1 parent ab70f16 commit 8776d5d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/adios2/toolkit/interop/hdf5/HDF5Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,16 @@ void HDF5Common::StaticGetAdiosStepString(std::string &stepName, size_t ts)
stepName = "/Step" + std::to_string(ts);
}

void HDF5Common::CheckVariableOperations(const core::VariableBase &variable) const
{
if (!variable.m_Operations.empty())
{
helper::Throw<std::runtime_error>("Toolkit", "interop::hdf5::HDF5Common",
"CheckVariableOperations",
"ADIOS2 Operators are not supported for HDF5 engine");
}
}

#define declare_template_instantiation(T) \
template void HDF5Common::Write(core::Variable<T> &, const T *);

Expand Down
2 changes: 2 additions & 0 deletions source/adios2/toolkit/interop/hdf5/HDF5Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ class HDF5Common
void GetHDF5SpaceSpec(const core::Variable<T> &variable, std::vector<hsize_t> &,
std::vector<hsize_t> &, std::vector<hsize_t> &);

void CheckVariableOperations(const core::VariableBase &variable) const;

bool m_WriteMode = false;

size_t m_NumAdiosSteps = 0;
Expand Down
2 changes: 2 additions & 0 deletions source/adios2/toolkit/interop/hdf5/HDF5Common.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace interop
template <class T>
void HDF5Common::DefineDataset(core::Variable<T> &variable)
{
CheckVariableOperations(variable);
size_t dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size());
hid_t h5Type = GetHDF5Type<T>();

Expand Down Expand Up @@ -118,6 +119,7 @@ template <class T>
void HDF5Common::Write(core::Variable<T> &variable, const T *values)
{
CheckWriteGroup();
CheckVariableOperations(variable);
size_t dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size());
hid_t h5Type = GetHDF5Type<T>();

Expand Down

0 comments on commit 8776d5d

Please sign in to comment.