------------------------------------------------------------------------------ Clip through data generating surface.
| 123 | // Clip through data generating surface. |
| 124 | // |
| 125 | int vtkGenericClip::RequestData(vtkInformation* vtkNotUsed(request), |
| 126 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 127 | { |
| 128 | // get the info objects |
| 129 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 130 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 131 | |
| 132 | // get the input and output |
| 133 | vtkGenericDataSet* input = |
| 134 | vtkGenericDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 135 | vtkUnstructuredGrid* output = |
| 136 | vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 137 | |
| 138 | if (input == nullptr) |
| 139 | { |
| 140 | return 1; |
| 141 | } |
| 142 | |
| 143 | vtkUnstructuredGrid* clippedOutput = this->GetClippedOutput(); |
| 144 | |
| 145 | vtkIdType numPts = input->GetNumberOfPoints(); |
| 146 | vtkIdType numCells = input->GetNumberOfCells(); |
| 147 | vtkPointData* outPD = output->GetPointData(); |
| 148 | vtkCellData* outCD[2]; |
| 149 | vtkIdType npts = 0; |
| 150 | const vtkIdType* pts; |
| 151 | int cellType = 0; |
| 152 | int j; |
| 153 | vtkIdType estimatedSize; |
| 154 | vtkUnsignedCharArray* types[2]; |
| 155 | int numOutputs = 1; |
| 156 | vtkGenericAdaptorCell* cell; |
| 157 | |
| 158 | outCD[0] = nullptr; |
| 159 | outCD[1] = nullptr; |
| 160 | |
| 161 | vtkDebugMacro(<< "Clipping dataset"); |
| 162 | |
| 163 | // Initialize self; create output objects |
| 164 | // |
| 165 | if (numPts < 1) |
| 166 | { |
| 167 | vtkErrorMacro(<< "No data to clip"); |
| 168 | return 1; |
| 169 | } |
| 170 | |
| 171 | if (!this->ClipFunction && this->GenerateClipScalars) |
| 172 | { |
| 173 | vtkErrorMacro(<< "Cannot generate clip scalars if no clip function defined"); |
| 174 | return 1; |
| 175 | } |
| 176 | |
| 177 | // allocate the output and associated helper classes |
| 178 | estimatedSize = numCells; |
| 179 | estimatedSize = estimatedSize / 1024 * 1024; // multiple of 1024 |
| 180 | estimatedSize = std::max<vtkIdType>(estimatedSize, 1024); |
| 181 | |
| 182 | vtkPoints* newPoints = vtkPoints::New(); |
nothing calls this directly
no test coverage detected