------------------------------------------------------------------------------
| 148 | |
| 149 | //------------------------------------------------------------------------------ |
| 150 | int vtkDataSetRegionSurfaceFilter::UnstructuredGridExecute( |
| 151 | vtkDataSet* dataSetInput, vtkPolyData* output) |
| 152 | { |
| 153 | vtkUnstructuredGrid* input = vtkUnstructuredGrid::SafeDownCast(dataSetInput); |
| 154 | |
| 155 | // Before we start doing anything interesting, check if we need handle |
| 156 | // non-linear cells using sub-division. |
| 157 | bool handleSubdivision = false; |
| 158 | if (this->NonlinearSubdivisionLevel >= 1) |
| 159 | { |
| 160 | // Check to see if the data actually has nonlinear cells. Handling |
| 161 | // nonlinear cells adds unnecessary work if we only have linear cells. |
| 162 | auto distinctCellTypesArray = input->GetDistinctCellTypesArray(); |
| 163 | for (vtkIdType i = 0; i < distinctCellTypesArray->GetNumberOfValues(); i++) |
| 164 | { |
| 165 | if (!vtkCellTypeUtilities::IsLinear(distinctCellTypesArray->GetValue(i))) |
| 166 | { |
| 167 | handleSubdivision = true; |
| 168 | break; |
| 169 | } |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | vtkSmartPointer<vtkUnstructuredGrid> tempInput; |
| 174 | if (handleSubdivision) |
| 175 | { |
| 176 | // Since this filter only properly subdivides 2D cells past |
| 177 | // level 1, we convert 3D cells to 2D by using |
| 178 | // vtkUnstructuredGridGeometryFilter. |
| 179 | vtkNew<vtkUnstructuredGridGeometryFilter> uggf; |
| 180 | vtkNew<vtkUnstructuredGrid> clone; |
| 181 | clone->ShallowCopy(input); |
| 182 | uggf->SetInputData(clone); |
| 183 | uggf->SetPassThroughCellIds(this->PassThroughCellIds); |
| 184 | uggf->SetPassThroughPointIds(this->PassThroughPointIds); |
| 185 | uggf->SetMatchBoundariesIgnoringCellOrder(this->MatchBoundariesIgnoringCellOrder); |
| 186 | uggf->Update(); |
| 187 | |
| 188 | tempInput = vtkSmartPointer<vtkUnstructuredGrid>::New(); |
| 189 | tempInput->ShallowCopy(uggf->GetOutputDataObject(0)); |
| 190 | input = tempInput; |
| 191 | } |
| 192 | |
| 193 | vtkCellArray* newVerts; |
| 194 | vtkCellArray* newLines; |
| 195 | vtkCellArray* newPolys; |
| 196 | vtkPoints* newPts; |
| 197 | const vtkIdType* ids; |
| 198 | int progressCount; |
| 199 | int i, j; |
| 200 | int cellType; |
| 201 | vtkIdType numPts = input->GetNumberOfPoints(); |
| 202 | vtkIdType numCells = input->GetNumberOfCells(); |
| 203 | vtkGenericCell* cell; |
| 204 | int numFacePts; |
| 205 | vtkIdType numCellPts; |
| 206 | vtkIdType inPtId, outPtId; |
| 207 | vtkPointData* inputPD = input->GetPointData(); |
nothing calls this directly
no test coverage detected