16#ifdef Mallard_HAS_HDF5
31#if defined(Mallard_HAS_MPI) && defined(H5_HAVE_PARALLEL)
32inline constexpr bool PARALLEL =
true;
34inline constexpr bool PARALLEL =
false;
41 if (
id < 0)
throw std::runtime_error(
"HDF5: " +
what +
" failed.");
46 operator hid_t()
const {
return id; }
54 if (status < 0)
throw std::runtime_error(
"HDF5: " +
what +
" failed.");
64 else static_assert(
sizeof(T) == 0,
"HDF5: unsupported type");
70 else if constexpr (std::is_same_v<T, float>)
return H5T_IEEE_F32LE;
71 else if constexpr (std::is_same_v<T, int64_t>)
return H5T_STD_I64LE;
72 else if constexpr (std::is_same_v<T, uint64_t>)
return H5T_STD_U64LE;
79#if defined(Mallard_HAS_MPI) && defined(H5_HAVE_PARALLEL)
94#if defined(Mallard_HAS_MPI) && defined(H5_HAVE_PARALLEL)
126 std::string(
"creating ") + name);
154 std::vector<T> data(std::max<uint64_t>(n *
cols, 1));
156 data.resize(n *
cols);
175 if (
H5Aexists(
object, name) <= 0)
throw std::runtime_error(std::string(
"HDF5 file: missing attribute ") + name);
186 std::vector<char>
buffer(std::max<size_t>(
strings.size(), 1) * width,
'\0');
206 std::vector<char>
buffer(
static_cast<size_t>(std::max<hssize_t>(n, 1)) * width,
'\0');
208 std::vector<std::string>
strings;
210 const char *
s = &
buffer[
static_cast<size_t>(
i) * width];
211 strings.emplace_back(
s, std::find(
s,
s + width,
'\0'));
Process-level communication: MPI when built with Mallard_ENABLE_MPI, otherwise a single-rank stub wit...
KOKKOS_INLINE_FUNCTION rtype dot(const rtype *a, const rtype *b)
Compute the dot product of two arrays.
Definition common_math.h:32
int rank()
Rank of this process in the world communicator.
Definition comm.cpp:181
int size()
Number of processes in the world communicator.
Definition comm.cpp:182
std::string count(uint64_t n)
1234567 -> "1,234,567".
Definition log.cpp:167
BaseDims dims
Definition units.cpp:32