#pragma once #include #include #include #include #include #include #include #include namespace Dune { /// File-Writer for ImageData VTK .vti files /** * Requirement: * - DataCollector must be a model of \ref StructuredDataCollector **/ template > class VtkImageDataWriter : public VtkWriterInterface { static constexpr int dimension = GridView::dimension; using Super = VtkWriterInterface; using pos_type = typename Super::pos_type; public: /// forwarding constructor to \ref VtkWriterInterface using Super::Super; private: /// Write a serial VTK file in Unstructured format virtual void writeSerialFile (std::ofstream& out) const override; /// Write a parallel VTK file `pfilename.pvtu` in Unstructured format, /// with `size` the number of pieces and serial files given by `pfilename_p[i].vtu` /// for [i] in [0,...,size). virtual void writeParallelFile (std::ofstream& out, std::string const& pfilename, int size) const override; virtual std::string fileExtension () const override { return "vti"; } virtual void writeGridAppended (std::ofstream& /*out*/, std::vector& /*blocks*/) const override {} private: using Super::dataCollector_; using Super::format_; using Super::datatype_; using Super::headertype_; // attached data using Super::pointData_; using Super::cellData_; }; // deduction guides template > VtkImageDataWriter(GridView const&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32) -> VtkImageDataWriter>; template > VtkImageDataWriter(DataCollector&, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32) -> VtkImageDataWriter; template > VtkImageDataWriter(std::shared_ptr, Vtk::FormatTypes = Vtk::BINARY, Vtk::DataTypes = Vtk::FLOAT32) -> VtkImageDataWriter; } // end namespace Dune #include "vtkimagedatawriter.impl.hh"