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

Method ReadXMLData

IO/XML/vtkXMLPTableReader.cxx:358–420  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

356
357//------------------------------------------------------------------------------
358void vtkXMLPTableReader::ReadXMLData()
359{
360 // Get the update request.
361 vtkInformation* outInfo = this->GetCurrentOutputInformation();
362 int piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
363 int numberOfPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES());
364
365 vtkDebugMacro("Updating piece " << piece << " of " << numberOfPieces);
366
367 // Setup the range of pieces that will be read.
368 this->SetupUpdateExtent(piece, numberOfPieces);
369
370 // If there are no data to read, stop now.
371 if (this->StartPiece == this->EndPiece)
372 {
373 return;
374 }
375
376 vtkDebugMacro(
377 "Reading piece range [" << this->StartPiece << ", " << this->EndPiece << ") from file.");
378
379 // Let superclasses read data. This also allocates output data.
380 this->Superclass::ReadXMLData();
381
382 // Split current progress range based on fraction contributed by
383 // each piece.
384 float progressRange[2] = { 0.f, 0.f };
385 this->GetProgressRange(progressRange);
386
387 // Calculate the cumulative fraction of data contributed by each
388 // piece (for progress).
389 std::vector<float> fractions(this->EndPiece - this->StartPiece + 1);
390 fractions[0] = 0;
391 for (int i = this->StartPiece; i < this->EndPiece; ++i)
392 {
393 int index = i - this->StartPiece;
394 fractions[index + 1] = (fractions[index] + this->GetNumberOfRowsInPiece(i));
395 }
396 if (fractions[this->EndPiece - this->StartPiece] == 0)
397 {
398 fractions[this->EndPiece - this->StartPiece] = 1;
399 }
400 for (int i = this->StartPiece; i < this->EndPiece; ++i)
401 {
402 int index = i - this->StartPiece;
403 fractions[index + 1] = fractions[index + 1] / fractions[this->EndPiece - this->StartPiece];
404 }
405
406 // Read the data needed from each piece.
407 for (int i = this->StartPiece; (i < this->EndPiece && !this->AbortExecute && !this->DataError);
408 ++i)
409 {
410 // Set the range of progress for this piece.
411 this->SetProgressRange(progressRange, i - this->StartPiece, fractions.data());
412
413 if (!this->ReadPieceData(i))
414 {
415 // An error occurred while reading the piece.

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected