13 #ifndef included_HDFDatabase_h
14 #define included_HDFDatabase_h
17 #include "Utilities.h"
53 const std::string& file_name,
54 const MPI_Comm comm=MPI_COMM_NULL)
override;
69 const std::string& file_name,
70 const std::string& type,
71 const MPI_Comm comm=MPI_COMM_NULL)
override;
101 const std::string& key,
102 const int*
const data,
104 const bool distributed=
false);
125 const std::string& key,
126 const double*
const data,
128 const bool distributed=
false);
149 const std::string& key,
150 const std::vector<double>& data,
152 const bool distributed=
false);
172 const std::string& key,
175 const bool distributed=
false);
207 const std::string& key,
210 const bool distributed=
false);
231 const std::string& key,
234 const std::vector<int>& idx,
235 const bool distributed=
false);
261 const std::string& key,
267 const bool distributed=
false);
282 const std::string& key);
295 const std::string& key);
bool d_is_file
True if the HDF5 database is mounted to a file.
static const int KEY_DOUBLE_ARRAY
The key representing a double array.
virtual ~HDFDatabase()
Destructor.
bool isInteger(const std::string &key)
Returns true if the specified key represents an integer entry. If the key does not exist or if the st...
bool isDouble(const std::string &key)
Returns true if the specified key represents a double entry. If the key does not exist or if the stri...
int d_rank
MPI process rank.
virtual void getIntegerArray(const std::string &key, int *data, int nelements, const bool distributed=false)
Reads an array of integers associated with the supplied key from the currently open HDF5 database fil...
virtual bool create(const std::string &file_name, const MPI_Comm comm=MPI_COMM_NULL) override
Creates a new HDF5 database file with the supplied name.
int readAttribute(hid_t dataset_id)
Read an attribute from the specified dataset.
virtual bool open(const std::string &file_name, const std::string &type, const MPI_Comm comm=MPI_COMM_NULL) override
Opens an existing HDF5 database file with the supplied name.
virtual void getDoubleArray(const std::string &key, double *data, int nelements, const bool distributed=false)
Reads an array of doubles associated with the supplied key from the currently open HDF5 database file...
hid_t d_group_id
ID of the group attached to the database.
HDFDatabase()
Default constructor.
static const int KEY_INT_ARRAY
The key representing an integer array.
virtual int getDoubleArraySize(const std::string &key)
Count the number of elements in an array of doubles associated with the supplied key from the current...
virtual void putDoubleArray(const std::string &key, const double *const data, int nelements, const bool distributed=false)
Writes an array of doubles associated with the supplied key to the currently open HDF5 database file.
virtual void putIntegerArray(const std::string &key, const int *const data, int nelements, const bool distributed=false)
Writes an array of integers associated with the supplied key to the currently open HDF5 database file...
virtual void writeAttribute(int type_key, hid_t dataset_id)
Write an attribute to the specified dataset.
virtual bool close()
Closes the currently open HDF5 database file.
hid_t d_file_id
ID of file attached to database or -1 if not mounted to a file.
virtual void putDoubleVector(const std::string &key, const std::vector< double > &data, int nelements, const bool distributed=false)
Writes a vector of doubles associated with the supplied key to the currently open HDF5 database file.