Wildmeshing Toolkit
HDF5Writer.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "MeshWriter.hpp"
4 
5 #include <filesystem>
6 
7 namespace h5pp {
8 class File;
9 }
10 
11 namespace wmtk {
12 class HDF5Writer : public MeshWriter
13 {
14 public:
15  HDF5Writer(const std::filesystem::path& filename);
16 
17  void write_top_simplex_type(const PrimitiveType type) override;
18  void write_absolute_id(const std::vector<int64_t>& id) override;
19 
20  bool write(const int) override { return true; }
21 
22  void write_capacities(const std::vector<int64_t>& capacities) override;
23 
24  void write(
25  const std::string& name,
26  const int64_t type,
27  const int64_t stride,
28  const std::vector<char>& val,
29  const char default_val) override;
30 
31  void write(
32  const std::string& name,
33  const int64_t type,
34  const int64_t stride,
35  const std::vector<int64_t>& val,
36  const int64_t default_val) override;
37 
38  void write(
39  const std::string& name,
40  const int64_t type,
41  const int64_t stride,
42  const std::vector<double>& val,
43  const double default_val) override;
44 
45  void write(
46  const std::string& name,
47  const int64_t type,
48  const int64_t stride,
49  const std::vector<Rational>& val,
50  const Rational& default_val) override;
51 
52 private:
53  std::shared_ptr<h5pp::File> m_hdf5_file;
54  std::string m_name;
55 
56  std::string dataset_path() const;
57 
58  template <typename Data, typename T>
59  void write_internal(
60  const std::string& name,
61  const int64_t type,
62  const int64_t stride,
63  const Data& val,
64  const T& default_val);
65 };
66 
67 } // namespace wmtk
std::string dataset_path() const
Definition: HDF5Writer.cpp:161
std::string m_name
Definition: HDF5Writer.hpp:54
HDF5Writer(const std::filesystem::path &filename)
Definition: HDF5Writer.cpp:52
std::shared_ptr< h5pp::File > m_hdf5_file
Definition: HDF5Writer.hpp:53
void write_internal(const std::string &name, const int64_t type, const int64_t stride, const Data &val, const T &default_val)
Definition: HDF5Writer.cpp:124
void write_capacities(const std::vector< int64_t > &capacities) override
Definition: HDF5Writer.cpp:118
void write_absolute_id(const std::vector< int64_t > &id) override
Definition: HDF5Writer.cpp:146
void write_top_simplex_type(const PrimitiveType type) override
Definition: HDF5Writer.cpp:141
bool write(const int) override
Definition: HDF5Writer.hpp:20
Definition: Accessor.hpp:6