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

Method StructuredExecute

Filters/General/vtkDataSetTriangleFilter.cxx:65–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void vtkDataSetTriangleFilter::StructuredExecute(vtkDataSet* input, vtkUnstructuredGrid* output)
66{
67 int dimensions[3], i, j, k, l, m;
68 vtkIdType newCellId, inId;
69 vtkCellData* inCD = input->GetCellData();
70 vtkCellData* outCD = output->GetCellData();
71 vtkPoints* newPoints = vtkPoints::New();
72 vtkIdList* cellPtIds = vtkIdList::New();
73 int numSimplices, numPts, dim, type;
74 vtkIdType pts[4], num;
75
76 // Create an array of points. This does an explicit creation
77 // of each point.
78 num = input->GetNumberOfPoints();
79 newPoints->SetNumberOfPoints(num);
80 for (i = 0; i < num; ++i)
81 {
82 newPoints->SetPoint(i, input->GetPoint(i));
83 }
84
85 outCD->CopyAllocate(inCD, input->GetNumberOfCells() * 5);
86 output->Allocate(input->GetNumberOfCells() * 5);
87
88 if (input->IsA("vtkStructuredPoints"))
89 {
90 static_cast<vtkStructuredPoints*>(input)->GetDimensions(dimensions);
91 }
92 else if (input->IsA("vtkStructuredGrid"))
93 {
94 static_cast<vtkStructuredGrid*>(input)->GetDimensions(dimensions);
95 }
96 else if (input->IsA("vtkImageData"))
97 {
98 static_cast<vtkImageData*>(input)->GetDimensions(dimensions);
99 }
100 else if (input->IsA("vtkRectilinearGrid"))
101 {
102 static_cast<vtkRectilinearGrid*>(input)->GetDimensions(dimensions);
103 }
104 else
105 {
106 // Every kind of structured data is listed above, this should never happen.
107 // Report an error and produce no output.
108 vtkErrorMacro("Unrecognized data set " << input->GetClassName());
109 // Dimensions of 1x1x1 means a single point, i.e. dimensionality of zero.
110 dimensions[0] = 1;
111 dimensions[1] = 1;
112 dimensions[2] = 1;
113 }
114
115 dimensions[0] = dimensions[0] - 1;
116 dimensions[1] = dimensions[1] - 1;
117 dimensions[2] = dimensions[2] - 1;
118
119 vtkIdType numSlices = (dimensions[2] > 0 ? dimensions[2] : 1);
120 bool abort = false;
121 for (k = 0; k < numSlices && !abort; k++)
122 {

Callers 1

RequestDataMethod · 0.95

Calls 15

IsAMethod · 0.80
CheckAbortMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetCellDataMethod · 0.45
GetNumberOfPointsMethod · 0.45
SetNumberOfPointsMethod · 0.45
SetPointMethod · 0.45
GetPointMethod · 0.45
CopyAllocateMethod · 0.45
GetNumberOfCellsMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected