------------------------------------------------------------------------------ Structured data is trickier. Which files to load?
| 966 | //------------------------------------------------------------------------------ |
| 967 | // Structured data is trickier. Which files to load? |
| 968 | int vtkPDataSetReader::StructuredGridExecute( |
| 969 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 970 | { |
| 971 | vtkInformation* info = outputVector->GetInformationObject(0); |
| 972 | vtkStructuredGrid* output = |
| 973 | vtkStructuredGrid::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT())); |
| 974 | |
| 975 | vtkStructuredGrid* tmp; |
| 976 | int count = 0; |
| 977 | vtkStructuredGridReader* reader; |
| 978 | vtkPoints* newPts; |
| 979 | int uExt[6]; |
| 980 | int ext[6]; |
| 981 | int i; |
| 982 | int pIncY, pIncZ, cIncY, cIncZ; |
| 983 | int ix, iy, iz; |
| 984 | double* pt; |
| 985 | vtkIdType inId, outId; |
| 986 | vtkIdType numPts, numCells; |
| 987 | |
| 988 | // Get the pieces that will be read. |
| 989 | std::vector<int> pieceMask(this->NumberOfPieces, 0); |
| 990 | int wUExt[6]; |
| 991 | info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), wUExt); |
| 992 | vtkNew<vtkExtentTranslator> et; |
| 993 | et->SetWholeExtent(wUExt); |
| 994 | et->SetPiece(info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER())); |
| 995 | et->SetNumberOfPieces(info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES())); |
| 996 | int ghostLevels = info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS()); |
| 997 | et->SetGhostLevel(ghostLevels); |
| 998 | et->PieceToExtent(); |
| 999 | et->GetExtent(uExt); |
| 1000 | this->CoverExtent(uExt, pieceMask.data()); |
| 1001 | |
| 1002 | // Now read the pieces. |
| 1003 | std::vector<vtkSmartPointer<vtkStructuredGrid>> pieces; |
| 1004 | reader = vtkStructuredGridReader::New(); |
| 1005 | reader->ReadAllScalarsOn(); |
| 1006 | reader->ReadAllVectorsOn(); |
| 1007 | reader->ReadAllNormalsOn(); |
| 1008 | reader->ReadAllTensorsOn(); |
| 1009 | reader->ReadAllColorScalarsOn(); |
| 1010 | reader->ReadAllTCoordsOn(); |
| 1011 | reader->ReadAllFieldsOn(); |
| 1012 | for (i = 0; i < this->NumberOfPieces; ++i) |
| 1013 | { |
| 1014 | if (pieceMask[i]) |
| 1015 | { |
| 1016 | reader->SetOutput(nullptr); |
| 1017 | reader->SetFileName(this->PieceFileNames[i]); |
| 1018 | reader->Update(); |
| 1019 | tmp = reader->GetOutput(); |
| 1020 | if (tmp->GetNumberOfCells() > 0) |
| 1021 | { |
| 1022 | pieces.emplace_back(tmp); |
| 1023 | // Sanity check: extent is correct. Ignore electric slide. |
| 1024 | tmp->GetExtent(ext); |
| 1025 | if (ext[1] - ext[0] != this->PieceExtents[i][1] - this->PieceExtents[i][0] || |
no test coverage detected