38 lines
1.4 KiB
C++
Executable File
38 lines
1.4 KiB
C++
Executable File
#ifndef HDF5_WRITER_H
|
|
#define HDF5_WRITER_H
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include "blitz/array.h"
|
|
|
|
// Class to handle hdf5 output
|
|
class Hdf5Writer {
|
|
public:
|
|
// the ".h5" is appened to the filename by default
|
|
Hdf5Writer(std::string directory = "./output",
|
|
std::string filename = "output");
|
|
|
|
// writing functions to write data to a HDF dataset specified by the path
|
|
// variable (format: path = "/Group1/Group2/.../GroupN/NameOfDataset")
|
|
// into the file specified by directory and filename
|
|
void write(const blitz::Array<double, 1>& data, std::string path);
|
|
void write(const blitz::Array<double, 2>& data, std::string path);
|
|
void write(const blitz::Array<double, 3>& data, std::string path);
|
|
void write(const blitz::Array<double, 4>& data, std::string path);
|
|
void write(const blitz::Array<long int, 4>& data, std::string path);
|
|
void write(const blitz::TinyVector<double, 3>& data, std::string path);
|
|
void write(const blitz::TinyVector<int, 3>& data, std::string path);
|
|
void write(const std::vector<double>& data, std::string path);
|
|
void write(int data, std::string path);
|
|
void write(long int data, std::string path);
|
|
void write(double data, std::string path);
|
|
void write(const std::string& data, std::string path);
|
|
|
|
private:
|
|
std::string absolute_filename_;
|
|
void createFolder(std::string directory);
|
|
void createFile(std::string absolute_filename);
|
|
};
|
|
|
|
#endif /* HDF5_WRITER_H */
|