GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
H5Dump.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
// See LICENSE for details.
4
5
#ifndef MANAGERS_IO_H5DUMP_H_
6
#define MANAGERS_IO_H5DUMP_H_
7
8
#ifdef WITH_HDF5
9
10
#include <hdf5.h>
11
12
#include <cstddef>
13
#include <cstdint>
14
#include <string>
15
16
namespace
gpr
{
17
namespace
io
{
18
19
// Minimal direct-HDF5 replacement for the narrow HighFive::H5Easy surface
20
// that gpridge actually uses (1D and 2D double and 1D int32 dumps into
21
// nested groups, a root string attribute, two file-open modes). Keeps the
22
// dependency chain at raw libhdf5, so the EESSI HDF5 module is usable without
23
// the conda-forge HighFive SONAME pin dragging conda HDF5 along at link time.
24
class
H5Dumper {
25
public
:
26
enum class
Mode
{ OpenOrCreate, Overwrite };
27
28
H5Dumper(
const
std::string& path, Mode mode);
29
~H5Dumper();
30
31
H5Dumper(
const
H5Dumper&) =
delete
;
32
H5Dumper& operator=(
const
H5Dumper&) =
delete
;
33
34
// Creates any missing parent groups in `dataset_path` (HDF5-style
35
// absolute "/a/b/c" path), then writes `data[0..n)` as a 1D double
36
// dataset. Overwrites the dataset if it already exists.
37
void
dump(
const
std::string& dataset_path,
const
double
* data,
38
std::size_t n);
39
40
// Same, as a row-major 2D double dataset of shape (rows, cols).
41
void
dump2d(
const
std::string& dataset_path,
const
double
* data,
42
std::size_t rows, std::size_t cols);
43
44
// Same, as a 1D 32-bit integer dataset.
45
void
dumpInt32(
const
std::string& dataset_path,
const
std::int32_t* data,
46
std::size_t n);
47
48
// Writes (or replaces) a variable-length UTF-8 string attribute on the
49
// root group.
50
void
rootAttribute(
const
std::string& name,
const
std::string& value);
51
52
private
:
53
void
write(
const
std::string& dataset_path, hid_t type,
int
rank,
54
const
hsize_t* dims,
const
void
* data);
55
56
hid_t file_;
57
};
58
59
}
// namespace io
60
}
// namespace gpr
61
62
#endif
// WITH_HDF5
63
#endif
// MANAGERS_IO_H5DUMP_H_
gpr::htst::Mode
Mode
Which Hessian a search's half is built from.
Definition
HarmonicPrefactor.h:145
gpr::io
Definition
SeededSearch.h:8
gpr
Gaussian-process regression, kernels, priors, and the searches that run on the surrogate.
Definition
Macros.h:16
managers
io
H5Dump.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf