From 8350f307beaafab0e74d3a7e9ef337bb6f818ae0 Mon Sep 17 00:00:00 2001 From: Rupert Nash Date: Fri, 1 Dec 2023 13:52:26 +0000 Subject: [PATCH] Have HDF5 write raise error if operator(s) requested --- source/adios2/toolkit/interop/hdf5/HDF5Common.cpp | 10 ++++++++++ source/adios2/toolkit/interop/hdf5/HDF5Common.h | 2 ++ source/adios2/toolkit/interop/hdf5/HDF5Common.tcc | 2 ++ 3 files changed, 14 insertions(+) diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp b/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp index e96fc2bdc0..1b8c8c409c 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.cpp @@ -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("Toolkit", "interop::hdf5::HDF5Common", + "CheckVariableOperations", + "ADIOS2 Operators are not supported for HDF5 engine"); + } +} + #define declare_template_instantiation(T) \ template void HDF5Common::Write(core::Variable &, const T *); diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.h b/source/adios2/toolkit/interop/hdf5/HDF5Common.h index 1fe2ffa5ca..2b9b95c6bb 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.h +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.h @@ -245,6 +245,8 @@ class HDF5Common void GetHDF5SpaceSpec(const core::Variable &variable, std::vector &, std::vector &, std::vector &); + void CheckVariableOperations(const core::VariableBase &variable) const; + bool m_WriteMode = false; size_t m_NumAdiosSteps = 0; diff --git a/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc b/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc index 77f946f799..9ef93b3498 100644 --- a/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc +++ b/source/adios2/toolkit/interop/hdf5/HDF5Common.tcc @@ -25,6 +25,7 @@ namespace interop template void HDF5Common::DefineDataset(core::Variable &variable) { + CheckVariableOperations(variable); size_t dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); hid_t h5Type = GetHDF5Type(); @@ -118,6 +119,7 @@ template void HDF5Common::Write(core::Variable &variable, const T *values) { CheckWriteGroup(); + CheckVariableOperations(variable); size_t dimSize = std::max(variable.m_Shape.size(), variable.m_Count.size()); hid_t h5Type = GetHDF5Type();