------------------------------------------------------------------------------
| 48 | |
| 49 | //------------------------------------------------------------------------------ |
| 50 | int vtkHyperTreeGridAxisReflection::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 51 | { |
| 52 | // Skip empty inputs |
| 53 | if (input->GetNumberOfLeaves() == 0) |
| 54 | { |
| 55 | return 1; |
| 56 | } |
| 57 | |
| 58 | // Downcast output data object to hyper tree grid |
| 59 | vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 60 | if (!output) |
| 61 | { |
| 62 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 63 | return 0; |
| 64 | } |
| 65 | |
| 66 | // Shallow copy structure of input into output |
| 67 | output->CopyStructure(input); |
| 68 | |
| 69 | // Shallow copy data of input into output |
| 70 | this->InData = input->GetCellData(); |
| 71 | this->OutData = output->GetCellData(); |
| 72 | this->OutData->PassData(this->InData); |
| 73 | |
| 74 | // Retrieve reflection direction and coordinates to be reflected |
| 75 | unsigned int direction = 0; |
| 76 | double offset = 0.; |
| 77 | vtkUniformHyperTreeGrid* inputUHTG = vtkUniformHyperTreeGrid::SafeDownCast(input); |
| 78 | vtkUniformHyperTreeGrid* outputUHTG = vtkUniformHyperTreeGrid::SafeDownCast(outputDO); |
| 79 | if (inputUHTG) |
| 80 | { |
| 81 | assert(outputUHTG); |
| 82 | double origin[3]; |
| 83 | inputUHTG->GetOrigin(origin); |
| 84 | double scale[3]; |
| 85 | inputUHTG->GetGridScale(scale); |
| 86 | unsigned int pmod3 = this->Plane % 3; |
| 87 | if (!pmod3) |
| 88 | { |
| 89 | direction = 0; |
| 90 | } |
| 91 | else if (pmod3 == 1) |
| 92 | { |
| 93 | direction = 1; |
| 94 | } |
| 95 | else |
| 96 | { |
| 97 | direction = 2; |
| 98 | } |
| 99 | |
| 100 | // Retrieve size of reflected coordinates array |
| 101 | unsigned int size = inputUHTG->GetCellDims()[direction]; |
| 102 | |
| 103 | // Compute offset |
| 104 | if (this->Plane < 3) |
| 105 | { |
| 106 | double u = origin[direction]; |
| 107 | double v = origin[direction] + size * scale[0]; |
nothing calls this directly
no test coverage detected