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

Method WriteHeader

IO/XML/vtkXMLStructuredDataWriter.cxx:265–346  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

263
264//------------------------------------------------------------------------------
265int vtkXMLStructuredDataWriter::WriteHeader()
266{
267 vtkIndent indent = vtkIndent().GetNextIndent();
268
269 ostream& os = *(this->Stream);
270
271 if (!this->WritePrimaryElement(os, indent))
272 {
273 return 0;
274 }
275
276 this->WriteFieldData(indent.GetNextIndent());
277
278 if (this->DataMode == vtkXMLWriter::Appended)
279 {
280 int begin = this->WritePiece;
281 int end = this->WritePiece + 1;
282 if (this->WritePiece < 0)
283 {
284 begin = 0;
285 end = this->NumberOfPieces;
286 }
287 vtkIndent nextIndent = indent.GetNextIndent();
288
289 this->AllocatePositionArrays();
290
291 // Loop over each piece and write its structure.
292 for (int i = begin; i < end; ++i)
293 {
294 // Update the piece's extent.
295
296 os << nextIndent << "<Piece";
297 // We allocate 66 characters because that is as big as 6 integers
298 // with spaces can get.
299 this->ExtentPositions[i] = this->ReserveAttributeSpace("Extent", 66);
300 os << ">\n";
301
302 if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
303 {
304 this->DeletePositionArrays();
305 return 0;
306 }
307
308 this->WriteAppendedPiece(i, nextIndent.GetNextIndent());
309
310 if (this->ErrorCode == vtkErrorCode::OutOfDiskSpaceError)
311 {
312 this->DeletePositionArrays();
313 return 0;
314 }
315 // Close the piece's element.
316 os << nextIndent << "</Piece>\n";
317 }
318
319 // Close the primary element.
320 os << indent << "</" << this->GetDataSetName() << ">\n";
321
322 os.flush();

Callers 1

ProcessRequestMethod · 0.95

Calls 13

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

Tested by

no test coverage detected