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

Method ReadXMLData

IO/XML/vtkXMLPUnstructuredDataReader.cxx:241–308  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

239
240//------------------------------------------------------------------------------
241void vtkXMLPUnstructuredDataReader::ReadXMLData()
242{
243 // Get the update request.
244 vtkInformation* outInfo = this->GetCurrentOutputInformation();
245 int piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
246 int numberOfPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());
247 int ghostLevel = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS());
248
249 vtkDebugMacro(
250 "Updating piece " << piece << " of " << numberOfPieces << " with ghost level " << ghostLevel);
251
252 // Setup the range of pieces that will be read.
253 this->SetupUpdateExtent(piece, numberOfPieces, ghostLevel);
254
255 // If there are no data to read, stop now.
256 if (this->StartPiece == this->EndPiece)
257 {
258 return;
259 }
260
261 vtkDebugMacro(
262 "Reading piece range [" << this->StartPiece << ", " << this->EndPiece << ") from file.");
263
264 // Let superclasses read data. This also allocates output data.
265 this->Superclass::ReadXMLData();
266
267 // Split current progress range based on fraction contributed by
268 // each piece.
269 float progressRange[2] = { 0.f, 0.f };
270 this->GetProgressRange(progressRange);
271
272 // Calculate the cumulative fraction of data contributed by each
273 // piece (for progress).
274 float* fractions = new float[this->EndPiece - this->StartPiece + 1];
275 fractions[0] = 0;
276 for (int i = this->StartPiece; i < this->EndPiece; ++i)
277 {
278 int index = i - this->StartPiece;
279 fractions[index + 1] =
280 (fractions[index] + this->GetNumberOfPointsInPiece(i) + this->GetNumberOfCellsInPiece(i));
281 }
282 if (fractions[this->EndPiece - this->StartPiece] == 0)
283 {
284 fractions[this->EndPiece - this->StartPiece] = 1;
285 }
286 for (int i = this->StartPiece; i < this->EndPiece; ++i)
287 {
288 int index = i - this->StartPiece;
289 fractions[index + 1] = fractions[index + 1] / fractions[this->EndPiece - this->StartPiece];
290 }
291
292 // Read the data needed from each piece.
293 for (int i = this->StartPiece; (i < this->EndPiece && !this->AbortExecute && !this->DataError);
294 ++i)
295 {
296 // Set the range of progress for this piece.
297 this->SetProgressRange(progressRange, i - this->StartPiece, fractions);
298

Callers

nothing calls this directly

Calls 8

SetupUpdateExtentMethod · 0.95
SetupNextPieceMethod · 0.95
GetMethod · 0.45
GetProgressRangeMethod · 0.45
SetProgressRangeMethod · 0.45

Tested by

no test coverage detected