| 27 | } |
| 28 | |
| 29 | int vtkStructuredGridGeometryFilter::RequestData(vtkInformation* vtkNotUsed(request), |
| 30 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 31 | { |
| 32 | // get the info objects |
| 33 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 34 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 35 | |
| 36 | // get the input and output |
| 37 | vtkStructuredGrid* input = |
| 38 | vtkStructuredGrid::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 39 | vtkPolyData* output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 40 | |
| 41 | int dimension, dir[3], diff[3]; |
| 42 | int i, j, k, extent[6], *inExt; |
| 43 | vtkIdType ptIds[4], idx, startIdx, startCellIdx, cellId; |
| 44 | vtkPoints* newPts = nullptr; |
| 45 | vtkCellArray* newVerts = nullptr; |
| 46 | vtkCellArray* newLines = nullptr; |
| 47 | vtkCellArray* newPolys = nullptr; |
| 48 | vtkIdType totPoints, pos, cellPos; |
| 49 | int offset[3], cellOffset[3], numPolys; |
| 50 | double x[3]; |
| 51 | vtkPointData *pd, *outPD; |
| 52 | vtkCellData *cd, *outCD; |
| 53 | |
| 54 | vtkDebugMacro(<< "Extracting structured points geometry"); |
| 55 | |
| 56 | if (input->GetPoints() == nullptr) |
| 57 | { |
| 58 | vtkDebugMacro(<< "No data to extract"); |
| 59 | return 1; |
| 60 | } |
| 61 | |
| 62 | pd = input->GetPointData(); |
| 63 | outPD = output->GetPointData(); |
| 64 | outPD->CopyNormalsOff(); |
| 65 | cd = input->GetCellData(); |
| 66 | outCD = output->GetCellData(); |
| 67 | int dims[3]; |
| 68 | input->GetDimensions(dims); |
| 69 | inExt = input->GetExtent(); |
| 70 | |
| 71 | // Based on the dimensions of the structured data, and the extent of |
| 72 | // the geometry, compute the combined extent plus the dimensionality |
| 73 | // of the data. |
| 74 | // |
| 75 | dimension = 3; |
| 76 | for (i = 0; i < 3; i++) |
| 77 | { |
| 78 | extent[2 * i] = this->Extent[2 * i]; |
| 79 | extent[2 * i] = std::max(extent[2 * i], inExt[2 * i]); |
| 80 | extent[2 * i + 1] = this->Extent[2 * i + 1]; |
| 81 | extent[2 * i + 1] = std::min(extent[2 * i + 1], inExt[2 * i + 1]); |
| 82 | |
| 83 | // Handle empty extent. |
| 84 | if (extent[2 * i] > extent[2 * i + 1]) |
| 85 | { |
| 86 | return 1; |
nothing calls this directly
no test coverage detected