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

Function CopyRotatedDataHTG

Filters/General/vtkAxisAlignedTransformFilter.cxx:540–595  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

538
539//------------------------------------------------------------------------------
540void CopyRotatedDataHTG(vtkHyperTree* input, vtkHyperTree* output, vtkHyperTreeGrid* inputHTG,
541 vtkHyperTreeGrid* outputHTG, vtkIdType inputIndex, vtkIdType outputIndex,
542 const std::vector<unsigned int>& permutation, vtkHyperTreeGridNonOrientedCursor* cursorInput,
543 vtkHyperTreeGridNonOrientedCursor* cursorOutput)
544{
545 auto returnRecursion = [cursorInput, cursorOutput]()
546 {
547 if (!cursorInput->IsRoot())
548 {
549 cursorInput->ToParent();
550 cursorOutput->ToParent();
551 }
552 };
553
554 if (cursorInput->IsMasked())
555 {
556 returnRecursion();
557 return;
558 }
559
560 // Actual copy of the data
561 vtkCellData* inputCellData = inputHTG->GetCellData();
562 vtkCellData* outputCellData = outputHTG->GetCellData();
563 for (int arrayId = 0; arrayId < inputCellData->GetNumberOfArrays(); ++arrayId)
564 {
565 vtkDataArray* inputArray = inputCellData->GetArray(arrayId);
566 vtkDataArray* outputArray = outputCellData->GetArray(arrayId);
567
568 int inputTuple = cursorInput->GetGlobalNodeIndex();
569 int outputTuple = cursorOutput->GetGlobalNodeIndex();
570
571 outputArray->SetTuple(outputTuple, inputArray->GetTuple(inputTuple));
572 }
573
574 if (cursorInput->IsLeaf())
575 {
576 returnRecursion();
577 return;
578 }
579
580 vtkIdType inputBase = input->GetElderChildIndex(inputIndex);
581 vtkIdType outputBase = output->GetElderChildIndex(outputIndex);
582
583 size_t nChildren = permutation.size();
584 for (size_t i = 0; i < nChildren; ++i)
585 {
586 vtkIdType inputChildIndex = inputBase + permutation[i];
587 vtkIdType outputChildIndex = outputBase + i;
588
589 cursorInput->ToChild(permutation[i]);
590 cursorOutput->ToChild(static_cast<unsigned char>(i));
591 CopyRotatedDataHTG(input, output, inputHTG, outputHTG, inputChildIndex, outputChildIndex,
592 permutation, cursorInput, cursorOutput);
593 }
594 returnRecursion();
595}
596
597//------------------------------------------------------------------------------

Callers 1

ProcessHTGMethod · 0.85

Calls 13

GetElderChildIndexMethod · 0.80
IsRootMethod · 0.45
ToParentMethod · 0.45
IsMaskedMethod · 0.45
GetCellDataMethod · 0.45
GetNumberOfArraysMethod · 0.45
GetArrayMethod · 0.45
GetGlobalNodeIndexMethod · 0.45
SetTupleMethod · 0.45
GetTupleMethod · 0.45
IsLeafMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected