6 #ifndef DUNE_GRID_IO_FILE_VTK_VTUWRITER_HH 7 #define DUNE_GRID_IO_FILE_VTK_VTUWRITER_HH 12 #include <dune/common/exceptions.hh> 13 #include <dune/common/indent.hh> 107 std::string fileType;
108 std::string cellName;
128 fileType =
"PolyData";
132 fileType =
"UnstructuredGrid";
136 DUNE_THROW(IOError,
"VTUWriter: Unknown fileType: " << fileType_);
140 stream << indent <<
"<?xml version=\"1.0\"?>\n";
141 stream << indent <<
"<VTKFile" 142 <<
" type=\"" << fileType <<
"\"" 143 <<
" version=\"0.1\"" 144 <<
" byte_order=\"" << byteOrder <<
"\">\n";
151 stream << indent <<
"</VTKFile>\n" 168 const std::string& vectors =
"") {
171 stream << indent <<
"<PointData";
172 if(scalars !=
"")
stream <<
" Scalars=\"" << scalars <<
"\"";
173 if(vectors !=
"")
stream <<
" Vectors=\"" << vectors <<
"\"";
186 stream << indent <<
"</PointData>\n";
206 const std::string& vectors =
"") {
209 stream << indent <<
"<CellData";
210 if(scalars !=
"")
stream <<
" Scalars=\"" << scalars <<
"\"";
211 if(vectors !=
"")
stream <<
" Vectors=\"" << vectors <<
"\"";
224 stream << indent <<
"</CellData>\n";
241 stream << indent <<
"<Points>\n";
253 stream << indent <<
"</Points>\n";
277 stream << indent <<
"<" << cellName <<
">\n";
289 stream << indent <<
"</" << cellName <<
">\n";
310 inline void beginMain(
unsigned ncells,
unsigned npoints) {
311 stream << indent <<
"<" << fileType <<
">\n";
313 stream << indent <<
"<Piece" 314 <<
" NumberOf" << cellName <<
"=\"" << ncells <<
"\"" 315 <<
" NumberOfPoints=\"" << npoints <<
"\">\n";
322 stream << indent <<
"</Piece>\n";
324 stream << indent <<
"</" << fileType <<
">\n";
349 stream << indent <<
"<AppendedData" 350 <<
" encoding=\"" << encoding <<
"\">\n";
363 stream << indent <<
"</AppendedData>\n";
382 unsigned ncomps,
unsigned nitems,
384 return factory.
make(name, ncomps, nitems, indent, prec);
394 #endif // DUNE_GRID_IO_FILE_VTK_VTUWRITER_HH 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: vtuwriter.hh:205
DataArrayWriter * make(const std::string &name, unsigned ncomps, unsigned nitems, const Indent &indent, Precision prec)
create a DataArrayWriter
Definition: dataarraywriter.hh:547
void endPoints()
finish section for the point coordinates
Definition: vtuwriter.hh:249
void endCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:285
const std::string & appendedEncoding() const
query encoding string for appended data
Definition: dataarraywriter.hh:516
void beginPoints()
start section for the point coordinates
Definition: vtuwriter.hh:238
Data array writers for the VTKWriter.
bool beginAppended()
signal start of the appended section
Definition: dataarraywriter.hh:503
std::ostream & stream
Definition: vtuwriter.hh:100
enum Dune::VTK::VTUWriter::Phase phase
void beginMain(unsigned ncells, unsigned npoints)
start the main PolyData/UnstructuredGrid section
Definition: vtuwriter.hh:310
void beginPointData(const std::string &scalars="", const std::string &vectors="")
start PointData section
Definition: vtuwriter.hh:167
FileType
which type of VTK file to write
Definition: common.hh:252
void beginCells()
start section for the grid cells/PolyData lines
Definition: vtuwriter.hh:274
base class for data array writers
Definition: dataarraywriter.hh:55
Definition: vtuwriter.hh:101
void endMain()
finish the main PolyData/UnstructuredGrid section
Definition: vtuwriter.hh:320
Include standard header files.
Definition: agrid.hh:59
bool beginAppended()
start the appended data section
Definition: vtuwriter.hh:345
a factory for DataArrayWriters
Definition: dataarraywriter.hh:468
~VTUWriter()
write footer
Definition: vtuwriter.hh:149
void endAppended()
finish the appended data section
Definition: vtuwriter.hh:359
DataArrayWriter * makeArrayWriter(const std::string &name, unsigned ncomps, unsigned nitems, Precision prec)
acquire a DataArrayWriter
Definition: vtuwriter.hh:381
Phase
Definition: vtuwriter.hh:101
std::string getEndiannessString()
determine endianness of this C++ implementation
Definition: common.hh:232
Definition: vtuwriter.hh:101
Common stuff for the VTKWriter.
Dump a .vtu/.vtp files contents to a stream.
Definition: vtuwriter.hh:98
Precision
which precision to use when writing out data to vtk files
Definition: common.hh:271
VTUWriter(std::ostream &stream_, OutputType outputType, FileType fileType_)
create a VTUWriter object
Definition: vtuwriter.hh:122
void endPointData()
finish PointData section
Definition: vtuwriter.hh:182
OutputType
How the bulk data should be stored in the file.
Definition: common.hh:43
void endCellData()
finish CellData section
Definition: vtuwriter.hh:220