Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <optional>
7 : #include <string>
8 : #include <vector>
9 :
10 : #include "IO/Logging/Verbosity.hpp"
11 :
12 : namespace h5 {
13 : /*!
14 : * \brief Combine a volume subfile across different HDF5 files.
15 : *
16 : * The argument `blocks_to_combine` can list block names and block groups that
17 : * should be combined. We ignore other blocks when combining the HDF5
18 : * files. This provides a way to filter volume data for easier visualization.
19 : */
20 1 : void combine_h5_vol(const std::vector<std::string>& file_names,
21 : const std::string& subfile_name, const std::string& output,
22 : std::optional<double> start_value = std::nullopt,
23 : std::optional<double> stop_value = std::nullopt,
24 : const std::optional<std::vector<std::string>>&
25 : blocks_to_combine = std::nullopt,
26 : bool check_src = true);
27 :
28 : /*!
29 : * \brief Combine the `h5::Dat` subfiles of multiple `h5::H5File`s into a single
30 : * H5 file.
31 : *
32 : * \details The times in each `h5::Dat` subfile can be unordered. The necessary
33 : * sorting will be handled in this function. However, the \p h5_files_to_combine
34 : * must be mononitcally increasing in time; meaning the earliest time in
35 : * `File1.h5` must come before the earliest time in `File2.h5`.
36 : *
37 : * If there are overlapping times, the "latest" one is always used;
38 : * meaning if you have data in `File1.h5` and `File2.h5` and if the earliest
39 : * time in `File2.h5` is before some times in `File1.h5`, those times in
40 : * `File1.h5` will be discarded and won't appear in the combined H5 file.
41 : *
42 : * If the H5 files in \p h5_files_to_combine have other types of subfiles, those
43 : * will be ignored and will not appear in \p output_h5_filename.
44 : *
45 : * If \p h5_files_to_combine is empty, an error will occur.
46 : *
47 : * If there are no `h5::Dat` files in the \p h5_files_to_combine, an error will
48 : * occur.
49 : *
50 : * If the legend or version of an `h5::Dat` is not the same in all of
51 : * \p h5_files_to_combine, an error will occur.
52 : *
53 : * \param h5_files_to_combine Vector of H5 files to combine. They must all have
54 : * the same `h5::Dat` filenames, and those `h5::Dat` subfiles must have the same
55 : * legends and versions. If not, an error will occur.
56 : * \param output_h5_filename Name of the combined H5 file. The `h5::Dat` subfile
57 : * structure will be identical to the ones in \p h5_files_to_combine.
58 : * \param verbosity Controls how much is printed to stdout. Defaults to no
59 : * `Verbosity::Silent` or no output.
60 : */
61 1 : void combine_h5_dat(const std::vector<std::string>& h5_files_to_combine,
62 : const std::string& output_h5_filename,
63 : Verbosity verbosity = Verbosity::Silent);
64 : } // namespace h5
|