| 926 | // This method works with arbitrary datasets. |
| 927 | template <typename TInputIdType> |
| 928 | void ExtractDSCellGeometry(vtkDataSet* input, vtkIdType cellId, const char* cellVis, |
| 929 | const unsigned char* cellGhosts, bool removeGhostInterfaces, |
| 930 | LocalDataType<TInputIdType>* localData) |
| 931 | { |
| 932 | using TCellArrayType = CellArrayType<TInputIdType>; |
| 933 | static constexpr int pixelConvert[4] = { 0, 1, 3, 2 }; |
| 934 | vtkGenericCell* cell = localData->Cell; |
| 935 | input->GetCell(cellId, cell); |
| 936 | int cellType = cell->GetCellType(); |
| 937 | |
| 938 | if (cellType != VTK_EMPTY_CELL) |
| 939 | { |
| 940 | TCellArrayType& verts = localData->Verts; |
| 941 | TCellArrayType& lines = localData->Lines; |
| 942 | TCellArrayType& polys = localData->Polys; |
| 943 | TCellArrayType& strips = localData->Strips; |
| 944 | vtkIdList* cellIds = localData->CellIds.Get(); |
| 945 | vtkIdList* ptIds = localData->IPts.Get(); |
| 946 | ptIds->SetNumberOfIds(4); |
| 947 | |
| 948 | int cellDim = cell->GetCellDimension(); |
| 949 | vtkIdType npts = cell->PointIds->GetNumberOfIds(); |
| 950 | vtkIdType* pts = cell->PointIds->GetPointer(0); |
| 951 | |
| 952 | switch (cellDim) |
| 953 | { |
| 954 | // create new points and then cell |
| 955 | case 0: |
| 956 | verts.InsertNextCell(npts, pts, cellId); |
| 957 | break; |
| 958 | |
| 959 | case 1: |
| 960 | lines.InsertNextCell(npts, pts, cellId); |
| 961 | break; |
| 962 | |
| 963 | case 2: |
| 964 | if (cellType == VTK_TRIANGLE_STRIP) |
| 965 | { |
| 966 | strips.InsertNextCell(npts, pts, cellId); |
| 967 | } |
| 968 | else if (cellType == VTK_PIXEL) |
| 969 | { |
| 970 | ptIds->SetId(0, pts[pixelConvert[0]]); |
| 971 | ptIds->SetId(1, pts[pixelConvert[1]]); |
| 972 | ptIds->SetId(2, pts[pixelConvert[2]]); |
| 973 | ptIds->SetId(3, pts[pixelConvert[3]]); |
| 974 | polys.InsertNextCell(npts, ptIds->GetPointer(0), cellId); |
| 975 | } |
| 976 | else |
| 977 | { |
| 978 | polys.InsertNextCell(npts, pts, cellId); |
| 979 | } |
| 980 | break; |
| 981 | |
| 982 | case 3: |
| 983 | int numFaces = cell->GetNumberOfFaces(); |
| 984 | for (int j = 0; j < numFaces; j++) |
| 985 | { |
no test coverage detected