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

Method SetupOutputData

IO/XML/vtkXMLUnstructuredDataReader.cxx:371–409  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

369
370//------------------------------------------------------------------------------
371void vtkXMLUnstructuredDataReader::SetupOutputData()
372{
373 this->Superclass::SetupOutputData();
374
375 // Create the points array.
376 vtkPoints* points = vtkPoints::New();
377
378 // Use the configuration of the first piece since all are the same.
379 vtkXMLDataElement* ePoints = this->PointElements[0];
380 if (ePoints)
381 {
382 // Non-zero volume.
383 vtkAbstractArray* aa = this->CreateArray(ePoints->GetNestedElement(0));
384 vtkDataArray* a = vtkArrayDownCast<vtkDataArray>(aa);
385 if (a)
386 {
387 // Allocate the points array.
388 a->SetNumberOfTuples(this->GetNumberOfPoints());
389 points->SetData(a);
390 a->Delete();
391 }
392 else
393 {
394 if (aa)
395 {
396 aa->Delete();
397 }
398 this->DataError = 1;
399 }
400 }
401 else if (this->NumberOfPoints[0] > 0)
402 {
403 vtkWarningMacro(
404 "No Points element available in first piece found in file. Reading file may fail.");
405 }
406
407 vtkPointSet::SafeDownCast(this->GetCurrentOutput())->SetPoints(points);
408 points->Delete();
409}
410
411//------------------------------------------------------------------------------
412int vtkXMLUnstructuredDataReader::ReadPiece(vtkXMLDataElement* ePiece)

Callers

nothing calls this directly

Calls 9

GetNumberOfPointsMethod · 0.95
GetNestedElementMethod · 0.80
GetCurrentOutputMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
CreateArrayMethod · 0.45
SetNumberOfTuplesMethod · 0.45
SetDataMethod · 0.45
SetPointsMethod · 0.45

Tested by

no test coverage detected