dune-vtk 2.12
Loading...
Searching...
No Matches
unstructuredgridwriter.hh
Go to the documentation of this file.
1#pragma once
2
3#include <array>
4#include <iosfwd>
5#include <map>
6
8#include <dune/vtk/types.hh>
12
13namespace Dune::Vtk
14{
16
20 template <class GridView, class DataCollector = ContinuousDataCollector<GridView>>
22 : public VtkWriterBase<GridView, DataCollector>
23 {
24 template <class> friend class TimeseriesWriter;
25
27 using pos_type = typename Super::pos_type;
28
29 public:
31 using Super::Super;
32
33 private:
35 virtual void writeSerialFile (std::ofstream& out) const override;
36
40 virtual void writeParallelFile (std::ofstream& out, std::string const& pfilename, int size) const override;
41
43
51 void writeTimeseriesSerialFile (std::ofstream& out,
52 std::string const& filenameMesh,
54 std::vector<std::uint64_t> const& blocks) const;
55
57 void writeTimeseriesParallelFile (std::ofstream& out,
58 std::string const& pfilename, int size,
59 std::vector<std::pair<double, std::string>> const& timesteps) const;
60
61 virtual std::string fileExtension () const override
62 {
63 return "vtu";
64 }
65
66 virtual void writeGridAppended (std::ofstream& out, std::vector<std::uint64_t>& blocks) const override;
67
68 // Write the element connectivity to the output stream `out`. In case
69 // of binary format, stores the streampos of XML attributes "offset" in the
70 // vector `offsets`.
71 void writeCells (std::ofstream& out,
72 std::vector<pos_type>& offsets,
73 std::optional<std::size_t> timestep = {}) const;
74
75 void writePointIds (std::ofstream& out,
76 std::vector<pos_type>& offsets,
77 std::optional<std::size_t> timestep = {}) const;
78
79 private:
81 using Super::format_;
82 using Super::datatype_;
84
85 // attached data
87 using Super::cellData_;
88 };
89
90 // deduction guides
91 template <class GridView, class... Args,
92 IsGridView<GridView> = true>
95
96 template <class DataCollector, class... Args,
98 UnstructuredGridWriter(DataCollector&, Args...)
100
101 template <class DataCollector, class... Args,
103 UnstructuredGridWriter(DataCollector&&, Args...)
105
106 template <class DataCollector, class... Args,
110
111} // end namespace Dune::Vtk
112
Definition writer.hh:16
decltype((std::declval< DC & >().update(), std::declval< DC >().numPoints(), std::declval< DC >().numCells(), CheckTypes< typename DC::GridView >{}, true)) IsDataCollector
Definition concepts.hh:16
int size() const
GridView(const Implementation &imp)
File-Writer for Vtk timeseries .vtu files.
Definition timeserieswriter.hh:25
Base class for file writers for the Vtk XML file formats.
Definition vtkwriterbase.hh:26
std::vector< VtkFunction > pointData_
Definition vtkwriterbase.hh:322
Vtk::DataTypes datatype_
Definition vtkwriterbase.hh:317
typename std::ostream::pos_type pos_type
Definition vtkwriterbase.hh:39
Vtk::FormatTypes format_
Definition vtkwriterbase.hh:316
std::vector< VtkFunction > cellData_
Definition vtkwriterbase.hh:323
Vtk::DataTypes headertype_
Definition vtkwriterbase.hh:318
std::shared_ptr< DataCollector > dataCollector_
Definition vtkwriterbase.hh:314
File-Writer for VTK .vtu files.
Definition unstructuredgridwriter.hh:23