------------------------------------------------------------------------------
| 384 | |
| 385 | //------------------------------------------------------------------------------ |
| 386 | int vtkXMLCompositeDataReader::ShouldReadDataSet( |
| 387 | unsigned int idx, unsigned int pieceIndex /*=0*/, unsigned int numPieces /*=0*/) |
| 388 | { |
| 389 | // Apply the update restriction: |
| 390 | if (this->Internal->HasUpdateRestriction) |
| 391 | { |
| 392 | auto iter = this->Internal->UpdateIndices.find(idx); |
| 393 | if (iter == this->Internal->UpdateIndices.end()) |
| 394 | { |
| 395 | return 0; |
| 396 | } |
| 397 | |
| 398 | // Update the dataset index to its position in the update indices: |
| 399 | idx = std::distance(this->Internal->UpdateIndices.begin(), iter); |
| 400 | } |
| 401 | |
| 402 | unsigned int datasetIndex = idx; |
| 403 | unsigned int numDatasets = this->Internal->NumDataSets; |
| 404 | |
| 405 | if (pieceIndex < numPieces) |
| 406 | { |
| 407 | // This dataset is part of a vtkParititionedDataSet or a |
| 408 | // vtkMultiPieceDataset. Handle is differently. |
| 409 | datasetIndex = pieceIndex; |
| 410 | numDatasets = numPieces; |
| 411 | } |
| 412 | |
| 413 | int assignment = -1; |
| 414 | switch (this->PieceDistribution) |
| 415 | { |
| 416 | case vtkXMLCompositeDataReader::Block: |
| 417 | assignment = vtkXMLCompositeDataReader::GetPieceAssignmentForBlockStrategy( |
| 418 | datasetIndex, numDatasets, this->Internal->UpdateNumberOfPieces); |
| 419 | break; |
| 420 | |
| 421 | case vtkXMLCompositeDataReader::Interleave: |
| 422 | assignment = vtkXMLCompositeDataReader::GetPieceAssignmentForInterleaveStrategy( |
| 423 | datasetIndex, numDatasets, this->Internal->UpdateNumberOfPieces); |
| 424 | break; |
| 425 | |
| 426 | default: |
| 427 | vtkErrorMacro("Invalid PieceDistribution setting: " << this->PieceDistribution); |
| 428 | break; |
| 429 | } |
| 430 | |
| 431 | return (assignment == this->Internal->UpdatePiece) ? 1 : 0; |
| 432 | } |
| 433 | |
| 434 | //------------------------------------------------------------------------------ |
| 435 | int vtkXMLCompositeDataReader::GetPieceAssignmentForBlockStrategy( |
no test coverage detected