23 #include "openPMD/config.hpp" 24 #if openPMD_HAVE_ADIOS2 31 #include <type_traits> 33 #include "openPMD/Datatype.hpp" 34 #include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp" 77 char *destroy =
nullptr;
101 std::vector<char> m_rawBuffer;
102 std::map<std::string, AttributeLocation> m_offsets;
124 void preloadAttributes(adios2::IO &IO, adios2::Engine &engine);
136 template <
typename T>
139 Datatype attributeType(std::string
const &name)
const;
142 template <
typename T>
146 auto it = m_offsets.find(name);
147 if (it == m_offsets.end())
149 throw std::runtime_error(
150 "[ADIOS2] Requested attribute not found: " + name);
153 Datatype determinedDatatype = determineDatatype<T>();
154 if (location.dt != determinedDatatype)
156 std::stringstream errorMsg;
157 errorMsg <<
"[ADIOS2] Wrong datatype for attribute: " << name
158 <<
"(location.dt=" << location.dt
159 <<
", T=" << determineDatatype<T>() <<
")";
160 throw std::runtime_error(errorMsg.str());
163 res.shape = location.shape;
164 res.data =
reinterpret_cast<T const *
>(&m_rawBuffer[location.offset]);
170 #endif // openPMD_HAVE_ADIOS2
Pointer to an attribute's data along with its shape.
Definition: ADIOS2PreloadAttributes.hpp:46
Datatype
Concrete datatype of an object available at runtime.
Definition: Datatype.hpp:45
Definition: Container.cpp:51
Public definitions of openPMD-api.
Class that is responsible for scheduling and buffering openPMD attribute loads from ADIOS2...
Definition: ADIOS2PreloadAttributes.hpp:64
Internally used struct to store meta information on a buffered attribute.
Definition: ADIOS2PreloadAttributes.hpp:72
AttributeWithShape< T > getAttribute(std::string const &name) const
Get an attribute that has been buffered previously.
Definition: ADIOS2PreloadAttributes.hpp:144