Peano 4
Loading...
Searching...
No Matches
VTKWriter.cpp
Go to the documentation of this file.
1#include "VTKWriter.h"
5
6
8
9
10tarch::plotter::pointdata::vtk::VTKWriter::VTKWriter(bool binaryFile, const std::string& fileName, const std::string& indexFileName, tarch::plotter::PVDTimeSeriesWriter::IndexFileMode mode, double timeStamp) {
11 if (binaryFile) {
12 _vtkWriter = new tarch::plotter::griddata::unstructured::vtk::VTKBinaryFileWriter(fileName, indexFileName, mode, timeStamp);
13 //assertionMsg(mode==tarch::plotter::PVDTimeSeriesWriter::IndexFileMode::NoIndexFile, "time series files are not supported with legacy vtk formats");
14 }
15 else {
16 _vtkWriter = new tarch::plotter::griddata::unstructured::vtk::VTUTextFileWriter(fileName, indexFileName, mode, timeStamp);
17 }
18
21}
22
23
24
26 assertionMsg( _vertexWriter==nullptr, "no close() on point data writer called" );
27 assertionMsg( _cellWriter==nullptr, "no close() on point data writer called" );
28
29 delete _vtkWriter;
30}
31
32
34 return new PointDataWriter(*this,identifier,recordsPerPoint);
35}
36
37
39 if (_vertexWriter!=nullptr) {
40 _vertexWriter->close();
41 _cellWriter->close();
42
43 delete _vertexWriter;
44 delete _cellWriter;
45
46 _vertexWriter = nullptr;
47 _cellWriter = nullptr;
48 }
49
50 return _vtkWriter->writeToFile();
51}
52
53
55 return _vtkWriter->isOpen();
56}
57
58
60 _vtkWriter->clear();
61}
62
63
65 const int particleNumber = _vertexWriter->plotVertex(position);
66 _cellWriter->plotPoint(particleNumber);
67 return particleNumber;
68}
69
70
72 const int particleNumber = _vertexWriter->plotVertex(position);
73 _cellWriter->plotPoint(particleNumber);
74 return particleNumber;
75}
76
77
78tarch::plotter::pointdata::vtk::VTKWriter::PointDataWriter::PointDataWriter(VTKWriter& myWriter, const std::string& identifier, int recordsPerPoint):
79 _myWriter(myWriter),
80 _particleDataWriter(_myWriter._vtkWriter->createVertexDataWriter(identifier,recordsPerPoint)) {
81}
82
83
85 assertionMsg( _particleDataWriter==nullptr, "forgot to call close() on PointDataWriter" );
86}
87
88
90 _particleDataWriter->plotVertex(index,value);
91}
92
93
95 _particleDataWriter->plotVertex(index,value(0));
96}
97
98
100 _particleDataWriter->plotVertex(index,value);
101}
102
103
105 _particleDataWriter->plotVertex(index,value);
106}
107
108
109void tarch::plotter::pointdata::vtk::VTKWriter::PointDataWriter::plot( int index, double* values, int numberOfValues ) {
110 _particleDataWriter->plotVertex(index,values,numberOfValues);
111}
112
113
115 if (_myWriter._vertexWriter!=nullptr) {
116 _myWriter._vertexWriter->close();
117 _myWriter._cellWriter->close();
118
119 delete _myWriter._vertexWriter;
120 delete _myWriter._cellWriter;
121
122 _myWriter._vertexWriter = nullptr;
123 _myWriter._cellWriter = nullptr;
124 }
125
126 _particleDataWriter->close();
127 delete _particleDataWriter;
128 _particleDataWriter = nullptr;
129}
130
131
133 _particleDataWriter->assignRemainingVerticesDefaultValues();
134}
#define assertionMsg(expr, message)
And from this we can write down f$ nabla phi_i nabla phi_i dx but since we are constructing matrix let s investigate the f$ our matrix elements will nabla phi_i dx f By this will be a sparse as these basis functions are chosen to not overlap with each other almost everywhere In other they have only local support We can read off the right hand side values
Boolean semaphore across MPI ranks.
virtual VertexWriter * createVertexWriter()=0
Caller has to destroy this instance manually.
virtual CellWriter * createCellWriter()=0
Caller has to destroy this instance manually.
virtual void plot(int index, double value) override
Write data for one point.
Definition VTKWriter.cpp:89
virtual void close() override
If you close your writer, each point has to be assigned a value, i.e.
PointDataWriter(VTKWriter &myWriter, const std::string &identifier, int recordsPerPoint)
Definition VTKWriter.cpp:78
Implementation of the point data writer that basically maps the points onto a vtk text file,...
Definition VTKWriter.h:35
virtual bool writeToFile() override
Before we write to a file, we have to close the.
Definition VTKWriter.cpp:38
virtual PointWriter::PointDataWriter * createPointDataWriter(const std::string &identifier, int recordsPerPoint) override
Caller has to destroy this instance manually.
Definition VTKWriter.cpp:33
VTKWriter(const VTKWriter &writer)=delete
Copy constructor.
virtual int plotPoint(const tarch::la::Vector< 2, double > &position) override
Definition VTKWriter.cpp:64
static tarch::mpi::BooleanSemaphore _sempahore
This is a global (mpi) semaphore that I use to update/modify the index file over all files.
Definition VTKWriter.h:42
tarch::plotter::griddata::unstructured::UnstructuredGridWriter::VertexWriter * _vertexWriter
Definition VTKWriter.h:45
tarch::plotter::griddata::unstructured::UnstructuredGridWriter::CellWriter * _cellWriter
Definition VTKWriter.h:46
tarch::plotter::griddata::unstructured::UnstructuredGridWriter * _vtkWriter
Definition VTKWriter.h:44
virtual void clear() override
Clear the writer, i.e.
Definition VTKWriter.cpp:59
Simple vector class.
Definition Vector.h:134