------------------------------------------------------------------------------
| 453 | |
| 454 | //------------------------------------------------------------------------------ |
| 455 | int vtkXMLUnstructuredDataReader::ReadPieceData() |
| 456 | { |
| 457 | // The amount of data read by the superclass's ReadPieceData comes |
| 458 | // from point/cell data (we read point specifications here). |
| 459 | vtkIdType superclassPieceSize = |
| 460 | (this->NumberOfPointArrays * this->GetNumberOfPointsInPiece(this->Piece) + |
| 461 | this->NumberOfCellArrays * this->GetNumberOfCellsInPiece(this->Piece)); |
| 462 | |
| 463 | // Total amount of data in this piece comes from point/cell data |
| 464 | // arrays and the point specifications themselves. |
| 465 | vtkIdType totalPieceSize = superclassPieceSize + 1 * this->GetNumberOfPointsInPiece(this->Piece); |
| 466 | if (totalPieceSize == 0) |
| 467 | { |
| 468 | totalPieceSize = 1; |
| 469 | } |
| 470 | |
| 471 | // Split the progress range based on the approximate fraction of |
| 472 | // data that will be read by each step in this method. |
| 473 | float progressRange[2] = { 0, 0 }; |
| 474 | this->GetProgressRange(progressRange); |
| 475 | float fractions[3] = { 0, float(superclassPieceSize) / totalPieceSize, 1 }; |
| 476 | |
| 477 | // Set the range of progress for the superclass. |
| 478 | this->SetProgressRange(progressRange, 0, fractions); |
| 479 | |
| 480 | // Let the superclass read its data. |
| 481 | if (!this->Superclass::ReadPieceData()) |
| 482 | { |
| 483 | return 0; |
| 484 | } |
| 485 | |
| 486 | vtkPointSet* output = vtkPointSet::SafeDownCast(this->GetCurrentOutput()); |
| 487 | |
| 488 | // Set the range of progress for the Points. |
| 489 | this->SetProgressRange(progressRange, 1, fractions); |
| 490 | |
| 491 | // Read the points array. |
| 492 | vtkXMLDataElement* ePoints = this->PointElements[this->Piece]; |
| 493 | if (ePoints) |
| 494 | { |
| 495 | for (int i = 0; (i < ePoints->GetNumberOfNestedElements() && !this->AbortExecute); ++i) |
| 496 | { |
| 497 | vtkXMLDataElement* eNested = ePoints->GetNestedElement(i); |
| 498 | if (strcmp(eNested->GetName(), "DataArray") != 0 && strcmp(eNested->GetName(), "Array") != 0) |
| 499 | { |
| 500 | vtkErrorMacro("Invalid Array."); |
| 501 | this->DataError = 1; |
| 502 | return 0; |
| 503 | } |
| 504 | int needToRead = this->PointsNeedToReadTimeStep(eNested); |
| 505 | if (needToRead) |
| 506 | { |
| 507 | // Read the array. Test for abort before and after the read. Before |
| 508 | // so that we can skip the read, after to prevent unwanted error |
| 509 | // messages. |
| 510 | if (!this->AbortExecute && |
| 511 | !this->ReadArrayForPoints(eNested, output->GetPoints()->GetData()) && !this->AbortExecute) |
| 512 | { |
nothing calls this directly
no test coverage detected