Peano
Loading...
Searching...
No Matches
VTUWriter.h
Go to the documentation of this file.
1#pragma once
2
3#include "Writer.h"
4
5#include "config.h"
6#include "../data/PatchData.h"
7
8#include "tarch/logging/Log.h"
9
10
11#ifdef UseVTK
12#include <vtkImageData.h>
13#include <vtkSmartPointer.h>
14#include <vtkUnstructuredGrid.h>
15#endif
16
17
18#include <vector>
19
20
21namespace convert {
22 namespace output {
23 class VTUWriter;
24 }
25
26 namespace input {
30 class PeanoTextPatchFileReader;
31 }
32}
33
34
36 public:
37 VTUWriter(const std::string& directory, const std::string& outputFileWithoutExtention);
38 virtual ~VTUWriter() override;
39
40 virtual void writeFile(const convert::data::Variable& variable, const std::vector<convert::data::PatchData>& data) override;
41
45/*
46 void writeFile(const PeanoMetaFile& metaFile, const std::string& selector) override;
47
48 static void writeFile(const std::string& outputFileWithoutExtension, const std::vector<PeanoPatch*>& patches);
49*/
50 private:
52
53 [[maybe_unused]] const std::string& _outputFileWithoutExtension;
54 [[maybe_unused]] const std::string& _directory;
55
56 #ifdef UseVTK
60// static vtkSmartPointer<vtkUnstructuredGrid> combine(const std::vector<PeanoPatch*>& patches);
61
65 static vtkSmartPointer<vtkImageData> toImageData(const convert::data::Variable& variable, const convert::data::PatchData& data);
66
72 static vtkSmartPointer<vtkUnstructuredGrid> toUnstructuredGrid(const convert::data::Variable& variable, const convert::data::PatchData& data);
73
74 static vtkSmartPointer<vtkDoubleArray> getVTUDataForOnePatch(const convert::data::Variable& variable, const convert::data::PatchData& data);
75
80 static vtkSmartPointer<vtkDoubleArray> getMetaDataForOnePatch(const convert::data::Variable& variable, const convert::data::PatchData& data);
81 #endif
82
87 static int xyzToIndex(int x, int y, int z, int verticesPerAxis);
88};
89
A patch is a square or cube in the domain.
Definition PatchData.h:25
Represents one variable that is subsequently attached to the patches of a file.
Definition Variable.h:18
const std::string & _outputFileWithoutExtension
Definition VTUWriter.h:53
const std::string & _directory
Definition VTUWriter.h:54
VTUWriter(const std::string &directory, const std::string &outputFileWithoutExtention)
static tarch::logging::Log _log
Meta file write.
Definition VTUWriter.h:51
virtual ~VTUWriter() override
static int xyzToIndex(int x, int y, int z, int verticesPerAxis)
Helper function that we use extensively when we map a patch within one cell onto an unstructured grid...
virtual void writeFile(const convert::data::Variable &variable, const std::vector< convert::data::PatchData > &data) override
Our writers write only one variable at a time even though the Peano file format can hold multiple var...
Log Device.
Definition Log.h:517