Go to the documentation of this file.
9 #ifndef H5EASY_BITS_SCALAR_HPP
10 #define H5EASY_BITS_SCALAR_HPP
12 #include "../H5Easy.hpp"
23 template <
typename T,
typename =
void>
32 if (options.
flush()) {
51 attribute.
write(data);
52 if (options.
flush()) {
71 const std::vector<size_t>& idx,
73 std::vector<size_t> ones(idx.size(), 1);
75 if (file.
exist(path)) {
78 std::vector<size_t> shape = dims;
79 if (dims.size() != idx.size()) {
81 "H5Easy::dump: Dimension of the index and the existing field do not match");
83 for (
size_t i = 0; i < dims.size(); ++i) {
84 shape[i] = std::max(dims[i], idx[i] + 1);
90 if (options.
flush()) {
97 std::vector<size_t> shape = idx;
99 std::vector<size_t> unlim_shape(idx.size(), unlim);
100 std::vector<hsize_t> chunks(idx.size(), 10);
103 if (chunks.size() != idx.size()) {
104 throw error(file, path,
"H5Easy::dump: Incorrect dimension ChunkSize");
107 for (
size_t& i : shape) {
115 if (options.
flush()) {
123 const std::vector<size_t>& idx) {
124 std::vector<size_t> ones(idx.size(), 1);
135 #endif // H5EASY_BITS_SCALAR_HPP
DataSet initScalarDataset(File &file, const std::string &path, const T &data, const DumpOptions &options)
Definition: H5Easy_misc.hpp:114
static const size_t UNLIMITED
Definition: H5DataSpace.hpp:42
void read(T &array) const
Definition: H5Attribute_misc.hpp:58
Definition: H5Easy_scalar.hpp:24
DataSet getDataSet(const std::string &dataset_name, const DataSetAccessProps &accessProps=DataSetAccessProps()) const
get an existing dataset in the current file
Definition: H5Node_traits_misc.hpp:95
std::vector< hsize_t > getChunkSize() const
Get chunk size.
Definition: H5Easy_public.hpp:93
void read(T &array) const
Definition: H5Slice_traits_misc.hpp:158
PropertyList< PropertyType::DATASET_CREATE > DataSetCreateProps
Definition: H5PropertyList.hpp:79
static Attribute dumpAttribute(File &file, const std::string &path, const std::string &key, const T &data, const DumpOptions &options)
Definition: H5Easy_scalar.hpp:45
Options for dumping data.
Definition: H5Easy.hpp:112
void createGroupsToDataSet(File &file, const std::string &path)
Recursively create groups in an open HDF5 file such that a DataSet can be created (see getParentName)...
Definition: H5Easy_misc.hpp:44
static T load_part(const File &file, const std::string &path, const std::vector< size_t > &idx)
Definition: H5Easy_scalar.hpp:121
Selection select(const std::vector< size_t > &offset, const std::vector< size_t > &count, const std::vector< size_t > &stride=std::vector< size_t >()) const
Select a region in the current Slice/Dataset of count points at offset separated by stride....
Definition: H5Slice_traits_misc.hpp:75
void write(const T &buffer)
Definition: H5Slice_traits_misc.hpp:200
std::vector< size_t > getDimensions() const
Get the dimensions of the whole DataSet. This is a shorthand for getSpace().getDimensions()
Definition: H5DataSet.hpp:83
Attribute initScalarAttribute(File &file, const std::string &path, const std::string &key, const T &data, const DumpOptions &options)
Definition: H5Easy_misc.hpp:163
Definition: H5PropertyList.hpp:95
Definition: H5Easy.hpp:51
bool isChunked() const
Check if chunk-size is manually set (or should be computed automatically).
Definition: H5Easy_public.hpp:88
File class.
Definition: H5File.hpp:24
create an HDF5 DataType from a C++ type
Definition: H5_definitions.hpp:36
Class representing an attribute of a dataset or group.
Definition: H5Attribute.hpp:23
Attribute getAttribute(const std::string &attribute_name) const
open an existing attribute with the name attribute_name
Definition: H5Annotate_traits_misc.hpp:69
void resize(const std::vector< size_t > &dims)
Change the size of the dataset.
Definition: H5DataSet_misc.hpp:65
static T loadAttribute(const File &file, const std::string &path, const std::string &key)
Definition: H5Easy_scalar.hpp:58
Class representing the space (dimensions) of a dataset.
Definition: H5DataSpace.hpp:37
Exception error(const File &file, const std::string &path, const std::string &message)
Definition: H5Easy_misc.hpp:52
NAME string(REPLACE ".cpp" "_bin" example_name ${example_filename}) if($
Definition: hops/Third-party/HighFive/src/examples/CMakeLists.txt:6
void flush()
flush
Definition: H5File_misc.hpp:83
bool exist(const std::string &node_name) const
check a dataset or group exists in the current node / group
Definition: H5Node_traits_misc.hpp:218
static T load(const File &file, const std::string &path)
Definition: H5Easy_scalar.hpp:38
bool flush() const
Check to flush.
Definition: H5Easy_public.hpp:73
DataSet createDataSet(const std::string &dataset_name, const DataSpace &space, const DataType &type, const DataSetCreateProps &createProps=DataSetCreateProps(), const DataSetAccessProps &accessProps=DataSetAccessProps())
createDataSet Create a new dataset in the current file of datatype type and of size space
Definition: H5Node_traits_misc.hpp:36
static DataSet dump(File &file, const std::string &path, const T &data, const DumpOptions &options)
Definition: H5Easy_scalar.hpp:26
Class representing a dataset.
Definition: H5DataSet.hpp:27
void write(const T &buffer)
Definition: H5Attribute_misc.hpp:106
static DataSet dump_extend(File &file, const std::string &path, const T &data, const std::vector< size_t > &idx, const DumpOptions &options)
Definition: H5Easy_scalar.hpp:68