41const std::string WbWriterVtkXmlImageBinary::pvdEndTag =
" </Collection>\n</VTKFile>";
44 const double &timeStep,
const bool &
sepGroups)
51 if (path.size() > 0) {
64 out <<
"<VTKFile type=\"Collection\" version=\"0.1\" byte_order=\"" <<
endian <<
"\" >" <<
endl;
67 int group = 0, part = 0;
69 out <<
" <DataSet timestep=\"" << timeStep <<
"\" group=\"" <<
group <<
"\" part=\"" << part
83 const double &timeStep,
const bool &
sepGroups)
96 out.seekp(-(
int)pvdEndTag.size() - 1, ios_base::end);
100 out <<
" <DataSet timestep=\"" << timeStep <<
"\" group=\"" <<
group <<
"\" part=\"" <<
i <<
"\" file=\""
122 if (path.size() > 0) {
131 out <<
"<VTKFile type=\"PImageData\" version=\"0.1\" byte_order=\"LittleEndian\">"
133 out <<
" <PImageData "
140 <<
"GhostLevel=\"0\" "
141 <<
"Origin=\"" <<
val<1>(origin) <<
" "
143 <<
val<3>(origin) <<
"\" "
144 <<
"Spacing=\"" <<
val<1>(spacing) <<
" "
146 <<
val<3>(spacing) <<
"\" "
148 out <<
" <PPointData>\n";
151 out <<
" </PPointData>\n";
152 if (cellDataNames.size() > 0) {
153 out <<
" <PCellData>\n";
154 for (
size_t s = 0;
s < cellDataNames.size();
s++)
155 out <<
" <PDataArray type=\"Float32\" Name=\"" << cellDataNames[
s] <<
"\"/>\n";
156 out <<
" </PCellData>\n";
165 out <<
" </PImageData>\n";
187 getMetaDataOfImage(nodes, origin, spacing, extent);
208 getMetaDataOfImage(nodes, origin, spacing, extent);
210 this->
writeData(vtkfilename, datanames, cellDataNames,
nodedata, cellData, extent, origin, spacing, extent);
229 getMetaDataOfImage(nodes, origin, spacing, extent);
230 this->
writeData(vtkfilename, datanames, cellDataNames,
nodedata, cellData, extent, origin, spacing, extent);
262 unsigned int precision)
265 out.precision(precision);
270 if (path.size() > 0) {
287 out <<
"<?xml version=\"1.0\"?>\n";
288 out <<
"<VTKFile type=\"ImageData\" version=\"0.1\" byte_order=\"LittleEndian\" >"
290 out <<
" <ImageData "
297 <<
"Origin=\"" <<
val<1>(origin) <<
" "
299 <<
val<3>(origin) <<
"\" "
300 <<
"Spacing=\"" <<
val<1>(spacing) <<
" "
302 <<
val<3>(spacing) <<
"\""
304 out <<
" <Piece Extent=\"" <<
val<1>(extent) <<
" "
309 <<
val<6>(extent) <<
"\">\n";
313 out <<
" <PointData>\n";
316 <<
"\" format=\"appended\" offset=\"" << offset <<
"\" /> \n";
319 out <<
" </PointData>\n";
322 if (cellDataNames.size() > 0) {
323 out <<
" <CellData>\n";
324 for (
size_t s = 0;
s < cellDataNames.size(); ++
s) {
325 out <<
" <DataArray type=\"Float64\" Name=\"" << cellDataNames[
s]
326 <<
"\" format=\"appended\" offset=\"" << offset <<
"\" /> \n";
329 out <<
" </CellData>\n";
332 out <<
" </Piece>\n";
333 out <<
" </ImageData>\n";
336 out <<
" <AppendedData encoding=\"raw\">\n";
343 for (
size_t d = 0; d <
nodedata[
s].size(); ++d) {
350 for (
size_t s = 0;
s < cellDataNames.size(); ++
s) {
352 for (
size_t d = 0; d <
celldata[
s].size(); ++d) {
357 out <<
"\n </AppendedData>\n";
std::string getFileExtension() override
std::shared_ptr< T > SPtr
#define UBLOG(level, logtext)
std::string addFilesToCollection(const std::string &filename, const std::vector< std::string > &filenames, const double ×tep, const bool &sepGroups)
void writeData(const std::string &vtkfilename, std::vector< std::string > &pointDataNames, std::vector< std::string > &cellDataNames, std::vector< std::vector< double > > &nodedata, std::vector< std::vector< double > > &celldata, UbTupleInt6 &wholeExtent, UbTupleFloat3 &origin, UbTupleFloat3 &spacing, UbTupleInt6 &extent, unsigned int precision=6)
std::string writeCollection(const std::string &filename, const std::vector< std::string > &filenames, const double ×tep, const bool &sepGroups)
std::string writeOctsWithNodeData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleUInt8 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &nodedata) override
std::string writeNodesWithNodeData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< std::string > &datanames, std::vector< std::vector< double > > &nodedata) override
std::string writeParallelFile(const std::string &filename, const UbTupleInt6 &wholeExtent, const UbTupleFloat3 &origin, const UbTupleFloat3 &spacing, std::vector< std::string > &pieceSources, std::vector< UbTupleInt6 > &pieceExtents, std::vector< std::string > &pointDataNames, std::vector< std::string > &cellDataNames)
std::string writeOctsWithCellData(const std::string &filename, std::vector< UbTupleFloat3 > &nodes, std::vector< UbTupleInt8 > &cells, std::vector< std::string > &datanames, std::vector< std::vector< double > > &celldata) override
bool makeDirectory(const std::string &dir)
std::string getPathFromString(const std::string &fileStringWithPath)