Files
karl/include/IO/hdf5_reader.h
2024-12-04 17:15:04 +01:00

31 lines
1.2 KiB
C++
Executable File

#ifndef HDF5_READER_H
#define HDF5_READER_H
#include <string>
#include "blitz/array.h"
// class for reading data from a hdf5-file
class Hdf5Reader {
public:
// Constructor: taking a string with the path to the directory and
// a string with the name of the file to be read (without the ".h5", which is appended by default)
Hdf5Reader(std::string directory, std::string filename);
// Constructor: taking a string of the absolute path to the file (string is not changed)
Hdf5Reader(std::string absolute_filename);
// read a 3-dimensional array from the hdf5-file specified at construction of the reader
// object at the hdf5-path "path" and return it as a blitz::Array
blitz::Array<double, 3> readD3Double(std::string path);
// read a 2-dimensional array from the hdf5-file specified at construction of the reader
// object at the hdf5-path "path" and return it as a blitz::Array
blitz::Array<double, 2> readD2Double(std::string path);
// read a 1-dimensional array from the hdf5-file specified at construction of the reader
// object at the hdf5-path "path" and return it as a blitz::Array
blitz::Array<double, 1> readD1Double(std::string path);
private:
std::string absolute_filename_;
};
#endif /* HDF5_READER_H */