------------------------------------------------------------------------------
| 116 | |
| 117 | //------------------------------------------------------------------------------ |
| 118 | void vtkXMLTableReader::ReadXMLData() |
| 119 | { |
| 120 | // Get the update request. |
| 121 | vtkInformation* outInfo = this->GetCurrentOutputInformation(); |
| 122 | int piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()); |
| 123 | int numberOfPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES()); |
| 124 | |
| 125 | vtkDebugMacro("Updating piece " << piece << " of " << numberOfPieces); |
| 126 | |
| 127 | // Setup the range of pieces that will be read. |
| 128 | this->SetupUpdateExtent(piece, numberOfPieces); |
| 129 | |
| 130 | // If there are no data to read, stop now. |
| 131 | if (this->StartPiece == this->EndPiece) |
| 132 | { |
| 133 | return; |
| 134 | } |
| 135 | |
| 136 | vtkDebugMacro( |
| 137 | "Reading piece range [" << this->StartPiece << ", " << this->EndPiece << ") from file."); |
| 138 | |
| 139 | // Let superclasses read data. This also allocates output data. |
| 140 | this->Superclass::ReadXMLData(); |
| 141 | |
| 142 | this->ReadFieldData(); |
| 143 | |
| 144 | // Split current progress range based on fraction contributed by |
| 145 | // each piece. |
| 146 | float progressRange[2] = { 0, 0 }; |
| 147 | this->GetProgressRange(progressRange); |
| 148 | |
| 149 | // Calculate the cumulative fraction of data contributed by each |
| 150 | // piece (for progress). |
| 151 | std::vector<float> fractions(this->EndPiece - this->StartPiece + 1); |
| 152 | fractions[0] = 0; |
| 153 | |
| 154 | for (int currentIndex = this->StartPiece; currentIndex < this->EndPiece; ++currentIndex) |
| 155 | { |
| 156 | int index = currentIndex - this->StartPiece; |
| 157 | fractions[index + 1] = fractions[index]; |
| 158 | } |
| 159 | if (fractions[this->EndPiece - this->StartPiece] == 0) |
| 160 | { |
| 161 | fractions[this->EndPiece - this->StartPiece] = 1; |
| 162 | } |
| 163 | for (int currentIndex = this->StartPiece; currentIndex < this->EndPiece; ++currentIndex) |
| 164 | { |
| 165 | int index = currentIndex - this->StartPiece; |
| 166 | fractions[index + 1] = fractions[index + 1] / fractions[this->EndPiece - this->StartPiece]; |
| 167 | } |
| 168 | |
| 169 | // Read the data needed from each piece. |
| 170 | for (int currentIndex = this->StartPiece; |
| 171 | (currentIndex < this->EndPiece && !this->AbortExecute && !this->DataError); ++currentIndex) |
| 172 | { |
| 173 | // Set the range of progress for this piece. |
| 174 | this->SetProgressRange(progressRange, currentIndex - this->StartPiece, fractions.data()); |
| 175 |
nothing calls this directly
no test coverage detected