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

Method ReadPieceData

IO/XML/vtkXMLStructuredGridReader.cxx:149–194  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

147
148//------------------------------------------------------------------------------
149int vtkXMLStructuredGridReader::ReadPieceData()
150{
151 // The amount of data read by the superclass's ReadPieceData comes
152 // from point/cell data (we read point specifications here).
153 int dims[3] = { 0, 0, 0 };
154 this->ComputePointDimensions(this->SubExtent, dims);
155 vtkIdType superclassPieceSize = (this->NumberOfPointArrays * dims[0] * dims[1] * dims[2] +
156 this->NumberOfCellArrays * (dims[0] - 1) * (dims[1] - 1) * (dims[2] - 1));
157
158 // Total amount of data in this piece comes from point/cell data
159 // arrays and the point specifications themselves.
160 vtkIdType totalPieceSize = superclassPieceSize + dims[0] * dims[1] * dims[2];
161 if (totalPieceSize == 0)
162 {
163 totalPieceSize = 1;
164 }
165
166 // Split the progress range based on the approximate fraction of
167 // data that will be read by each step in this method.
168 float progressRange[2] = { 0, 0 };
169 this->GetProgressRange(progressRange);
170 float fractions[3] = { 0, float(superclassPieceSize) / totalPieceSize, 1 };
171
172 // Set the range of progress for the superclass.
173 this->SetProgressRange(progressRange, 0, fractions);
174
175 // Let the superclass read its data.
176 if (!this->Superclass::ReadPieceData())
177 {
178 return 0;
179 }
180
181 if (!this->PointElements[this->Piece])
182 {
183 // Empty volume.
184 return 1;
185 }
186
187 // Set the range of progress for the points array.
188 this->SetProgressRange(progressRange, 1, fractions);
189
190 // Read the points array.
191 vtkStructuredGrid* output = vtkStructuredGrid::SafeDownCast(this->GetCurrentOutput());
192 vtkXMLDataElement* ePoints = this->PointElements[this->Piece];
193 return this->ReadArrayForPoints(ePoints->GetNestedElement(0), output->GetPoints()->GetData());
194}
195
196int vtkXMLStructuredGridReader::FillOutputPortInformation(int, vtkInformation* info)
197{

Callers

nothing calls this directly

Calls 8

GetCurrentOutputMethod · 0.80
GetNestedElementMethod · 0.80
GetProgressRangeMethod · 0.45
SetProgressRangeMethod · 0.45
ReadArrayForPointsMethod · 0.45
GetDataMethod · 0.45
GetPointsMethod · 0.45

Tested by

no test coverage detected