16inline hid_t convert_plist_type(
PropertyType propertyType) {
19 switch (propertyType) {
21 return H5P_OBJECT_CREATE;
23 return H5P_FILE_CREATE;
25 return H5P_FILE_ACCESS;
27 return H5P_DATASET_CREATE;
29 return H5P_DATASET_ACCESS;
31 return H5P_DATASET_XFER;
33 return H5P_GROUP_CREATE;
35 return H5P_GROUP_ACCESS;
37 return H5P_DATATYPE_CREATE;
39 return H5P_DATATYPE_ACCESS;
41 return H5P_STRING_CREATE;
43 return H5P_ATTRIBUTE_CREATE;
45 return H5P_OBJECT_COPY;
47 return H5P_LINK_CREATE;
49 return H5P_LINK_ACCESS;
62template <PropertyType T>
64 if (_hid != H5P_DEFAULT) {
67 _hid = detail::h5p_create(convert_plist_type(T));
70template <PropertyType T>
71template <PropertyInterface P>
73 _initializeIfNeeded();
77template <PropertyType T>
78template <
typename F,
typename... Args>
80 this->_initializeIfNeeded();
81 if (funct(this->_hid, args...) < 0) {
87#if H5_VERSION_GE(1, 10, 1)
88inline FileSpaceStrategy::FileSpaceStrategy(H5F_fspace_strategy_t strategy,
93 , _threshold(threshold) {}
95inline FileSpaceStrategy::FileSpaceStrategy(
const FileCreateProps& fcpl) {
96 detail::h5p_get_file_space_strategy(fcpl.getId(), &_strategy, &_persist, &_threshold);
99inline void FileSpaceStrategy::apply(
const hid_t list)
const {
100 detail::h5p_set_file_space_strategy(list, _strategy, _persist, _threshold);
103inline H5F_fspace_strategy_t FileSpaceStrategy::getStrategy()
const {
107inline hbool_t FileSpaceStrategy::getPersist()
const {
111inline hsize_t FileSpaceStrategy::getThreshold()
const {
115inline FileSpacePageSize::FileSpacePageSize(hsize_t page_size)
116 : _page_size(page_size) {}
118inline void FileSpacePageSize::apply(
const hid_t list)
const {
119 detail::h5p_set_file_space_page_size(list, _page_size);
122inline FileSpacePageSize::FileSpacePageSize(
const FileCreateProps& fcpl) {
123 detail::h5p_get_file_space_page_size(fcpl.getId(), &_page_size);
126inline hsize_t FileSpacePageSize::getPageSize()
const {
130#ifndef H5_HAVE_PARALLEL
131inline PageBufferSize::PageBufferSize(
size_t page_buffer_size,
132 unsigned min_meta_percent,
133 unsigned min_raw_percent)
134 : _page_buffer_size(page_buffer_size)
135 , _min_meta(min_meta_percent)
136 , _min_raw(min_raw_percent) {}
139 detail::h5p_get_page_buffer_size(plist.getId(), &_page_buffer_size, &_min_meta, &_min_raw);
142inline void PageBufferSize::apply(
const hid_t list)
const {
143 detail::h5p_set_page_buffer_size(list, _page_buffer_size, _min_meta, _min_raw);
146inline size_t PageBufferSize::getPageBufferSize()
const {
147 return _page_buffer_size;
150inline unsigned PageBufferSize::getMinMetaPercent()
const {
154inline unsigned PageBufferSize::getMinRawPercent()
const {
160#ifdef H5_HAVE_PARALLEL
166inline void MPIOFileAccess::apply(
const hid_t list)
const {
167 detail::h5p_set_fapl_mpio(list, _comm, _info);
170#if H5_VERSION_GE(1, 10, 0)
171inline void MPIOCollectiveMetadata::apply(
const hid_t plist)
const {
172 auto read = MPIOCollectiveMetadataRead{collective_read_};
173 auto write = MPIOCollectiveMetadataWrite{collective_write_};
179inline MPIOCollectiveMetadata::MPIOCollectiveMetadata(
bool collective)
180 : collective_read_(collective)
181 , collective_write_(collective) {}
184inline MPIOCollectiveMetadata::MPIOCollectiveMetadata(
const FileAccessProps& plist)
185 : collective_read_(MPIOCollectiveMetadataRead(plist).isCollective())
186 , collective_write_(MPIOCollectiveMetadataWrite(plist).isCollective()) {}
188inline bool MPIOCollectiveMetadata::isCollectiveRead()
const {
189 return collective_read_;
192inline bool MPIOCollectiveMetadata::isCollectiveWrite()
const {
193 return collective_write_;
197inline void MPIOCollectiveMetadataRead::apply(
const hid_t plist)
const {
198 detail::h5p_set_all_coll_metadata_ops(plist, collective_);
201inline bool MPIOCollectiveMetadataRead::isCollective()
const {
205inline MPIOCollectiveMetadataRead::MPIOCollectiveMetadataRead(
const FileAccessProps& plist) {
206 detail::h5p_get_all_coll_metadata_ops(plist.getId(), &collective_);
209inline MPIOCollectiveMetadataRead::MPIOCollectiveMetadataRead(
bool collective)
210 : collective_(collective) {}
212inline void MPIOCollectiveMetadataWrite::apply(
const hid_t plist)
const {
213 detail::h5p_set_coll_metadata_write(plist, collective_);
216inline bool MPIOCollectiveMetadataWrite::isCollective()
const {
220inline MPIOCollectiveMetadataWrite::MPIOCollectiveMetadataWrite(
const FileAccessProps& plist) {
221 detail::h5p_get_coll_metadata_write(plist.getId(), &collective_);
224inline MPIOCollectiveMetadataWrite::MPIOCollectiveMetadataWrite(
bool collective)
225 : collective_(collective) {}
235 detail::h5p_get_libver_bounds(fapl.
getId(), &_low, &_high);
239 return std::make_pair(_low, _high);
242inline void FileVersionBounds::apply(
const hid_t list)
const {
243 detail::h5p_set_libver_bounds(list, _low, _high);
250 detail::h5p_get_meta_block_size(fapl.
getId(), &_size);
253inline void MetadataBlockSize::apply(
const hid_t list)
const {
254 detail::h5p_set_meta_block_size(list, _size);
261inline void EstimatedLinkInfo::apply(
const hid_t hid)
const {
262 detail::h5p_set_est_link_info(hid, _entries, _length);
270 detail::h5p_get_est_link_info(gcpl.
getId(), &_entries, &_length);
281inline void Chunking::apply(
const hid_t hid)
const {
282 detail::h5p_set_chunk(hid,
static_cast<int>(_dims.size()), _dims.data());
289 :
Chunking(std::vector<hsize_t>{items}) {}
292 : _dims(max_dims + 1) {
294 detail::h5p_get_chunk(plist.
getId(),
static_cast<int>(_dims.size()), _dims.data());
296 if (n_loaded >=
static_cast<int>(_dims.size())) {
297 *
this =
Chunking(plist, 8 * max_dims);
299 _dims.resize(
static_cast<size_t>(n_loaded));
307template <
typename... Args>
309 :
Chunking(std::vector<hsize_t>{item,
static_cast<hsize_t
>(args)...}) {}
311inline void Deflate::apply(
const hid_t hid)
const {
312 if (detail::h5z_filter_avail(H5Z_FILTER_DEFLATE) == 0) {
316 detail::h5p_set_deflate(hid, _level);
322inline void Szip::apply(
const hid_t hid)
const {
323 if (detail::h5z_filter_avail(H5Z_FILTER_SZIP) == 0) {
327 detail::h5p_set_szip(hid, _options_mask, _pixels_per_block);
330inline Szip::Szip(
unsigned int options_mask,
unsigned int pixels_per_block)
331 : _options_mask(options_mask)
332 , _pixels_per_block(pixels_per_block) {}
335 return _options_mask;
339 return _pixels_per_block;
342inline void Shuffle::apply(
const hid_t hid)
const {
343 if (detail::h5z_filter_avail(H5Z_FILTER_SHUFFLE) == 0) {
347 detail::h5p_set_shuffle(hid);
351 : _alloc_time(alloc_time) {}
354 detail::h5p_get_alloc_time(dcpl.
getId(), &_alloc_time);
357inline void AllocationTime::apply(hid_t dcpl)
const {
358 detail::h5p_set_alloc_time(dcpl, _alloc_time);
366 detail::h5p_get_chunk_cache(dcpl.
getId(), &_numSlots, &_cacheSize, &_w0);
369inline void Caching::apply(
const hid_t hid)
const {
370 detail::h5p_set_chunk_cache(hid, _numSlots, _cacheSize, _w0);
374 : _numSlots(numSlots)
375 , _cacheSize(cacheSize)
398inline void CreateIntermediateGroup::apply(
const hid_t hid)
const {
399 detail::h5p_set_create_intermediate_group(hid, _create ? 1 : 0);
408 _create = bool(detail::h5p_get_create_intermediate_group(hid, &c_bool));
415#ifdef H5_HAVE_PARALLEL
419inline void UseCollectiveIO::apply(
const hid_t hid)
const {
420 detail::h5p_set_dxpl_mpio(hid, _enable ? H5FD_MPIO_COLLECTIVE : H5FD_MPIO_INDEPENDENT);
424 H5FD_mpio_xfer_t collective;
426 detail::h5p_get_dxpl_mpio(dxpl.
getId(), &collective);
428 if (collective != H5FD_MPIO_COLLECTIVE && collective != H5FD_MPIO_INDEPENDENT) {
429 throw std::logic_error(
"H5Pget_dxpl_mpio returned something strange.");
432 _enable = collective == H5FD_MPIO_COLLECTIVE;
440 detail::h5p_get_mpio_no_collective_cause(dxpl.
getId(), &_local_cause, &_global_cause);
444 return _local_cause == 0 && _global_cause == 0;
452 return _global_cause;
456 return {_local_cause, _global_cause};
472inline void LinkCreationOrder::apply(
const hid_t hid)
const {
473 detail::h5p_set_link_creation_order(hid, _flags);
477 detail::h5p_get_link_creation_order(hid, &_flags);
481 : _max_compact(max_compact)
482 , _min_dense(min_dense) {}
485 detail::h5p_get_attr_phase_change(gcpl.
getId(), &_max_compact, &_min_dense);
496inline void AttributePhaseChange::apply(hid_t hid)
const {
497 detail::h5p_set_attr_phase_change(hid, _max_compact, _min_dense);
H5D_alloc_time_t getAllocationTime()
Definition H5PropertyList_misc.hpp:361
AllocationTime(H5D_alloc_time_t alloc_time)
Definition H5PropertyList_misc.hpp:350
unsigned max_compact() const
Definition H5PropertyList_misc.hpp:488
AttributePhaseChange(unsigned max_compact, unsigned min_dense)
Create the property from the threshold values.
Definition H5PropertyList_misc.hpp:480
unsigned min_dense() const
Definition H5PropertyList_misc.hpp:492
size_t getNumSlots() const
Definition H5PropertyList_misc.hpp:378
Caching(const size_t numSlots, const size_t cacheSize, const double w0=static_cast< double >(H5D_CHUNK_CACHE_W0_DEFAULT))
Definition H5PropertyList_misc.hpp:373
size_t getCacheSize() const
Definition H5PropertyList_misc.hpp:382
double getW0() const
Definition H5PropertyList_misc.hpp:386
Definition H5PropertyList.hpp:503
const std::vector< hsize_t > & getDimensions() const noexcept
Definition H5PropertyList_misc.hpp:303
Chunking(const std::vector< hsize_t > &dims)
Definition H5PropertyList_misc.hpp:285
Deflate(unsigned level)
Definition H5PropertyList_misc.hpp:319
unsigned getEntries() const
The estimated number of links in a group.
Definition H5PropertyList_misc.hpp:273
EstimatedLinkInfo(unsigned entries, unsigned length)
Create a property with the request parameters.
Definition H5PropertyList_misc.hpp:265
unsigned getNameLength() const
The estimated length of the names of links.
Definition H5PropertyList_misc.hpp:277
std::pair< H5F_libver_t, H5F_libver_t > getVersion() const
Definition H5PropertyList_misc.hpp:238
FileVersionBounds(H5F_libver_t low, H5F_libver_t high)
Definition H5PropertyList_misc.hpp:230
LinkCreationOrder(unsigned flags)
Create the property.
Definition H5PropertyList.hpp:691
void fromPropertyList(hid_t hid)
Definition H5PropertyList_misc.hpp:476
unsigned getFlags() const
Definition H5PropertyList_misc.hpp:468
MPIOFileAccess(MPI_Comm comm, MPI_Info info)
Definition H5PropertyList_misc.hpp:162
uint32_t getGlobalCause() const
The global cause for a non-collective I/O.
Definition H5PropertyList_misc.hpp:451
bool wasCollective() const
Was the datatransfer collective?
Definition H5PropertyList_misc.hpp:443
std::pair< uint32_t, uint32_t > getCause() const
A pair of the local and global cause for non-collective I/O.
Definition H5PropertyList_misc.hpp:455
MpioNoCollectiveCause(const DataTransferProps &dxpl)
Definition H5PropertyList_misc.hpp:439
uint32_t getLocalCause() const
The local cause for a non-collective I/O.
Definition H5PropertyList_misc.hpp:447
Definition H5Object.hpp:54
hid_t getId() const noexcept
getId
Definition H5Object_misc.hpp:69
PropertyListBase() noexcept
Definition H5PropertyList_misc.hpp:58
HDF5 property Lists.
Definition H5PropertyList.hpp:160
void _initializeIfNeeded()
Definition H5PropertyList_misc.hpp:63
void add(const P &property)
Definition H5PropertyList_misc.hpp:72
void add(const F &funct, const Args &... args)
Definition H5PropertyList_misc.hpp:79
Szip(unsigned options_mask=H5_SZIP_EC_OPTION_MASK, unsigned pixels_per_block=H5_SZIP_MAX_PIXELS_PER_BLOCK)
Definition H5PropertyList_misc.hpp:330
unsigned getPixelsPerBlock() const
Definition H5PropertyList_misc.hpp:338
unsigned getOptionsMask() const
Definition H5PropertyList_misc.hpp:334
bool isCollective() const
Does the property request collective IO?
Definition H5PropertyList_misc.hpp:435
UseCollectiveIO(bool enable=true)
Definition H5PropertyList_misc.hpp:416
PropertyType
Types of property lists.
Definition H5PropertyList.hpp:89
PropertyList< PropertyType::LINK_CREATE > LinkCreateProps
Definition H5PropertyList.hpp:211
PropertyList< PropertyType::FILE_ACCESS > FileAccessProps
Definition H5PropertyList.hpp:200
PropertyList< PropertyType::FILE_CREATE > FileCreateProps
Definition H5PropertyList.hpp:199
Definition H5_definitions.hpp:22
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43