| 3292 | //------------------------------------------------------------------------------ |
| 3293 | template <typename TInputIdType> |
| 3294 | int ExecuteStructured(vtkGeometryFilter* self, vtkDataSet* input, vtkPolyData* output, |
| 3295 | int* wholeExtent, vtkExcludedFaces<TInputIdType>* exc, bool* extractFace) |
| 3296 | { |
| 3297 | vtkIdType numCells = input->GetNumberOfCells(); |
| 3298 | vtkPointData* inPD = input->GetPointData(); |
| 3299 | vtkCellData* inCD = input->GetCellData(); |
| 3300 | vtkPointData* outPD = output->GetPointData(); |
| 3301 | vtkCellData* outCD = output->GetCellData(); |
| 3302 | |
| 3303 | // Setup processing |
| 3304 | bool mergePts = true; // implicit point representations require merging |
| 3305 | vtkPoints* inPts = nullptr; |
| 3306 | if (auto sgrid = vtkStructuredGrid::SafeDownCast(input)) |
| 3307 | { |
| 3308 | inPts = sgrid->GetPoints(); |
| 3309 | mergePts = self->GetMerging(); // may not be required for explicit |
| 3310 | } |
| 3311 | unsigned char* cellGhosts = nullptr; |
| 3312 | if (inCD) |
| 3313 | { |
| 3314 | if (auto ghosts = inCD->GetGhostArray()) |
| 3315 | { |
| 3316 | cellGhosts = ghosts->GetPointer(0); |
| 3317 | } |
| 3318 | } |
| 3319 | |
| 3320 | // We can now extract the boundary topology. This works for all structured |
| 3321 | // types. Here we are only dealing with 3D structured datasets. The 2D cells |
| 3322 | // are handled as a general dataset. |
| 3323 | vtkNew<vtkCellArray> polys; |
| 3324 | output->SetPolys(polys); |
| 3325 | ThreadOutputType<TInputIdType> threads; |
| 3326 | |
| 3327 | outPD->CopyGlobalIdsOn(); |
| 3328 | outCD->CopyGlobalIdsOn(); |
| 3329 | |
| 3330 | ExtractCellBoundaries<TInputIdType>* extStr; |
| 3331 | // if extractFace are defined, it's an AMR block |
| 3332 | if (auto image = vtkImageData::SafeDownCast(input)) |
| 3333 | { |
| 3334 | extStr = ExtractStructured<vtkImageData, TInputIdType>::Execute( |
| 3335 | self, image, wholeExtent, extractFace, mergePts, cellGhosts, exc, &threads); |
| 3336 | } |
| 3337 | else if (auto sGrid = vtkStructuredGrid::SafeDownCast(input)) |
| 3338 | { |
| 3339 | extStr = ExtractStructured<vtkStructuredGrid, TInputIdType>::Execute( |
| 3340 | self, sGrid, wholeExtent, extractFace, mergePts, cellGhosts, exc, &threads); |
| 3341 | } |
| 3342 | else if (auto rGrid = vtkRectilinearGrid::SafeDownCast(input)) |
| 3343 | { |
| 3344 | extStr = ExtractStructured<vtkRectilinearGrid, TInputIdType>::Execute( |
| 3345 | self, rGrid, wholeExtent, extractFace, mergePts, cellGhosts, exc, &threads); |
| 3346 | } |
| 3347 | else |
| 3348 | { |
| 3349 | vtkErrorWithObjectMacro(self, "Data type " << input->GetClassName() << "is not supported."); |
| 3350 | return 0; |
| 3351 | } |
nothing calls this directly
no test coverage detected