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

Method ReadXMLData

IO/XML/vtkXMLTableReader.cxx:118–183  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

116
117//------------------------------------------------------------------------------
118void 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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected