------------------------------------------------------------------------------
| 315 | |
| 316 | //------------------------------------------------------------------------------ |
| 317 | void vtkReflectionUtilities::ProcessUnstructuredGrid(vtkDataSet* input, vtkUnstructuredGrid* output, |
| 318 | double constant[3], int mirrorDir[3], int mirrorSymmetricTensorDir[6], int mirrorTensorDir[9], |
| 319 | bool copyInput, bool reflectAllInputArrays, vtkAlgorithm* algorithm) |
| 320 | { |
| 321 | vtkPointData* inPD = input->GetPointData(); |
| 322 | vtkPointData* outPD = output->GetPointData(); |
| 323 | vtkCellData* inCD = input->GetCellData(); |
| 324 | vtkCellData* outCD = output->GetCellData(); |
| 325 | vtkIdType numPts = input->GetNumberOfPoints(); |
| 326 | vtkIdType numCells = input->GetNumberOfCells(); |
| 327 | double point[3]; |
| 328 | vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); |
| 329 | vtkSmartPointer<vtkPoints> outPoints = vtkSmartPointer<vtkPoints>::New(); |
| 330 | |
| 331 | if (copyInput) |
| 332 | { |
| 333 | outPoints->Allocate(2 * numPts); |
| 334 | output->Allocate(numCells * 2); |
| 335 | } |
| 336 | else |
| 337 | { |
| 338 | outPoints->Allocate(numPts); |
| 339 | output->Allocate(numCells); |
| 340 | } |
| 341 | outPD->CopyAllOn(); |
| 342 | outPD->CopyGlobalIdsOff(); |
| 343 | outCD->CopyAllOn(); |
| 344 | outCD->CopyGlobalIdsOff(); |
| 345 | outPD->CopyAllocate(inPD); |
| 346 | outCD->CopyAllocate(inCD); |
| 347 | |
| 348 | // Copy first points. |
| 349 | if (copyInput) |
| 350 | { |
| 351 | for (vtkIdType i = 0; i < numPts; i++) |
| 352 | { |
| 353 | input->GetPoint(i, point); |
| 354 | outPD->CopyData(inPD, i, outPoints->InsertNextPoint(point)); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | std::vector<std::pair<vtkIdType, int>> reflectableArrays; |
| 359 | vtkReflectionUtilities::FindAllReflectableArrays(reflectableArrays, inPD, reflectAllInputArrays); |
| 360 | |
| 361 | // Copy reflected points. |
| 362 | for (vtkIdType i = 0; i < numPts; i++) |
| 363 | { |
| 364 | if (algorithm->CheckAbort()) |
| 365 | { |
| 366 | break; |
| 367 | } |
| 368 | input->GetPoint(i, point); |
| 369 | vtkIdType ptId = outPoints->InsertNextPoint(mirrorDir[0] * point[0] + constant[0], |
| 370 | mirrorDir[1] * point[1] + constant[1], mirrorDir[2] * point[2] + constant[2]); |
| 371 | outPD->CopyData(inPD, i, ptId); |
| 372 | |
| 373 | vtkReflectionUtilities::ReflectReflectableArrays(reflectableArrays, inPD, outPD, i, mirrorDir, |
| 374 | mirrorSymmetricTensorDir, mirrorTensorDir, ptId); |
nothing calls this directly
no test coverage detected