SENSEI
A frame work for generic in situ analytics
HDF5DataAdaptor.h
1 #ifndef HDF5_DataAdaptor_h
2 #define HDF5_DataAdaptor_h
3 
4 #include "InTransitDataAdaptor.h"
5 
6 #include <hdf5.h>
7 #include <map>
8 #include <mpi.h>
9 #include <string>
10 #include <svtkSmartPointer.h>
11 
12 #include "HDF5Schema.h"
13 
14 namespace sensei
15 {
16 
17 //
18 // read from HDF and construct SVTK object
19 //
20 class SENSEI_EXPORT HDF5DataAdaptor : public InTransitDataAdaptor
21 {
22 public:
23  static HDF5DataAdaptor *New();
24  senseiTypeMacro(HDF5DataAdaptor, DataAdaptor);
25 
26  // int Open( const std::string& filename); // replaced to OpenStream()
27 
28  void SetStreamName(const std::string &name);
29  void SetStreaming(bool s) { m_Streaming = s; }
30  void SetCollective(bool s) { m_Collective = s; }
31 
32  // int Advance(); now is AdvanceStream()
33 
34  // int Close(); now is CloseStream()
35 
36  /// SENSEI DataAdaptor API
37  int GetNumberOfMeshes(unsigned int &numMeshes) override;
38 
39  int GetMeshMetadata(unsigned int id, MeshMetadataPtr &metadata) override;
40 
41  int GetMesh(const std::string &meshName, bool structure_only,
42  svtkDataObject *&mesh) override;
43 
44  int AddGhostNodesArray(svtkDataObject *mesh,
45  const std::string &meshName) override;
46  int AddGhostCellsArray(svtkDataObject *mesh,
47  const std::string &meshName) override;
48 
49  int AddArray(svtkDataObject *mesh, const std::string &meshName,
50  int association, const std::string &arrayName) override;
51 
52  int ReleaseData() override;
53 
54  // intransit:
55  int OpenStream() override;
56  int CloseStream() override;
57  int AdvanceStream() override;
58  int StreamGood() override;
59  int Initialize(pugi::xml_node &parent) override;
60  int Finalize() override;
61  int GetSenderMeshMetadata(unsigned int id,
62  MeshMetadataPtr &metadata) override;
63 
64 protected:
66  ~HDF5DataAdaptor();
67 
68  // reads the current time step and time values from the stream
69  // stores them in the base class information object
70  int UpdateTimeStep();
71 
72 private:
73  // struct InternalsType;
74  // InternalsType *Internals;
75  senseiHDF5::ReadStream *m_HDF5Reader;
76 
77  bool m_Streaming = false;
78  bool m_Collective = false;
79 
80  std::string m_StreamName;
81 
82  HDF5DataAdaptor(const HDF5DataAdaptor &) = delete;
83  void operator=(const HDF5DataAdaptor &) = delete;
84 };
85 
86 } // namespace sensei
87 
88 #endif
int Initialize(MPI_Comm comm, const std::string &fileName, InTransitDataAdaptor *&dataAdaptor)
Creates a sensei::ConfigurableAnalysis adaptor and sensei::InTransitDataAdaptor based on a SENSEI XML...
Defines the control API for in transit data movement.
Definition: InTransitDataAdaptor.h:27
SENSEI.
Definition: ADIOS2AnalysisAdaptor.h:27
Base class that defines the interface for fetching data from a simulation.
Definition: DataAdaptor.h:25
Definition: HDF5DataAdaptor.h:20