------------------------------------------------------------------------------
| 213 | |
| 214 | //------------------------------------------------------------------------------ |
| 215 | void vtkXMLUnstructuredDataReader::ReadXMLData() |
| 216 | { |
| 217 | // Get the update request. |
| 218 | int piece; |
| 219 | int numberOfPieces; |
| 220 | int ghostLevel; |
| 221 | vtkInformation* outInfo = this->GetCurrentOutputInformation(); |
| 222 | piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()); |
| 223 | numberOfPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES()); |
| 224 | ghostLevel = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS()); |
| 225 | |
| 226 | vtkDebugMacro( |
| 227 | "Updating piece " << piece << " of " << numberOfPieces << " with ghost level " << ghostLevel); |
| 228 | |
| 229 | // Setup the range of pieces that will be read. |
| 230 | this->SetupUpdateExtent(piece, numberOfPieces, ghostLevel); |
| 231 | |
| 232 | // If there are no data to read, stop now. |
| 233 | if (this->StartPiece == this->EndPiece) |
| 234 | { |
| 235 | return; |
| 236 | } |
| 237 | |
| 238 | vtkDebugMacro( |
| 239 | "Reading piece range [" << this->StartPiece << ", " << this->EndPiece << ") from file."); |
| 240 | |
| 241 | // Let superclasses read data. This also allocates output data. |
| 242 | this->Superclass::ReadXMLData(); |
| 243 | |
| 244 | // Split current progress range based on fraction contributed by |
| 245 | // each piece. |
| 246 | float progressRange[2] = { 0, 0 }; |
| 247 | this->GetProgressRange(progressRange); |
| 248 | |
| 249 | // Calculate the cumulative fraction of data contributed by each |
| 250 | // piece (for progress). |
| 251 | float* fractions = new float[this->EndPiece - this->StartPiece + 1]; |
| 252 | int i; |
| 253 | fractions[0] = 0; |
| 254 | for (i = this->StartPiece; i < this->EndPiece; ++i) |
| 255 | { |
| 256 | int index = i - this->StartPiece; |
| 257 | fractions[index + 1] = |
| 258 | (fractions[index] + this->GetNumberOfPointsInPiece(i) + this->GetNumberOfCellsInPiece(i)); |
| 259 | } |
| 260 | if (fractions[this->EndPiece - this->StartPiece] == 0) |
| 261 | { |
| 262 | fractions[this->EndPiece - this->StartPiece] = 1; |
| 263 | } |
| 264 | for (i = this->StartPiece; i < this->EndPiece; ++i) |
| 265 | { |
| 266 | int index = i - this->StartPiece; |
| 267 | fractions[index + 1] = fractions[index + 1] / fractions[this->EndPiece - this->StartPiece]; |
| 268 | } |
| 269 | |
| 270 | // Read the data needed from each piece. |
| 271 | for (i = this->StartPiece; (i < this->EndPiece && !this->AbortExecute && !this->DataError); ++i) |
| 272 | { |
nothing calls this directly
no test coverage detected