dune-vtk 2.8
Loading...
Searching...
No Matches
vtkunstructuredgridwriter.hh
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <iosfwd>
5#include <map>
6
9#include <dune/vtk/types.hh>
12
14
15namespace Dune
16{
18
22 template <class GridView, class DataCollector = Vtk::ContinuousDataCollector<GridView>>
24 : public VtkWriterInterface<GridView, DataCollector>
25 {
26 template <class> friend class VtkTimeseriesWriter;
27
29 using pos_type = typename Super::pos_type;
30
31 public:
33 using Super::Super;
34
35 private:
37 virtual void writeSerialFile (std::ofstream& out) const override;
38
42 virtual void writeParallelFile (std::ofstream& out, std::string const& pfilename, int size) const override;
43
45
53 void writeTimeseriesSerialFile (std::ofstream& out,
54 std::string const& filenameMesh,
55 std::vector<std::pair<double, std::string>> const& timesteps,
56 std::vector<std::uint64_t> const& blocks) const;
57
59 void writeTimeseriesParallelFile (std::ofstream& out,
60 std::string const& pfilename, int size,
61 std::vector<std::pair<double, std::string>> const& timesteps) const;
62
63 virtual std::string fileExtension () const override
64 {
65 return "vtu";
66 }
67
68 virtual void writeGridAppended (std::ofstream& out, std::vector<std::uint64_t>& blocks) const override;
69
70 // Write the element connectivity to the output stream `out`. In case
71 // of binary format, stores the streampos of XML attributes "offset" in the
72 // vector `offsets`.
73 void writeCells (std::ofstream& out,
74 std::vector<pos_type>& offsets,
75 std::optional<std::size_t> timestep = {}) const;
76
77 void writePointIds (std::ofstream& out,
78 std::vector<pos_type>& offsets,
79 std::optional<std::size_t> timestep = {}) const;
80
81 private:
83 using Super::format_;
84 using Super::datatype_;
86
87 // attached data
89 using Super::cellData_;
90 };
91
92 // deduction guides
93 template <class GridView, class... Args,
94 Vtk::IsGridView<GridView> = true>
95 VtkUnstructuredGridWriter(GridView, Args...)
97
98 template <class DataCollector, class... Args,
100 VtkUnstructuredGridWriter(DataCollector&, Args...)
102
103 template <class DataCollector, class... Args,
105 VtkUnstructuredGridWriter(std::shared_ptr<DataCollector>, Args...)
107
108} // end namespace Dune
109
Definition: writer.hh:13
decltype((std::declval< DC & >().update(), std::declval< DC >().numPoints(), std::declval< DC >().numCells(), CheckTypes< typename DC::GridView >{}, true)) IsDataCollector
Definition: concepts.hh:18
File-Writer for Vtk timeseries .vtu files.
Definition: vtktimeserieswriter.hh:25
Interface for file writers for the Vtk XML file formats.
Definition: vtkwriterinterface.hh:25
std::shared_ptr< DataCollector > dataCollector_
Definition: vtkwriterinterface.hh:260
Vtk::FormatTypes format_
Definition: vtkwriterinterface.hh:262
std::vector< VtkFunction > pointData_
Definition: vtkwriterinterface.hh:268
std::vector< VtkFunction > cellData_
Definition: vtkwriterinterface.hh:269
Vtk::DataTypes headertype_
Definition: vtkwriterinterface.hh:264
Vtk::DataTypes datatype_
Definition: vtkwriterinterface.hh:263
typename std::ostream::pos_type pos_type
Definition: vtkwriterinterface.hh:35
File-Writer for VTK .vtu files.
Definition: vtkunstructuredgridwriter.hh:25