From 16143ccd17fbb95c4f4bef7de10ebb110ff2dd5c Mon Sep 17 00:00:00 2001 From: Daniel Garcia-Sanchez Date: Sun, 19 Aug 2018 21:16:44 +0200 Subject: [PATCH] Add functions read_*() Add read_selection() Add read_hyperslab() Add read_none() --- include/deal.II/base/hdf5.h | 104 ++++++++++-- source/base/hdf5.cc | 307 ++++++++++++++++++++++++++++++++++-- 2 files changed, 383 insertions(+), 28 deletions(-) diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index ebdd9b4af2..bce1896103 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -128,8 +128,9 @@ namespace HDF5 }; /** - * Reads an attribute. T can be double, int, unsigned int, bool, - * std::complex or std::string. Note that the encoding of + * Reads an attribute. T can be float, double, long double, + * std::complex, std::complex, std::complex, + * int, unsigned int, bool or std::string. Note that the encoding of * std::string is UTF8 in order to be compatible with python3. * * Datatype conversion takes place at the time of a read or write and is @@ -143,8 +144,9 @@ namespace HDF5 attr(const std::string attr_name) const; /** - * Writes an attribute. T can be double, int, unsigned int, bool, - * std::complex or std::string. Note that the encoding of + * Reads an attribute. T can be float, double, long double, + * std::complex, std::complex, std::complex, + * int, unsigned int, bool or std::string. Note that the encoding of * std::string is UTF8 in order to be compatible with python3. * * Datatype conversion takes place at the time of a read or write and is @@ -188,8 +190,9 @@ namespace HDF5 public: /** - * Reads data of the dataset. T can be double, int, unsigned int, bool - * or std::complex. + * Reads data of the dataset. T can be float, double, long double, + * std::complex, std::complex, std::complex, int + * or unsigned int. * * Datatype conversion takes place at the time of a read or write and is * automatic. See the . + * Reads data of a subset of the dataset. T can be float, double, long + * double, std::complex, std::complex, + * std::complex, int or unsigned int. + * + * The selected elements can be scattered and take any shape in the dataset. + * For examples, in the 4D case, we will be selecting three points and a 4D + * dataspace has rank 4, so the selection will be described in a 3-by-4 + * array. To select the points (1,1,1,1), (14,6,12,18), and (8,22,30,22), + * the point selection array would be as follows: + * + * 0 0 0 0 + * + * 13 5 11 17 + * + * 7 21 29 21 + * + * Parallel + * HDF5 supports collective I/O on point selections. + * + * Datatype conversion takes place at the time of a read or write and is + * automatic. See the Data + * Transfer: Datatype Conversion and Selection section in the HDF5 + * User's Guide. + */ + template + std::vector + read_selection(const std::vector coordinates); + + /** + * Reads a hyperslab from the dataset. The parameters are summarized + * below: + * - Offset: The starting location for the hyperslab. + * - Count: The number of elements to select along each dimension. + * + * Stride and block are set to NULL. + * + * See the Dataspaces + * and Data Transfer section in the HDF5 User's Guide. See as well the + * H5Sselect_hyperslab + * definition. + * + * Datatype conversion takes place at the time of a read or read and is + * automatic. See the Data + * Transfer: Datatype Conversion and Selection section in the HDF5 + * User's Guide. + */ + template