Wrappers.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <hdf5.h>
7 
9 
10 // H5F wrappers
11 namespace h5 {
12 /// \ingroup HDF5Group
13 SPECTRE_ALWAYS_INLINE auto h5f_acc_rdonly() noexcept {
14 #pragma GCC diagnostic push
15 #pragma GCC diagnostic ignored "-Wold-style-cast"
16  return H5F_ACC_RDONLY;
17 #pragma GCC diagnostic pop
18 }
19 
20 /// \ingroup HDF5Group
21 SPECTRE_ALWAYS_INLINE auto h5f_acc_rdwr() noexcept {
22 #pragma GCC diagnostic push
23 #pragma GCC diagnostic ignored "-Wold-style-cast"
24  return H5F_ACC_RDWR;
25 #pragma GCC diagnostic pop
26 }
27 
28 
29 SPECTRE_ALWAYS_INLINE auto h5f_acc_trunc() noexcept {
30 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wold-style-cast"
32  return H5F_ACC_TRUNC;
33 #pragma GCC diagnostic pop
34 }
35 } // namespace h5
36 
37 // H5P wrappers
38 namespace h5 {
39 /// \ingroup HDF5Group
40 SPECTRE_ALWAYS_INLINE auto h5p_default() noexcept {
41 #pragma GCC diagnostic push
42 #pragma GCC diagnostic ignored "-Wold-style-cast"
43  return H5P_DEFAULT;
44 #pragma GCC diagnostic pop
45 }
46 } // namespace h5
47 
48 // H5S wrappers
49 namespace h5 {
50 /// \ingroup HDF5Group
51 SPECTRE_ALWAYS_INLINE auto h5s_all() noexcept {
52 #pragma GCC diagnostic push
53 #pragma GCC diagnostic ignored "-Wold-style-cast"
54  return H5S_ALL;
55 #pragma GCC diagnostic pop
56 }
57 
58 /// \ingroup HDF5Group
59 SPECTRE_ALWAYS_INLINE auto h5s_unlimited() noexcept {
60 #pragma GCC diagnostic push
61 #pragma GCC diagnostic ignored "-Wold-style-cast"
62  return H5S_UNLIMITED;
63 #pragma GCC diagnostic pop
64 }
65 
66 /// \ingroup HDF5Group
67 SPECTRE_ALWAYS_INLINE auto h5s_scalar() noexcept {
68 #pragma GCC diagnostic push
69 #pragma GCC diagnostic ignored "-Wold-style-cast"
70  return H5S_SCALAR;
71 #pragma GCC diagnostic pop
72 }
73 } // namespace h5
Contains functions and classes for manipulating HDF5 files.
Definition: AccessType.cpp:10
#define SPECTRE_ALWAYS_INLINE
Always inline a function. Only use this if you benchmarked the code.
Definition: ForceInline.hpp:20
Defines macro to always inline a function.