GridFormat 0.6.0
I/O-Library for grid-like data structures
Loading...
Searching...
No Matches
hdf_writer.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2022-2023 Dennis Gläser <dennis.glaeser@iws.uni-stuttgart.de>
2// SPDX-License-Identifier: MIT
8#ifndef GRIDFORMAT_VTK_HDF_WRITER_HPP_
9#define GRIDFORMAT_VTK_HDF_WRITER_HPP_
10#if GRIDFORMAT_HAVE_HIGH_FIVE
11
12#include <type_traits>
13
14#include <gridformat/parallel/communication.hpp>
16
20
21namespace GridFormat {
22
23// forward declarations
24template<Concepts::ImageGrid Grid, Concepts::Communicator C>
26template<Concepts::UnstructuredGrid Grid, Concepts::Communicator C>
28
29#ifndef DOXYGEN
30namespace VTKHDFDetail {
31
32 template<typename Grid, typename C>
33 struct VTKHDFWriterSelector;
34 template<Concepts::UnstructuredGrid G, typename C> requires(!Concepts::ImageGrid<G>)
35 struct VTKHDFWriterSelector<G, C> : public std::type_identity<VTKHDFUnstructuredGridWriter<G, C>> {};
36 template<Concepts::ImageGrid G, typename C>
37 struct VTKHDFWriterSelector<G, C> : public std::type_identity<VTKHDFImageGridWriter<G, C>> {};
38
39 template<typename Grid, typename C>
40 struct VTKHDFTimeSeriesWriterSelector;
41 template<Concepts::UnstructuredGrid G, typename C> requires(!Concepts::ImageGrid<G>)
42 struct VTKHDFTimeSeriesWriterSelector<G, C> : public std::type_identity<VTKHDFUnstructuredTimeSeriesWriter<G, C>> {};
43 template<Concepts::ImageGrid G, typename C>
44 struct VTKHDFTimeSeriesWriterSelector<G, C> : public std::type_identity<VTKHDFImageGridTimeSeriesWriter<G, C>> {};
45
46} // namespace VTKHDFDetail
47#endif // DOXYGEN
48
54template<Concepts::Grid Grid, typename Communicator = GridFormat::NullCommunicator>
55class VTKHDFWriter : public VTKHDFDetail::VTKHDFWriterSelector<Grid, Communicator>::type {
56 using ParentType = typename VTKHDFDetail::VTKHDFWriterSelector<Grid, Communicator>::type;
57
58 public:
59 using ParentType::ParentType;
60};
61
62template<typename Grid>
63VTKHDFWriter(const Grid&) -> VTKHDFWriter<Grid>;
64
65template<typename Grid, Concepts::Communicator Comm>
66VTKHDFWriter(const Grid&, const Comm&) -> VTKHDFWriter<Grid, Comm>;
67
68
74template<Concepts::Grid Grid, Concepts::Communicator C = GridFormat::NullCommunicator>
75class VTKHDFTimeSeriesWriter : public VTKHDFDetail::VTKHDFTimeSeriesWriterSelector<Grid, C>::type {
76 using ParentType = typename VTKHDFDetail::VTKHDFTimeSeriesWriterSelector<Grid, C>::type;
77
78 public:
79 using ParentType::ParentType;
80};
81
82template<Concepts::Grid Grid>
83VTKHDFTimeSeriesWriter(const Grid&, std::string, VTK::HDFTransientOptions = {}) -> VTKHDFTimeSeriesWriter<Grid>;
84template<Concepts::Grid Grid, Concepts::Communicator C>
85VTKHDFTimeSeriesWriter(const Grid&, C, std::string, VTK::HDFTransientOptions = {}) -> VTKHDFTimeSeriesWriter<Grid, C>;
86
87namespace Traits {
88
89template<Concepts::ImageGrid Grid, typename... Args>
90struct WritesConnectivity<VTKHDFWriter<Grid, Args...>> : public std::false_type {};
91
92template<Concepts::ImageGrid Grid, typename... Args>
93struct WritesConnectivity<VTKHDFTimeSeriesWriter<Grid, Args...>> : public std::false_type {};
94
95} // namespace Traits
96
97} // namespace GridFormat
98
99#endif // GRIDFORMAT_HAVE_HIGH_FIVE
100#endif // GRIDFORMAT_VTK_HDF_WRITER_HPP_
Writer for the VTK HDF file format for image grids.
Definition hdf_image_grid_writer.hpp:386
Convenience writer for the vtk-hdf file format, automatically selecting the image or unstructured gri...
Definition hdf_writer.hpp:75
Writer for the VTK HDF file format for unstructured grids.
Definition hdf_unstructured_grid_writer.hpp:397
Convenience writer for the vtk-hdf file format, automatically selecting the image or unstructured gri...
Definition hdf_writer.hpp:55
Concept for grids to be used as image grids.
Definition concepts.hpp:53
Grid concepts.
Common functionality for writing VTK HDF files.
Writer for the VTK HDF file format for image grids.
Writer for the VTK HDF file format for unstructured grids.
Can be specialized by writers in case the file format does not contain connectivity information.
Definition writer.hpp:37
Options for transient vtk-hdf file formats.
Definition hdf_common.hpp:40