13 #ifndef included_HDFDatabaseMPI_h
14 #define included_HDFDatabaseMPI_h
16 #include "HDFDatabase.h"
51 const std::string& file_name,
52 const MPI_Comm comm=MPI_COMM_WORLD)
override;
68 const std::string& file_name,
69 const std::string& type,
70 const MPI_Comm comm=MPI_COMM_WORLD)
override;
90 const std::string& key,
91 const int*
const data,
93 const bool distributed=
false)
override
95 if ((!distributed) && (
d_rank != 0))
97 putIntegerArray_parallel(key, data, nelements);
118 const std::string& key,
119 const double*
const data,
121 const bool distributed=
false)
override
123 if ((!distributed) && (
d_rank != 0))
125 putDoubleArray_parallel(key, data, nelements);
145 const std::string& key,
148 const bool distributed=
false)
override
152 getIntegerArray_parallel(key, data, nelements);
156 int read_size = (
d_rank == 0) ? nelements : 0;
157 getIntegerArray_parallel(key, data, read_size);
159 CAROM_VERIFY(d_comm != MPI_COMM_NULL);
160 MPI_Bcast(data, nelements, MPI_INT, 0, d_comm);
180 const std::string& key,
183 const bool distributed=
false)
override
187 getDoubleArray_parallel(key, data, nelements);
191 int read_size = (
d_rank == 0) ? nelements : 0;
192 getDoubleArray_parallel(key, data, read_size);
194 CAROM_VERIFY(d_comm != MPI_COMM_NULL);
195 MPI_Bcast(data, nelements, MPI_DOUBLE, 0, d_comm);
216 const std::string& key,
219 const std::vector<int>& idx,
220 const bool distributed=
false)
override
224 getDoubleArray_parallel(key, data, nelements, idx);
228 int read_size = (
d_rank == 0) ? nelements : 0;
229 getDoubleArray_parallel(key, data, read_size, idx);
231 CAROM_VERIFY(d_comm != MPI_COMM_NULL);
232 MPI_Bcast(data, nelements, MPI_DOUBLE, 0, d_comm);
255 const std::string& key,
261 const bool distributed=
false)
override
265 getDoubleArray_parallel(key, data, nelements, offset, block_size, stride);
269 int read_size = (
d_rank == 0) ? nelements : 0;
270 getDoubleArray_parallel(key, data, read_size, offset, block_size, stride);
272 CAROM_VERIFY(d_comm != MPI_COMM_NULL);
273 MPI_Bcast(data, nelements, MPI_DOUBLE, 0, d_comm);
279 hid_t dataset_id)
override;
302 putIntegerArray_parallel(
303 const std::string& key,
304 const int*
const data,
324 putDoubleArray_parallel(
325 const std::string& key,
326 const double*
const data,
344 getIntegerArray_parallel(
345 const std::string& key,
364 getDoubleArray_parallel(
365 const std::string& key,
385 getDoubleArray_parallel(
386 const std::string& key,
389 const std::vector<int>& idx_local);
413 getDoubleArray_parallel(
414 const std::string& key,
417 int block_offset_global,
418 int block_size_global,
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.
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...
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.
HDFDatabaseMPIO()
Default constructor.
virtual ~HDFDatabaseMPIO()
Destructor.