23 #include "openPMD/config.hpp" 25 #include "ADIOS2FilePosition.hpp" 26 #include "openPMD/IO/AbstractIOHandler.hpp" 27 #include "openPMD/IO/AbstractIOHandlerImpl.hpp" 28 #include "openPMD/IO/AbstractIOHandlerImplCommon.hpp" 29 #include "openPMD/IO/IOTask.hpp" 30 #include "openPMD/IO/InvalidatableFile.hpp" 31 #include "openPMD/backend/Writable.hpp" 37 #include <unordered_map> 42 #if openPMD_HAVE_ADIOS2 44 # include "openPMD/IO/ADIOS/ADIOS2Auxiliary.hpp" 54 #if openPMD_HAVE_ADIOS2 56 class ADIOS2IOHandler;
89 static constexpr
bool ADIOS2_DEBUG_MODE =
false;
100 #endif // openPMD_HAVE_MPI 107 std::future< void > flush( )
override;
172 adios2::Mode adios2Accesstype( );
176 adios2::ADIOS m_ADIOS;
199 std::unique_ptr< detail::BufferedActions >
202 std::map< std::string, adios2::Operator > m_operators;
207 filePositionToString( std::shared_ptr< ADIOS2FilePosition > )
override;
209 std::shared_ptr< ADIOS2FilePosition >
210 extendFilePosition( std::shared_ptr< ADIOS2FilePosition >
const & pos,
211 std::string extend )
override;
215 std::unique_ptr< adios2::Operator >
216 getCompressionOperator( std::string
const & compression );
222 std::string nameOfVariable(
Writable * writable );
233 std::string nameOfAttribute(
Writable * writable, std::string attribute );
239 ADIOS2FilePosition::GD groupOrDataset(
Writable * );
243 void dropFileData( InvalidatableFile file );
253 template <
typename T >
254 adios2::Variable< T > verifyDataset( Offset
const & offset,
255 Extent
const & extent, adios2::IO & IO,
256 std::string
const & var );
271 template <
typename T >
272 void operator( )(
BufferedGet & bp, adios2::IO & IO,
273 adios2::Engine & engine,
274 std::string
const & fileName );
276 template <
int T,
typename... Params >
void operator( )( Params &&... );
281 template <
typename T >
282 Datatype operator( )( adios2::IO & IO, std::string name,
283 std::shared_ptr< Attribute::resource > resource );
285 template <
int n,
typename... Params >
286 Datatype operator( )( Params &&... );
291 template <
typename T >
297 template <
int n,
typename... Params >
void operator( )( Params &&... );
308 template <
typename T >
313 template <
int n,
typename... Params >
void operator( )( Params &&... );
324 template <
typename T >
325 void operator( )(
BufferedPut & bp, adios2::IO & IO,
326 adios2::Engine & engine );
328 template <
int n,
typename... Params >
void operator( )( Params &&... );
334 template <
typename T >
335 void operator( )( adios2::IO & IO,
const std::string & name,
336 std::unique_ptr< adios2::Operator > compression,
337 const adios2::Dims & shape = adios2::Dims( ),
338 const adios2::Dims & start = adios2::Dims( ),
339 const adios2::Dims & count = adios2::Dims( ),
340 const bool constantDims = false );
342 template <
int n,
typename... Params >
343 void operator( )( adios2::IO & IO, Params &&... );
359 using Attr = adios2::Attribute< T >;
362 static Attr createAttribute( adios2::IO & IO, std::string name,
366 readAttribute( adios2::IO & IO, std::string name,
367 std::shared_ptr< Attribute::resource > resource );
372 using Attr = adios2::Attribute< T >;
375 static Attr createAttribute( adios2::IO & IO, std::string name,
376 const std::vector< T > & value );
379 readAttribute( adios2::IO & IO, std::string name,
380 std::shared_ptr< Attribute::resource > resource );
383 template <
typename T,
size_t n >
386 using Attr = adios2::Attribute< T >;
389 static Attr createAttribute( adios2::IO & IO, std::string name,
390 const std::array< T, n > & value );
393 readAttribute( adios2::IO & IO, std::string name,
394 std::shared_ptr< Attribute::resource > resource );
399 using rep = detail::bool_representation;
400 using Attr = adios2::Attribute< rep >;
401 using BasicType = rep;
403 static Attr createAttribute( adios2::IO & IO, std::string name,
407 readAttribute( adios2::IO & IO, std::string name,
408 std::shared_ptr< Attribute::resource > resource );
411 static constexpr rep toRep(
bool b )
417 static constexpr
bool fromRep( rep r )
431 static constexpr
bool validType =
true;
436 static constexpr
bool validType =
false;
441 static constexpr
bool validType =
false;
447 static constexpr
bool validType =
false;
458 template <
typename T >
460 T, typename
std::enable_if< DatasetTypes< T >::validType >::type >
471 void readDataset(
BufferedGet &, adios2::IO &, adios2::Engine &,
472 std::string
const & fileName );
475 defineVariable( adios2::IO & IO,
const std::string & name,
476 std::unique_ptr< adios2::Operator > compression,
477 const adios2::Dims & shape,
const adios2::Dims & start,
478 const adios2::Dims & count,
bool constantDims );
480 void writeDataset(
BufferedPut &, adios2::IO &, adios2::Engine & );
483 template <
typename T >
485 T, typename
std::enable_if< !DatasetTypes< T >::validType >::type >
490 static void throwErr( );
492 template <
typename... Params >
void openDataset( Params &&... );
494 template <
typename... Params >
void readDataset( Params &&... );
496 template <
typename... Params >
497 static void defineVariable( Params &&... );
499 template <
typename... Params >
void writeDataset( Params &&... );
552 std::vector< std::unique_ptr< BufferedAction > > m_buffer;
565 using AttributeMap_t = std::map< std::string, adios2::Params >;
571 adios2::Engine & getEngine( );
573 template <
typename BA >
void enqueue( BA && ba );
583 AttributeMap_t
const &
584 availableAttributes();
586 std::vector< std::string >
587 availableAttributesPrefixed( std::string
const & prefix );
593 invalidateAttributesMap();
595 AttributeMap_t
const &
596 availableVariables();
598 std::vector< std::string >
599 availableVariablesPrefixed( std::string
const & prefix );
605 invalidateVariablesMap();
622 bool m_availableAttributesValid =
false;
623 AttributeMap_t m_availableAttributes;
625 bool m_availableVariablesValid =
false;
626 AttributeMap_t m_availableVariables;
631 #endif // openPMD_HAVE_ADIOS2 636 #if openPMD_HAVE_ADIOS2 663 std::future< void > flush( )
override;
Definition: ADIOS2IOHandler.hpp:60
Wrapper around a shared pointer to:
Definition: InvalidatableFile.hpp:45
AccessType
File access mode to use during IO.
Definition: AccessType.hpp:28
Definition: ADIOS2IOHandler.hpp:533
Definition: ADIOS2IOHandler.hpp:279
Definition: ADIOS2IOHandler.hpp:331
Definition: IOTask.hpp:191
Definition: IOTask.hpp:287
Definition: ADIOS2IOHandler.hpp:75
Definition: ADIOS2IOHandler.hpp:546
Definition: ADIOS2IOHandler.hpp:525
This struct's only field indicates whether the template parameter is a valid datatype to use for a da...
Definition: ADIOS2IOHandler.hpp:66
Definition: ADIOS2IOHandler.hpp:517
Datatype
Concrete datatype of an object available at runtime.
Definition: Datatype.hpp:38
Definition: IOTask.hpp:127
Definition: Container.cpp:51
Definition: IOTask.hpp:143
Definition: IOTask.hpp:379
Interface for communicating between logical and physically persistent data.
Definition: AbstractIOHandler.hpp:68
Public definitions of openPMD-api.
Definition: Date.cpp:28
Layer to mirror structure of logical data and persistent data in file.
Definition: Writable.hpp:55
Definition: ADIOS2IOHandler.hpp:634
Definition: IOTask.hpp:332
Definition: ADIOS2IOHandler.hpp:316
std::string backendName() const override
The currently used backend.
Definition: ADIOS2IOHandler.hpp:661
Definition: IOTask.hpp:442
Definition: ADIOS2IOHandler.hpp:289
Definition: Writable.hpp:43
Definition: ADIOS2IOHandler.hpp:300
Definition: ADIOS2IOHandler.hpp:263
Definition: IOTask.hpp:111
Definition: IOTask.hpp:361
Definition: IOTask.hpp:266
Definition: IOTask.hpp:159
Definition: IOTask.hpp:395
Definition: IOTask.hpp:224
Definition: ADIOS2IOHandler.hpp:64
Definition: ADIOS2IOHandler.hpp:510
Definition: IOTask.hpp:414
Definition: IOTask.hpp:248
Definition: IOTask.hpp:175
std::unique_ptr< adios2::Engine > m_engine
std::optional would be more idiomatic, but it's not in the C++11 standard
Definition: ADIOS2IOHandler.hpp:558
Definition: IOTask.hpp:303
Definition: IOTask.hpp:207