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

Method ProcessTrees

Filters/HyperTree/vtkHyperTreeGridGeometry.cxx:43–106  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

41
42//------------------------------------------------------------------------------
43int vtkHyperTreeGridGeometry::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO)
44{
45 // Downcast output data object to polygonal data set
46 vtkPolyData* output = vtkPolyData::SafeDownCast(outputDO);
47 if (!output)
48 {
49 vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName());
50 return 0;
51 }
52
53 // Retrieve useful grid parameters for speed of access
54 unsigned int dimension = input->GetDimension();
55
56 // Initialize output cell data
57 this->InData = input->GetCellData();
58 this->OutData = output->GetCellData();
59 this->OutData->CopyAllOn(); // Should be set before CopyAllocate to be taken into account
60 this->OutData->CopyAllocate(this->InData);
61
62 vtkNew<vtkPoints> outPoints;
63 vtkNew<vtkCellArray> outCells;
64
65 std::unique_ptr<vtkHyperTreeGridGeometryImpl> implementation;
66
67 // Create a custom internal class depending on the dimension of the input HTG.
68 switch (dimension)
69 {
70 case 1:
71 implementation = std::unique_ptr<vtkHyperTreeGridGeometry1DImpl>(
72 new vtkHyperTreeGridGeometry1DImpl(input, outPoints, outCells, this->InData, this->OutData,
73 this->PassThroughCellIds, this->OriginalCellIdArrayName, this->FillMaterial));
74 break;
75 case 2:
76 implementation = std::unique_ptr<vtkHyperTreeGridGeometry2DImpl>(
77 new vtkHyperTreeGridGeometry2DImpl(input, outPoints, outCells, this->InData, this->OutData,
78 this->PassThroughCellIds, this->OriginalCellIdArrayName, this->FillMaterial));
79 break;
80 case 3:
81 implementation =
82 std::unique_ptr<vtkHyperTreeGridGeometry3DImpl>(new vtkHyperTreeGridGeometry3DImpl(
83 this->Merging, input, outPoints, outCells, this->InData, this->OutData,
84 this->PassThroughCellIds, this->OriginalCellIdArrayName, this->FillMaterial));
85 break;
86 default:
87 vtkErrorMacro("Incorrect dimension of input: " << dimension);
88 return 0;
89 } // switch ( dimension )
90
91 // Execute
92 implementation->GenerateGeometry();
93
94 // Set output geometry and topology
95 output->SetPoints(outPoints);
96 if (dimension == 1 || !this->FillMaterial)
97 {
98 output->SetLines(outCells);
99 }
100 else

Callers

nothing calls this directly

Calls 9

SetLinesMethod · 0.80
SetPolysMethod · 0.80
GetClassNameMethod · 0.45
GetDimensionMethod · 0.45
GetCellDataMethod · 0.45
CopyAllOnMethod · 0.45
CopyAllocateMethod · 0.45
GenerateGeometryMethod · 0.45
SetPointsMethod · 0.45

Tested by

no test coverage detected