------------------------------------------------------------------------------
| 538 | |
| 539 | //------------------------------------------------------------------------------ |
| 540 | void 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 | //------------------------------------------------------------------------------ |
no test coverage detected