6 #ifndef DUNE_GRID_IO_FILE_VTK_PVTUWRITER_HH 7 #define DUNE_GRID_IO_FILE_VTK_PVTUWRITER_HH 12 #include <dune/common/exceptions.hh> 13 #include <dune/common/indent.hh> 83 fileType =
"PPolyData";
86 fileType =
"PUnstructuredGrid";
89 DUNE_THROW(IOError,
"PVTUWriter: Unknown fileType: " << fileType_);
93 stream << indent <<
"<?xml version=\"1.0\"?>\n";
94 stream << indent <<
"<VTKFile" 95 <<
" type=\"" << fileType <<
"\"" 97 <<
" byte_order=\"" << byteOrder <<
"\">\n";
104 stream << indent <<
"</VTKFile>\n" 121 const std::string& vectors =
"") {
122 stream << indent <<
"<PPointData";
123 if(scalars !=
"") stream <<
" Scalars=\"" << scalars <<
"\"";
124 if(vectors !=
"") stream <<
" Vectors=\"" << vectors <<
"\"";
131 stream << indent <<
"</PPointData>\n";
147 const std::string& vectors =
"") {
148 stream << indent <<
"<PCellData";
149 if(scalars !=
"") stream <<
" Scalars=\"" << scalars <<
"\"";
150 if(vectors !=
"") stream <<
" Vectors=\"" << vectors <<
"\"";
157 stream << indent <<
"</PCellData>\n";
167 stream << indent <<
"<PPoints>\n";
173 stream << indent <<
"</PPoints>\n";
190 stream << indent <<
"<" << fileType
191 <<
" GhostLevel=\"" << ghostLevel <<
"\">\n";
197 stream << indent <<
"</" << fileType <<
">\n";
208 stream << indent <<
"<PDataArray" 209 <<
" type=\"" <<
toString(prec) <<
"\"" 210 <<
" Name=\"" << name <<
"\"" 211 <<
" NumberOfComponents=\"" << ncomps <<
"\"/>\n";
215 inline void addPiece(
const std::string& filename) {
216 stream << indent <<
"<Piece " 217 <<
" Source=\"" << filename <<
"\"/>\n";
227 #endif // DUNE_GRID_IO_FILE_VTK_PVTUWRITER_HH Dump a .vtu/.vtp files contents to a stream.
Definition: pvtuwriter.hh:62
for .vtu files (UnstructuredGrid)
Definition: common.hh:256
for .vtp files (PolyData)
Definition: common.hh:254
void beginCellData(const std::string &scalars="", const std::string &vectors="")
start CellData section
Definition: pvtuwriter.hh:146
std::string toString(Precision p)
map precision to VTK type name
Definition: common.hh:280
void addPiece(const std::string &filename)
Add a serial piece to the output file.
Definition: pvtuwriter.hh:215
void endCellData()
finish CellData section
Definition: pvtuwriter.hh:155
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: pvtuwriter.hh:195
void addArray(const std::string &name, unsigned ncomps, Precision prec)
Add an array to the output file.
Definition: pvtuwriter.hh:207
void beginPoints()
start section for the point coordinates
Definition: pvtuwriter.hh:166
FileType
which type of VTK file to write
Definition: common.hh:252
void endPointData()
finish PointData section
Definition: pvtuwriter.hh:129
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: pvtuwriter.hh:120
Include standard header files.
Definition: agrid.hh:59
void beginMain(unsigned ghostLevel=0)
start the main PPolyData/PUnstructuredGrid section
Definition: pvtuwriter.hh:189
~PVTUWriter()
write footer
Definition: pvtuwriter.hh:102
void endPoints()
finish section for the point coordinates
Definition: pvtuwriter.hh:171
PVTUWriter(std::ostream &stream_, FileType fileType_)
create a PVTUWriter object
Definition: pvtuwriter.hh:78
std::string getEndiannessString()
determine endianness of this C++ implementation
Definition: common.hh:232
Common stuff for the VTKWriter.
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:271