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

Method ReadPieceData

IO/XML/vtkXMLPolyDataReader.cxx:261–386  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

259
260//------------------------------------------------------------------------------
261int vtkXMLPolyDataReader::ReadPieceData()
262{
263 // The amount of data read by the superclass's ReadPieceData comes
264 // from point/cell data and point specifications (we read cell
265 // specifications here).
266 vtkIdType superclassPieceSize =
267 ((this->NumberOfPointArrays + 1) * this->GetNumberOfPointsInPiece(this->Piece) +
268 this->NumberOfCellArrays * this->GetNumberOfCellsInPiece(this->Piece));
269
270 // Total amount of data in this piece comes from point/cell data
271 // arrays and the point/cell specifications themselves (cell
272 // specifications for vtkPolyData take two data arrays split across
273 // cell types).
274 vtkIdType totalPieceSize = superclassPieceSize + 2 * this->GetNumberOfCellsInPiece(this->Piece);
275 if (totalPieceSize == 0)
276 {
277 totalPieceSize = 1;
278 }
279
280 // Split the progress range based on the approximate fraction of
281 // data that will be read by each step in this method.
282 float progressRange[2] = { 0.f, 0.f };
283 this->GetProgressRange(progressRange);
284 float fractions[6] = { 0, static_cast<float>(superclassPieceSize) / totalPieceSize,
285 (static_cast<float>(superclassPieceSize) + this->NumberOfVerts[this->Piece]) / totalPieceSize,
286 (static_cast<float>(superclassPieceSize) + this->NumberOfVerts[this->Piece] +
287 this->NumberOfLines[this->Piece]) /
288 totalPieceSize,
289 (static_cast<float>(superclassPieceSize) + this->NumberOfVerts[this->Piece] +
290 this->NumberOfLines[this->Piece] + this->NumberOfStrips[this->Piece]) /
291 totalPieceSize,
292 1 };
293
294 // Set the range of progress for the superclass.
295 this->SetProgressRange(progressRange, 0, fractions);
296
297 // Let the superclass read its data.
298 if (!this->Superclass::ReadPieceData())
299 {
300 return 0;
301 }
302
303 vtkPolyData* output = vtkPolyData::SafeDownCast(this->GetCurrentOutput());
304
305 // Set the range of progress for the Verts.
306 this->SetProgressRange(progressRange, 1, fractions);
307
308 // Read the Verts.
309 vtkXMLDataElement* eVerts = this->VertElements[this->Piece];
310 if (eVerts)
311 {
312 // int needToRead = this->CellsNeedToReadTimeStep(eNested,
313 // this->VertsTimeStep, this->VertsOffset);
314 // if (needToRead)
315 {
316 // Read the array.
317 if (!this->ReadCellArray(
318 this->NumberOfVerts[this->Piece], this->TotalNumberOfVerts, eVerts, output->GetVerts()))

Callers

nothing calls this directly

Calls 10

GetCurrentOutputMethod · 0.80
ReadCellArrayMethod · 0.80
GetVertsMethod · 0.80
GetStripsMethod · 0.80
GetPolysMethod · 0.80
GetProgressRangeMethod · 0.45
SetProgressRangeMethod · 0.45
GetLinesMethod · 0.45

Tested by

no test coverage detected