MCPcopy Create free account
hub / github.com/Kitware/VTK / ExtractDSCellGeometry

Function ExtractDSCellGeometry

Filters/Geometry/vtkGeometryFilter.cxx:928–1009  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

926// This method works with arbitrary datasets.
927template <typename TInputIdType>
928void 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 {

Callers 1

operator()Method · 0.85

Calls 14

SetNumberOfIdsMethod · 0.80
GetCellMethod · 0.45
GetCellTypeMethod · 0.45
GetMethod · 0.45
GetCellDimensionMethod · 0.45
GetNumberOfIdsMethod · 0.45
GetPointerMethod · 0.45
InsertNextCellMethod · 0.45
SetIdMethod · 0.45
GetNumberOfFacesMethod · 0.45
GetFaceMethod · 0.45
GetCellNeighborsMethod · 0.45

Tested by

no test coverage detected