------------------------------------------------------------------------------
| 73 | |
| 74 | //------------------------------------------------------------------------------ |
| 75 | int vtkHyperTreeGridAxisCut::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 76 | { |
| 77 | // Downcast output data object to hyper tree grid |
| 78 | vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 79 | if (!output) |
| 80 | { |
| 81 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | // This filter works only with 3D grids |
| 86 | if (input->GetDimension() != 3) |
| 87 | { |
| 88 | vtkErrorMacro(<< "Bad input dimension:" << input->GetDimension()); |
| 89 | return 0; |
| 90 | } |
| 91 | |
| 92 | output->Initialize(); |
| 93 | |
| 94 | // Retrieve normal axis and intercept of cut plane |
| 95 | int axis = this->PlaneNormalAxis; |
| 96 | |
| 97 | this->PlanePositionRealUse = this->PlanePosition; |
| 98 | |
| 99 | double inter = this->PlanePositionRealUse; |
| 100 | |
| 101 | // Set output grid sizes; must be 1 in the direction of cut plane normal |
| 102 | unsigned int size[3]; |
| 103 | input->GetDimensions(size); |
| 104 | size[axis] = 1; |
| 105 | output->SetDimensions(size); |
| 106 | |
| 107 | vtkUniformHyperTreeGrid* inputUHTG = vtkUniformHyperTreeGrid::SafeDownCast(input); |
| 108 | vtkUniformHyperTreeGrid* outputUHTG = vtkUniformHyperTreeGrid::SafeDownCast(outputDO); |
| 109 | if (inputUHTG) |
| 110 | { |
| 111 | outputUHTG->CopyCoordinates(inputUHTG); |
| 112 | outputUHTG->SetFixedCoordinates(axis, inter); |
| 113 | } |
| 114 | else |
| 115 | { |
| 116 | output->CopyCoordinates(input); |
| 117 | output->SetFixedCoordinates(axis, inter); |
| 118 | } |
| 119 | |
| 120 | // Other grid parameters are identical |
| 121 | output->SetTransposedRootIndexing(input->GetTransposedRootIndexing()); |
| 122 | output->SetBranchFactor(input->GetBranchFactor()); |
| 123 | output->SetHasInterface(input->GetHasInterface()); |
| 124 | output->SetInterfaceNormalsName(input->GetInterfaceNormalsName()); |
| 125 | output->SetInterfaceInterceptsName(input->GetInterfaceInterceptsName()); |
| 126 | |
| 127 | // Initialize output point data |
| 128 | this->InData = input->GetCellData(); |
| 129 | this->OutData = output->GetCellData(); |
| 130 | this->OutData->CopyAllocate(this->InData); |
| 131 | |
| 132 | // Output indices begin at 0 |
nothing calls this directly
no test coverage detected