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

Method ExtractSurface

Filters/Geometry/vtkExplicitStructuredGridSurfaceFilter.cxx:102–247  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

100
101//------------------------------------------------------------------------------
102int vtkExplicitStructuredGridSurfaceFilter::ExtractSurface(
103 vtkExplicitStructuredGrid* input, vtkPolyData* output)
104{
105 vtkIdType numPts = input->GetNumberOfPoints();
106 vtkIdType numCells = input->GetNumberOfCells();
107
108 if (numCells == 0)
109 {
110 return 1;
111 }
112
113 vtkDebugMacro(<< "Executing explicit structured grid surface filter");
114
115 vtkPointData* pd = input->GetPointData();
116 vtkCellData* cd = input->GetCellData();
117 vtkPointData* outputPD = output->GetPointData();
118 vtkCellData* outputCD = output->GetCellData();
119
120 vtkNew<vtkIdTypeArray> originalCellIds;
121 if (this->PassThroughCellIds)
122 {
123 originalCellIds->SetName(this->GetOriginalCellIdsName());
124 originalCellIds->SetNumberOfComponents(1);
125 originalCellIds->Allocate(numCells);
126 outputCD->AddArray(originalCellIds.GetPointer());
127 }
128 vtkNew<vtkIdTypeArray> originalPointIds;
129 if (this->PassThroughPointIds)
130 {
131 originalPointIds->SetName(this->GetOriginalPointIdsName());
132 originalPointIds->SetNumberOfComponents(1);
133 originalPointIds->Allocate(numPts);
134 outputPD->AddArray(originalPointIds.GetPointer());
135 }
136
137 vtkNew<vtkIdList> cellIds;
138 vtkUnsignedCharArray* connectivityFlags = nullptr;
139
140 const char* facesConnectivityFlagsArrayName = input->GetFacesConnectivityFlagsArrayName();
141 if (facesConnectivityFlagsArrayName)
142 {
143 connectivityFlags = vtkUnsignedCharArray::SafeDownCast(
144 input->GetCellData()->GetAbstractArray(facesConnectivityFlagsArrayName));
145 }
146 if (!connectivityFlags)
147 {
148 vtkErrorMacro("Make sure Connectivity Flags have been computed before using this filter");
149 return 0;
150 }
151
152 vtkPoints* points = input->GetPoints();
153 vtkCellArray* cells = input->GetCells();
154 if (!points || !cells)
155 {
156 return 1;
157 }
158
159 // Allocate

Callers 1

RequestDataMethod · 0.95

Calls 15

GetAbstractArrayMethod · 0.80
AllocateEstimateMethod · 0.80
SetPolysMethod · 0.80
CheckAbortMethod · 0.80
GetCellGhostArrayMethod · 0.80
GetNumberOfPointsMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetPointDataMethod · 0.45
GetCellDataMethod · 0.45
SetNameMethod · 0.45
SetNumberOfComponentsMethod · 0.45
AllocateMethod · 0.45

Tested by

no test coverage detected