mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Optional RW mode for Hdf5Reader
This commit is contained in:
parent
d77bc88170
commit
41032fef44
@ -61,9 +61,9 @@ Group & Hdf5Writer::getGroup(void)
|
||||
}
|
||||
|
||||
// Reader implementation ///////////////////////////////////////////////////////
|
||||
Hdf5Reader::Hdf5Reader(const std::string &fileName)
|
||||
Hdf5Reader::Hdf5Reader(const std::string &fileName, const bool readOnly)
|
||||
: fileName_(fileName)
|
||||
, file_(fileName.c_str(), H5F_ACC_RDWR)
|
||||
, file_(fileName.c_str(), readOnly ? H5F_ACC_RDONLY : H5F_ACC_RDWR)
|
||||
{
|
||||
group_ = file_.openGroup("/");
|
||||
readSingleAttribute(dataSetThres_, HDF5_GRID_GUARD "dataset_threshold",
|
||||
|
@ -54,7 +54,7 @@ namespace Grid
|
||||
class Hdf5Reader: public Reader<Hdf5Reader>
|
||||
{
|
||||
public:
|
||||
Hdf5Reader(const std::string &fileName);
|
||||
Hdf5Reader(const std::string &fileName, const bool readOnly = true);
|
||||
virtual ~Hdf5Reader(void) = default;
|
||||
bool push(const std::string &s);
|
||||
void pop(void);
|
||||
|
@ -437,7 +437,7 @@ void A2AMatrixIo<T>::initFile(const MetadataType &d, const unsigned int chunkSiz
|
||||
}
|
||||
|
||||
// create the dataset
|
||||
Hdf5Reader reader(filename_);
|
||||
Hdf5Reader reader(filename_, false);
|
||||
|
||||
push(reader, dataname_);
|
||||
auto &group = reader.getGroup();
|
||||
@ -457,7 +457,7 @@ void A2AMatrixIo<T>::saveBlock(const T *data,
|
||||
const unsigned int blockSizej)
|
||||
{
|
||||
#ifdef HAVE_HDF5
|
||||
Hdf5Reader reader(filename_);
|
||||
Hdf5Reader reader(filename_, false);
|
||||
std::vector<hsize_t> count = {nt_, blockSizei, blockSizej},
|
||||
offset = {0, static_cast<hsize_t>(i),
|
||||
static_cast<hsize_t>(j)},
|
||||
|
Loading…
Reference in New Issue
Block a user