23 #include "openPMD/config.hpp" 24 #if openPMD_HAVE_ADIOS2 31 #include <type_traits> 33 #include "openPMD/Datatype.hpp" 44 template<
typename T >
76 char *destroy =
nullptr;
100 std::vector< char > m_rawBuffer;
101 std::map< std::string, AttributeLocation > m_offsets;
124 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( std::is_same< T, signed char >::value )
159 determinedDatatype = Datatype::CHAR;
161 if( location.dt != determinedDatatype )
163 std::stringstream errorMsg;
164 errorMsg <<
"[ADIOS2] Wrong datatype for attribute: " << name
165 <<
"(location.dt=" << location.dt
166 <<
", T=" << determineDatatype< T >() <<
")";
167 throw std::runtime_error( errorMsg.str() );
170 res.shape = location.shape;
172 reinterpret_cast< T const *
>( &m_rawBuffer[ location.offset ] );
178 #endif // openPMD_HAVE_ADIOS2
Pointer to an attribute's data along with its shape.
Definition: ADIOS2PreloadAttributes.hpp:45
Datatype
Concrete datatype of an object available at runtime.
Definition: Datatype.hpp:45
Definition: Container.cpp:51
Public definitions of openPMD-api.
Definition: Date.cpp:29
Class that is responsible for scheduling and buffering openPMD attribute loads from ADIOS2...
Definition: ADIOS2PreloadAttributes.hpp:63
Internally used struct to store meta information on a buffered attribute.
Definition: ADIOS2PreloadAttributes.hpp:71
AttributeWithShape< T > getAttribute(std::string const &name) const
Get an attribute that has been buffered previously.
Definition: ADIOS2PreloadAttributes.hpp:144