File: hdf5Stream.h

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (46 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * hdf5Stream.h
 *
 *  Created on: Nov 2018
 *      Author: Norbert Podhorszki
 */

#ifndef HDF5STREAM_H
#define HDF5STREAM_H

#include "hdf5.h"
#include "stream.h"

#include <map>
#include <string>

struct hdf5VarInfo
{
    hid_t dataspace;
    hid_t dataset;
    hdf5VarInfo(hid_t dataset, hid_t dataspace) : dataspace(dataspace), dataset(dataset){};
};

using H5VarMap = std::map<std::string, hdf5VarInfo>;

class hdf5Stream : public Stream
{
public:
    hid_t h5file;
    H5VarMap varmap;
    hdf5Stream(const std::string &streamName, const adios2::Mode mode, MPI_Comm comm);
    ~hdf5Stream();
    void Write(CommandWrite *cmdW, Config &cfg, const Settings &settings, size_t step);
    adios2::StepStatus Read(CommandRead *cmdR, Config &cfg, const Settings &settings, size_t step);
    void Close();

private:
    MPI_Comm comm;
    hid_t hdf5Type(std::string &type);
    size_t nSteps = 0;
    void defineHDF5Array(const std::shared_ptr<VariableInfo> ov);
    void putHDF5Array(const std::shared_ptr<VariableInfo> ov, size_t step);
    void getHDF5Array(std::shared_ptr<VariableInfo> ov, size_t step);
};

#endif /* HDF5STREAM_H */