HighFive 2.10.1
HighFive - Header-only C++ HDF5 interface
Loading...
Searching...
No Matches
H5PropertyList.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c), 2017-2018, Adrien Devresse <adrien.devresse@epfl.ch>
3 * Juan Hernando <juan.hernando@epfl.ch>
4 * Distributed under the Boost Software License, Version 1.0.
5 * (See accompanying file LICENSE_1_0.txt or copy at
6 * http://www.boost.org/LICENSE_1_0.txt)
7 *
8 */
9#pragma once
10
11#include <vector>
12
13#include <H5Ppublic.h>
14
15// Required by MPIOFileAccess
16#ifdef H5_HAVE_PARALLEL
17#include <H5FDmpi.h>
18#endif
19
20#include "H5Exception.hpp"
21#include "H5Object.hpp"
22
23namespace HighFive {
24
85
106
107namespace details {
108template <typename T, typename U>
109T get_plist(const U& obj, hid_t (*f)(hid_t)) {
110 auto hid = f(obj.getId());
111 if (hid < 0) {
112 HDF5ErrMapper::ToException<PropertyException>("Unable to get property list");
113 }
114 T t{};
115 t._hid = hid;
116 return t;
117}
118} // namespace details
119
123 public:
124 PropertyListBase() noexcept;
125
126 static const PropertyListBase& Default() noexcept {
127 static const PropertyListBase plist{};
128 return plist;
129 }
130
131 private:
132 template <typename T, typename U>
133 friend T details::get_plist(const U&, hid_t (*f)(hid_t));
134};
135
145#if HIGHFIVE_HAS_CONCEPTS && __cplusplus >= 202002L
146template <typename P>
147concept PropertyInterface = requires(P p, const hid_t hid) {
148 {p.apply(hid)};
149};
150
151#else
152#define PropertyInterface typename
153#endif
155
159template <PropertyType T>
161 public:
164 constexpr PropertyType getType() const noexcept {
165 return T;
166 }
167
173 template <PropertyInterface P>
174 void add(const P& property);
175
178 static const PropertyList<T>& Default() noexcept {
179 return static_cast<const PropertyList<T>&>(PropertyListBase::Default());
180 }
181
188 auto plist = PropertyList<T>();
189 plist._initializeIfNeeded();
190
191 return plist;
192 }
193
194 protected:
195 void _initializeIfNeeded();
196};
197
213
218template <PropertyType T>
220 public:
221 template <typename F, typename... Args>
222 void add(const F& funct, const Args&... args);
223};
224
225#ifdef H5_HAVE_PARALLEL
233 public:
234 MPIOFileAccess(MPI_Comm comm, MPI_Info info);
235
236 private:
237 friend FileAccessProps;
238 void apply(const hid_t list) const;
239
240 MPI_Comm _comm;
241 MPI_Info _info;
242};
243
244
245#if H5_VERSION_GE(1, 10, 0)
251class MPIOCollectiveMetadata {
252 public:
253 explicit MPIOCollectiveMetadata(bool collective = true);
254 explicit MPIOCollectiveMetadata(const FileAccessProps& plist);
255
256 bool isCollectiveRead() const;
257 bool isCollectiveWrite() const;
258
259
260 private:
261 friend FileAccessProps;
262 void apply(hid_t plist) const;
263
264 bool collective_read_;
265 bool collective_write_;
266};
267
281class MPIOCollectiveMetadataRead {
282 public:
283 explicit MPIOCollectiveMetadataRead(bool collective = true);
284 explicit MPIOCollectiveMetadataRead(const FileAccessProps& plist);
285
286 bool isCollective() const;
287
288 private:
289 friend FileAccessProps;
290 friend MPIOCollectiveMetadata;
291
292 void apply(hid_t plist) const;
293
294 bool collective_;
295};
296
307class MPIOCollectiveMetadataWrite {
308 public:
309 explicit MPIOCollectiveMetadataWrite(bool collective = true);
310 explicit MPIOCollectiveMetadataWrite(const FileAccessProps& plist);
311
312 bool isCollective() const;
313
314 private:
315 friend FileAccessProps;
316 friend MPIOCollectiveMetadata;
317
318 void apply(hid_t plist) const;
319
320 bool collective_;
321};
322
323#endif
324#endif
325
343 public:
344 FileVersionBounds(H5F_libver_t low, H5F_libver_t high);
345 explicit FileVersionBounds(const FileAccessProps& fapl);
346
347 std::pair<H5F_libver_t, H5F_libver_t> getVersion() const;
348
349 private:
350 friend FileAccessProps;
351 void apply(const hid_t list) const;
352
353 H5F_libver_t _low;
354 H5F_libver_t _high;
355};
356
363 public:
364 explicit MetadataBlockSize(hsize_t size);
365 explicit MetadataBlockSize(const FileAccessProps& fapl);
366
367 hsize_t getSize() const;
368
369 private:
370 friend FileAccessProps;
371 void apply(const hid_t list) const;
372 hsize_t _size;
373};
374
375#if H5_VERSION_GE(1, 10, 1)
382class FileSpaceStrategy {
383 public:
390 FileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold);
391 explicit FileSpaceStrategy(const FileCreateProps& fcpl);
392
393 H5F_fspace_strategy_t getStrategy() const;
394 hbool_t getPersist() const;
395 hsize_t getThreshold() const;
396
397 private:
398 friend FileCreateProps;
399
400 void apply(const hid_t list) const;
401
402 H5F_fspace_strategy_t _strategy;
403 hbool_t _persist;
404 hsize_t _threshold;
405};
406
416class FileSpacePageSize {
417 public:
422 explicit FileSpacePageSize(hsize_t page_size);
423 explicit FileSpacePageSize(const FileCreateProps& fcpl);
424
425 hsize_t getPageSize() const;
426
427 private:
428 friend FileCreateProps;
429 void apply(const hid_t list) const;
430
431 hsize_t _page_size;
432};
433
434#ifndef H5_HAVE_PARALLEL
446class PageBufferSize {
447 public:
453 explicit PageBufferSize(size_t page_buffer_size,
454 unsigned min_meta_percent = 0,
455 unsigned min_raw_percent = 0);
456
457 explicit PageBufferSize(const FileAccessProps& fapl);
458
459 size_t getPageBufferSize() const;
460 unsigned getMinMetaPercent() const;
461 unsigned getMinRawPercent() const;
462
463 private:
464 friend FileAccessProps;
465
466 void apply(hid_t list) const;
467
468 size_t _page_buffer_size;
469 unsigned _min_meta;
470 unsigned _min_raw;
471};
472#endif
473#endif
474
479 public:
484 explicit EstimatedLinkInfo(unsigned entries, unsigned length);
485
486 explicit EstimatedLinkInfo(const GroupCreateProps& gcpl);
487
489 unsigned getEntries() const;
490
492 unsigned getNameLength() const;
493
494 private:
495 friend GroupCreateProps;
496 void apply(hid_t hid) const;
497 unsigned _entries;
498 unsigned _length;
499};
500
501
503class Chunking {
504 public:
505 explicit Chunking(const std::vector<hsize_t>& dims);
506 Chunking(const std::initializer_list<hsize_t>& items);
507
508 template <typename... Args>
509 explicit Chunking(hsize_t item, Args... args);
510
511 explicit Chunking(DataSetCreateProps& plist, size_t max_dims = 32);
512
513 const std::vector<hsize_t>& getDimensions() const noexcept;
514
515 private:
516 friend DataSetCreateProps;
517 void apply(hid_t hid) const;
518 std::vector<hsize_t> _dims;
519};
520
522class Deflate {
523 public:
524 explicit Deflate(unsigned level);
525
526 private:
527 friend DataSetCreateProps;
528 friend GroupCreateProps;
529 void apply(hid_t hid) const;
530 const unsigned _level;
531};
532
534class Szip {
535 public:
536 explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK,
537 unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK);
538
539 unsigned getOptionsMask() const;
540 unsigned getPixelsPerBlock() const;
541
542 private:
543 friend DataSetCreateProps;
544 void apply(hid_t hid) const;
545 const unsigned _options_mask;
546 const unsigned _pixels_per_block;
547};
548
550class Shuffle {
551 public:
552 Shuffle() = default;
553
554 private:
555 friend DataSetCreateProps;
556 void apply(hid_t hid) const;
557};
558
566 public:
567 explicit AllocationTime(H5D_alloc_time_t alloc_time);
568 explicit AllocationTime(const DataSetCreateProps& dcpl);
569
570 H5D_alloc_time_t getAllocationTime();
571
572 private:
573 friend DataSetCreateProps;
574 void apply(hid_t dcpl) const;
575
576 H5D_alloc_time_t _alloc_time;
577};
578
582class Caching {
583 public:
586 Caching(const size_t numSlots,
587 const size_t cacheSize,
588 const double w0 = static_cast<double>(H5D_CHUNK_CACHE_W0_DEFAULT));
589
590 explicit Caching(const DataSetCreateProps& dcpl);
591
592 size_t getNumSlots() const;
593 size_t getCacheSize() const;
594 double getW0() const;
595
596 private:
597 friend DataSetAccessProps;
598 void apply(hid_t hid) const;
599 size_t _numSlots;
600 size_t _cacheSize;
601 double _w0;
602};
603
606 public:
607 explicit CreateIntermediateGroup(bool create = true);
608
609 explicit CreateIntermediateGroup(const ObjectCreateProps& ocpl);
611
612 bool isSet() const;
613
614 protected:
615 void fromPropertyList(hid_t hid);
616
617 private:
618 friend ObjectCreateProps;
619 friend LinkCreateProps;
620 void apply(hid_t hid) const;
621 bool _create;
622};
623
624#ifdef H5_HAVE_PARALLEL
627 public:
628 explicit UseCollectiveIO(bool enable = true);
629
630 explicit UseCollectiveIO(const DataTransferProps& dxpl);
631
633 bool isCollective() const;
634
635 private:
636 friend DataTransferProps;
637 void apply(hid_t hid) const;
638 bool _enable;
639};
640
641
650 public:
651 explicit MpioNoCollectiveCause(const DataTransferProps& dxpl);
652
654 bool wasCollective() const;
655
657 uint32_t getLocalCause() const;
658
660 uint32_t getGlobalCause() const;
661
663 std::pair<uint32_t, uint32_t> getCause() const;
664
665 private:
666 friend DataTransferProps;
667 uint32_t _local_cause;
668 uint32_t _global_cause;
669};
670#endif
671
674 Tracked = H5P_CRT_ORDER_TRACKED,
675 Indexed = H5P_CRT_ORDER_INDEXED,
676 };
677};
678
686 public:
691 explicit LinkCreationOrder(unsigned flags)
692 : _flags(flags) {}
693
694 explicit LinkCreationOrder(const FileCreateProps& fcpl);
695 explicit LinkCreationOrder(const GroupCreateProps& gcpl);
696
697 unsigned getFlags() const;
698
699 protected:
700 void fromPropertyList(hid_t hid);
701
702 private:
703 friend FileCreateProps;
704 friend GroupCreateProps;
705 void apply(hid_t hid) const;
706 unsigned _flags;
707};
708
709
722 public:
729 AttributePhaseChange(unsigned max_compact, unsigned min_dense);
730
732 explicit AttributePhaseChange(const GroupCreateProps& gcpl);
733
734 unsigned max_compact() const;
735 unsigned min_dense() const;
736
737 private:
738 friend GroupCreateProps;
739 void apply(hid_t hid) const;
740
741 unsigned _max_compact;
742 unsigned _min_dense;
743};
744
746
747} // namespace HighFive
748
When are datasets allocated?
Definition H5PropertyList.hpp:565
H5D_alloc_time_t getAllocationTime()
Definition H5PropertyList_misc.hpp:361
AllocationTime(H5D_alloc_time_t alloc_time)
Definition H5PropertyList_misc.hpp:350
Set threshold for attribute storage.
Definition H5PropertyList.hpp:721
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
Definition H5PropertyList.hpp:582
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
Definition H5PropertyList.hpp:605
CreateIntermediateGroup(bool create=true)
Definition H5PropertyList_misc.hpp:390
CreateIntermediateGroup(const LinkCreateProps &lcpl)
void fromPropertyList(hid_t hid)
Definition H5PropertyList_misc.hpp:406
bool isSet() const
Definition H5PropertyList_misc.hpp:411
Definition H5PropertyList.hpp:522
Deflate(unsigned level)
Definition H5PropertyList_misc.hpp:319
Configure the version bounds for the file.
Definition H5PropertyList.hpp:342
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
Configure MPI access for the file.
Definition H5PropertyList.hpp:232
MPIOFileAccess(MPI_Comm comm, MPI_Info info)
Definition H5PropertyList_misc.hpp:162
Configure the metadata block size to use writing to files.
Definition H5PropertyList.hpp:362
MetadataBlockSize(hsize_t size)
Definition H5PropertyList_misc.hpp:246
hsize_t getSize() const
Definition H5PropertyList_misc.hpp:257
The cause for non-collective I/O.
Definition H5PropertyList.hpp:649
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
Base Class for Property lists, providing global default.
Definition H5PropertyList.hpp:122
PropertyListBase() noexcept
Definition H5PropertyList_misc.hpp:58
static const PropertyListBase & Default() noexcept
Definition H5PropertyList.hpp:126
HDF5 property Lists.
Definition H5PropertyList.hpp:160
void _initializeIfNeeded()
Definition H5PropertyList_misc.hpp:63
static PropertyList< T > Empty()
Definition H5PropertyList.hpp:187
static const PropertyList< T > & Default() noexcept
Return the Default property type object.
Definition H5PropertyList.hpp:178
constexpr PropertyType getType() const noexcept
return the type of this PropertyList
Definition H5PropertyList.hpp:164
void add(const P &property)
Definition H5PropertyList_misc.hpp:72
Definition H5PropertyList.hpp:219
void add(const F &funct, const Args &... args)
Definition H5PropertyList_misc.hpp:79
Definition H5PropertyList.hpp:550
Definition H5PropertyList.hpp:534
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
Definition H5PropertyList.hpp:626
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::FILE_ACCESS > FileAccessProps
Definition H5PropertyList.hpp:200
HDF5 file property object.
Definition H5_definitions.hpp:22
Definition H5PropertyList.hpp:672
_CreationOrder
Definition H5PropertyList.hpp:673
@ Tracked
Definition H5PropertyList.hpp:674
@ Indexed
Definition H5PropertyList.hpp:675
static void ToException(const std::string &prefix_msg)
Definition H5Exception_misc.hpp:43