Go to the documentation of this file.
4 #ifndef DUNE_GRID_IO_FILE_VTK_PVTUWRITER_HH
5 #define DUNE_GRID_IO_FILE_VTK_PVTUWRITER_HH
10 #include <dune/common/exceptions.hh>
11 #include <dune/common/indent.hh>
81 fileType =
"PPolyData";
84 fileType =
"PUnstructuredGrid";
87 DUNE_THROW(IOError,
"PVTUWriter: Unknown fileType: " << fileType_);
91 stream << indent <<
"<?xml version=\"1.0\"?>\n";
92 stream << indent <<
"<VTKFile"
93 <<
" type=\"" << fileType <<
"\""
95 <<
" byte_order=\"" << byteOrder <<
"\">\n";
102 stream << indent <<
"</VTKFile>\n"
119 const std::string& vectors =
"") {
120 stream << indent <<
"<PPointData";
121 if(scalars !=
"") stream <<
" Scalars=\"" << scalars <<
"\"";
122 if(vectors !=
"") stream <<
" Vectors=\"" << vectors <<
"\"";
129 stream << indent <<
"</PPointData>\n";
145 const std::string& vectors =
"") {
146 stream << indent <<
"<PCellData";
147 if(scalars !=
"") stream <<
" Scalars=\"" << scalars <<
"\"";
148 if(vectors !=
"") stream <<
" Vectors=\"" << vectors <<
"\"";
155 stream << indent <<
"</PCellData>\n";
165 stream << indent <<
"<PPoints>\n";
171 stream << indent <<
"</PPoints>\n";
188 stream << indent <<
"<" << fileType
189 <<
" GhostLevel=\"" << ghostLevel <<
"\">\n";
195 stream << indent <<
"</" << fileType <<
">\n";
205 void addArray(
const std::string& name,
unsigned ncomps) {
207 stream << indent <<
"<PDataArray"
208 <<
" type=\"" << tn() <<
"\""
209 <<
" Name=\"" << name <<
"\""
210 <<
" NumberOfComponents=\"" << ncomps <<
"\"/>\n";
214 inline void addPiece(
const std::string& filename) {
215 stream << indent <<
"<Piece "
216 <<
" Source=\"" << filename <<
"\"/>\n";
226 #endif // DUNE_GRID_IO_FILE_VTK_PVTUWRITER_HH
Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:60
void addArray(const std::string &name, unsigned ncomps)
Add an array to the output file.
Definition: pvtuwriter.hh:205
PVTUWriter(std::ostream &stream_, FileType fileType_)
create a PVTUWriter object
Definition: pvtuwriter.hh:76
void addPiece(const std::string &filename)
Add a serial piece to the output file.
Definition: pvtuwriter.hh:214
@ unstructuredGrid
for .vtu files (UnstructuredGrid)
Definition: common.hh:302
~PVTUWriter()
write footer
Definition: pvtuwriter.hh:100
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: pvtuwriter.hh:144
std::string getEndiannessString()
determine endianness of this C++ implementation
Definition: common.hh:278
void beginPoints()
start section for the point coordinates
Definition: pvtuwriter.hh:164
void endCellData()
finish CellData section
Definition: pvtuwriter.hh:153
FileType
which type of VTK file to write
Definition: common.hh:298
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: pvtuwriter.hh:118
@ polyData
for .vtp files (PolyData)
Definition: common.hh:300
void endPoints()
finish section for the point coordinates
Definition: pvtuwriter.hh:169
Common stuff for the VTKWriter.
void beginMain(unsigned ghostLevel=0)
start the main PPolyData/PUnstructuredGrid section
Definition: pvtuwriter.hh:187
void endPointData()
finish PointData section
Definition: pvtuwriter.hh:127
Include standard header files.
Definition: agrid.hh:58
map type to its VTK name in data array
Definition: common.hh:124
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: pvtuwriter.hh:193