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

Method ProcessUnstructuredGrid

Filters/General/vtkReflectionUtilities.cxx:317–894  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

315
316//------------------------------------------------------------------------------
317void 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);

Callers

nothing calls this directly

Calls 15

CheckAbortMethod · 0.80
CheckAttributesMethod · 0.80
NewFunction · 0.50
IndexFunction · 0.50
GetPointDataMethod · 0.45
GetCellDataMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetNumberOfCellsMethod · 0.45
AllocateMethod · 0.45
CopyAllOnMethod · 0.45
CopyAllocateMethod · 0.45
GetPointMethod · 0.45

Tested by

no test coverage detected