DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
HDF5.hpp
Go to the documentation of this file.
1#pragma once
2/// @file HDF5.hpp
3/// @brief HDF5 native type mappings for DNDS index, rowsize, and real types.
4
5#include "Defines.hpp"
6#include <hdf5.h>
7
8namespace DNDS
9{
10 /// @brief HDF5 native datatype matching DNDS #index (currently `H5T_NATIVE_INT64`).
11 /// @details Static-asserts that the DNDS type has not drifted from `int64_t`.
12 inline hid_t DNDS_H5T_INDEX()
13 {
14 if constexpr (std::is_same_v<index, int64_t>)
15 return H5T_NATIVE_INT64;
16 else
17 {
18 static_assert(std::is_same_v<index, int64_t>, "index type not right");
19 return H5T_NATIVE_INT64;
20 }
21 }
22
23 /// @brief HDF5 native datatype matching DNDS #rowsize (currently `H5T_NATIVE_INT32`).
24 inline hid_t DNDS_H5T_ROWSIZE()
25 {
26 if constexpr (std::is_same_v<rowsize, int32_t>)
27 return H5T_NATIVE_INT32;
28 else
29 {
30 static_assert(std::is_same_v<rowsize, int32_t>, "rowsize type not right");
31 return H5T_NATIVE_INT32;
32 }
33 }
34
35 /// @brief HDF5 native datatype matching DNDS #real (currently `H5T_NATIVE_DOUBLE`).
36 inline hid_t DNDS_H5T_REAL()
37 {
38 if constexpr (std::is_same_v<real, double>)
39 return H5T_NATIVE_DOUBLE;
40 else
41 {
42 static_assert(std::is_same_v<real, double>, "real type not right");
43 return H5T_NATIVE_DOUBLE;
44 }
45 }
46}
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
the host side operators are provided as implemented
hid_t DNDS_H5T_REAL()
HDF5 native datatype matching DNDS real (currently H5T_NATIVE_DOUBLE).
Definition HDF5.hpp:36
hid_t DNDS_H5T_ROWSIZE()
HDF5 native datatype matching DNDS rowsize (currently H5T_NATIVE_INT32).
Definition HDF5.hpp:24
hid_t DNDS_H5T_INDEX()
HDF5 native datatype matching DNDS index (currently H5T_NATIVE_INT64).
Definition HDF5.hpp:12