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

Method ReadPiece

IO/XML/vtkXMLUnstructuredDataReader.cxx:412–452  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

410
411//------------------------------------------------------------------------------
412int vtkXMLUnstructuredDataReader::ReadPiece(vtkXMLDataElement* ePiece)
413{
414 if (!this->Superclass::ReadPiece(ePiece))
415 {
416 return 0;
417 }
418
419 if (!ePiece->GetScalarAttribute("NumberOfPoints", this->NumberOfPoints[this->Piece]))
420 {
421 vtkErrorMacro("Piece " << this->Piece << " is missing its NumberOfPoints attribute.");
422 this->NumberOfPoints[this->Piece] = 0;
423 return 0;
424 }
425
426 // Find the Points element in the piece.
427 int i;
428 this->PointElements[this->Piece] = nullptr;
429 for (i = 0; i < ePiece->GetNumberOfNestedElements(); ++i)
430 {
431 vtkXMLDataElement* eNested = ePiece->GetNestedElement(i);
432 if (strcmp(eNested->GetName(), "Points") == 0)
433 {
434 // make sure the XML file is somehow valid:
435 if ((this->NumberOfTimeSteps > 0 && eNested->GetNumberOfNestedElements() >= 1) ||
436 (this->NumberOfTimeSteps == 0 && eNested->GetNumberOfNestedElements() == 1))
437 {
438 this->PointElements[this->Piece] = eNested;
439 }
440 }
441 }
442
443 // If there are some points, we require a Points element.
444 if (!this->PointElements[this->Piece] && (this->NumberOfPoints[this->Piece] > 0))
445 {
446 vtkErrorMacro("A piece is missing its Points element "
447 "or element does not have exactly 1 array.");
448 return 0;
449 }
450
451 return 1;
452}
453
454//------------------------------------------------------------------------------
455int vtkXMLUnstructuredDataReader::ReadPieceData()

Callers

nothing calls this directly

Calls 4

GetScalarAttributeMethod · 0.80
GetNestedElementMethod · 0.80
GetNameMethod · 0.45

Tested by

no test coverage detected