------------------------------------------------------------------------------ Clip by box
| 150 | // Clip by box |
| 151 | // |
| 152 | int vtkBoxClipDataSet::RequestData(vtkInformation* vtkNotUsed(request), |
| 153 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 154 | { |
| 155 | // get the info objects |
| 156 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 157 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 158 | |
| 159 | // get the input and output |
| 160 | vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 161 | vtkUnstructuredGrid* output = |
| 162 | vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 163 | |
| 164 | vtkUnstructuredGrid* clippedOutput = this->GetClippedOutput(); |
| 165 | |
| 166 | vtkIdType i; |
| 167 | vtkIdType npts; |
| 168 | const vtkIdType* pts; |
| 169 | vtkIdType estimatedSize; |
| 170 | vtkIdType newCellId; |
| 171 | vtkIdType numPts = input->GetNumberOfPoints(); |
| 172 | vtkIdType numCells = input->GetNumberOfCells(); |
| 173 | vtkPointData* inPD = input->GetPointData(); |
| 174 | vtkPointData* outPD[2]; |
| 175 | vtkCellData* inCD = input->GetCellData(); |
| 176 | vtkCellData* outCD[2]; |
| 177 | vtkPoints* newPoints; |
| 178 | vtkPoints* cellPts; |
| 179 | vtkDebugMacro(<< "Clip by Box\n"); |
| 180 | vtkUnsignedCharArray* types[2]; |
| 181 | |
| 182 | int j; |
| 183 | int cellType = 0; |
| 184 | int numOutputs = 1; |
| 185 | |
| 186 | // Initialize self; create output objects |
| 187 | // |
| 188 | if (numPts < 1) |
| 189 | { |
| 190 | vtkDebugMacro(<< "No data to clip"); |
| 191 | return 1; |
| 192 | } |
| 193 | |
| 194 | // allocate the output and associated helper classes |
| 195 | estimatedSize = numCells; |
| 196 | estimatedSize = estimatedSize / 1024 * 1024; // multiple of 1024 |
| 197 | estimatedSize = std::max<vtkIdType>(estimatedSize, 1024); |
| 198 | vtkCellArray* conn[2]; |
| 199 | conn[0] = vtkCellArray::New(); |
| 200 | conn[0]->AllocateEstimate(estimatedSize, 1); |
| 201 | conn[0]->InitTraversal(); |
| 202 | types[0] = vtkUnsignedCharArray::New(); |
| 203 | types[0]->Allocate(estimatedSize, estimatedSize / 2); |
| 204 | |
| 205 | if (this->GenerateClippedOutput) |
| 206 | { |
| 207 | numOutputs = 2; |
| 208 | conn[1] = vtkCellArray::New(); |
| 209 | conn[1]->AllocateEstimate(estimatedSize, 1); |
nothing calls this directly
no test coverage detected