OGS
HdfWriter.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5#include <hdf5.h>
6
7#include <filesystem>
8#include <map>
9#include <memory>
10#include <vector>
11
12#include "HdfData.h"
13
14namespace MeshLib::IO
15{
16using HDFAttributes = std::vector<HdfData>;
23
24class HdfWriter final
25{
26public:
41 HdfWriter(std::vector<MeshHdfData> const& meshes,
42 unsigned long long initial_step,
43 double initial_time,
44 std::filesystem::path const& filepath,
45 bool use_compression,
46 bool is_file_manager,
47 unsigned int n_files);
55 void writeStep(double time);
56 ~HdfWriter();
57
58private:
59 // internal data holder
60 struct HdfMesh;
61
62 std::filesystem::path const _hdf5_filepath;
63 hid_t const _file;
64 hid_t const _meshes_group;
65 std::vector<std::unique_ptr<HdfMesh>> _hdf_meshes;
66 std::vector<double> _step_times;
67 bool const _use_compression;
68 bool const _is_file_manager;
69};
70} // namespace MeshLib::IO
bool const _use_compression
Definition HdfWriter.h:67
std::filesystem::path const _hdf5_filepath
Definition HdfWriter.h:62
std::vector< std::unique_ptr< HdfMesh > > _hdf_meshes
Definition HdfWriter.h:65
bool const _is_file_manager
Definition HdfWriter.h:68
hid_t const _meshes_group
Definition HdfWriter.h:64
void writeStep(double time)
Writes attributes. The data itself is hold by a structure outside of this class. The writer assumes t...
HdfWriter(std::vector< MeshHdfData > const &meshes, unsigned long long initial_step, double initial_time, std::filesystem::path const &filepath, bool use_compression, bool is_file_manager, unsigned int n_files)
Write file with geometry and topology data. The data itself is held by a structure outside of this cl...
std::vector< double > _step_times
Definition HdfWriter.h:66
std::vector< HdfData > HDFAttributes
Definition HdfWriter.h:16
HDFAttributes constant_attributes
Definition HdfWriter.h:19
HDFAttributes variable_attributes
Definition HdfWriter.h:20