------------------------------------------------------------------------------
| 654 | |
| 655 | //------------------------------------------------------------------------------ |
| 656 | void vtkAxisAlignedReflectionFilter::ProcessHtg(vtkHyperTreeGrid* input, vtkHyperTreeGrid* output, |
| 657 | int mirrorDir[3], int mirrorSymmetricTensorDir[6], int mirrorTensorDir[9]) |
| 658 | { |
| 659 | // Skip empty inputs |
| 660 | if (input->GetNumberOfLeaves() == 0) |
| 661 | { |
| 662 | return; |
| 663 | } |
| 664 | |
| 665 | // Shallow copy structure of input into output |
| 666 | output->CopyStructure(input); |
| 667 | |
| 668 | // Shallow copy data of input into output |
| 669 | vtkCellData* inCD = input->GetCellData(); |
| 670 | vtkCellData* outCD = output->GetCellData(); |
| 671 | outCD->PassData(inCD); |
| 672 | |
| 673 | std::vector<std::pair<vtkIdType, int>> reflectableArrays; |
| 674 | vtkReflectionUtilities::FindAllReflectableArrays( |
| 675 | reflectableArrays, inCD, this->ReflectAllInputArrays); |
| 676 | |
| 677 | for (size_t i = 0; i < reflectableArrays.size(); i++) |
| 678 | { |
| 679 | vtkAbstractArray* inArr = inCD->GetAbstractArray(reflectableArrays[i].first); |
| 680 | vtkSmartPointer<vtkAbstractArray> newArr = inArr->NewInstance(); |
| 681 | newArr->SetName(inArr->GetName()); |
| 682 | newArr->SetNumberOfComponents(inArr->GetNumberOfComponents()); |
| 683 | newArr->SetNumberOfTuples(inArr->GetNumberOfTuples()); |
| 684 | outCD->AddArray(newArr); |
| 685 | newArr->Delete(); |
| 686 | } |
| 687 | |
| 688 | for (int i = 0; i < input->GetNumberOfCells(); i++) |
| 689 | { |
| 690 | vtkReflectionUtilities::ReflectReflectableArrays( |
| 691 | reflectableArrays, inCD, outCD, i, mirrorDir, mirrorSymmetricTensorDir, mirrorTensorDir, i); |
| 692 | } |
| 693 | |
| 694 | // Retrieve reflection direction and coordinates to be reflected |
| 695 | unsigned int direction = this->PlaneAxisInternal; |
| 696 | double offset = 0.; |
| 697 | vtkUniformHyperTreeGrid* inputUHTG = vtkUniformHyperTreeGrid::SafeDownCast(input); |
| 698 | vtkUniformHyperTreeGrid* outputUHTG = vtkUniformHyperTreeGrid::SafeDownCast(output); |
| 699 | if (inputUHTG) |
| 700 | { |
| 701 | assert(outputUHTG); |
| 702 | double origin[3]; |
| 703 | inputUHTG->GetOrigin(origin); |
| 704 | double scale[3]; |
| 705 | inputUHTG->GetGridScale(scale); |
| 706 | |
| 707 | unsigned int size = inputUHTG->GetCellDims()[direction]; |
| 708 | |
| 709 | switch (this->PlaneMode) |
| 710 | { |
| 711 | case PLANE: |
| 712 | { |
| 713 | offset = 2 * this->PlaneOriginInternal[direction]; |
nothing calls this directly
no test coverage detected