MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteHeader

Method WriteHeader

IO/XML/vtkXMLUnstructuredDataWriter.cxx:274–363  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

272
273//------------------------------------------------------------------------------
274int vtkXMLUnstructuredDataWriter::WriteHeader()
275{
276 vtkIndent indent = vtkIndent().GetNextIndent();
277
278 ostream& os = *(this->Stream);
279
280 if (!this->WritePrimaryElement(os, indent))
281 {
282 return 0;
283 }
284
285 this->WriteFieldData(indent.GetNextIndent());
286
287 if (this->DataMode == vtkXMLWriter::Appended)
288 {
289 vtkIndent nextIndent = indent.GetNextIndent();
290
291 this->AllocatePositionArrays();
292
293 if ((this->WritePiece < 0) || (this->WritePiece >= this->NumberOfPieces))
294 {
295 // Loop over each piece and write its structure.
296 int i;
297 for (i = 0; i < this->NumberOfPieces; ++i)
298 {
299 // Open the piece's element.
300 os << nextIndent << "<Piece";
301 this->WriteAppendedPieceAttributes(i);
302 if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
303 {
304 this->DeletePositionArrays();
305 return 0;
306 }
307 os << ">\n";
308
309 this->WriteAppendedPiece(i, nextIndent.GetNextIndent());
310 if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
311 {
312 this->DeletePositionArrays();
313 return 0;
314 }
315
316 // Close the piece's element.
317 os << nextIndent << "</Piece>\n";
318 }
319 }
320 else
321 {
322 // Write just the requested piece.
323 // Open the piece's element.
324 os << nextIndent << "<Piece";
325 this->WriteAppendedPieceAttributes(this->WritePiece);
326 if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
327 {
328 this->DeletePositionArrays();
329 return 0;
330 }
331 os << ">\n";

Callers 1

ProcessRequestMethod · 0.95

Calls 11

DeletePositionArraysMethod · 0.95
WriteAppendedPieceMethod · 0.95
GetNextIndentMethod · 0.80
WritePrimaryElementMethod · 0.80
StartAppendedDataMethod · 0.80
vtkIndentClass · 0.50
WriteFieldDataMethod · 0.45
GetDataSetNameMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected