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

Function ExtractCellGeometry

Filters/Geometry/vtkGeometryFilter.cxx:1052–1221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1050// This method works with unstructured grids.
1051template <typename TInputIdType, typename TOffsetsValueType, typename TConnectivityIter>
1052void ExtractCellGeometry(vtkUnstructuredGrid* input, vtkIdType cellId, int cellType,
1053 TOffsetsValueType npts, const TConnectivityIter pts, int faceId,
1054 LocalDataType<TInputIdType>* localData, const bool& isGhost)
1055{
1056 using Triangle = StaticFace<3, TInputIdType>;
1057 using Quad = StaticFace<4, TInputIdType>;
1058 using Pentagon = StaticFace<5, TInputIdType>;
1059 using Hexagon = StaticFace<6, TInputIdType>;
1060
1061 static constexpr int MAX_FACE_POINTS = 32;
1062 vtkIdType ptIds[MAX_FACE_POINTS]; // cell face point ids
1063 const vtkIdType* faceVerts;
1064 static constexpr int pixelConvert[4] = { 0, 1, 3, 2 };
1065
1066 switch (cellType)
1067 {
1068 case VTK_EMPTY_CELL:
1069 break;
1070
1071 case VTK_VERTEX:
1072 case VTK_POLY_VERTEX:
1073 localData->Verts.InsertNextCell(npts, pts, cellId);
1074 break;
1075
1076 case VTK_LINE:
1077 case VTK_POLY_LINE:
1078 localData->Lines.InsertNextCell(npts, pts, cellId);
1079 break;
1080
1081 case VTK_TRIANGLE:
1082 case VTK_QUAD:
1083 case VTK_POLYGON:
1084 localData->Polys.InsertNextCell(npts, pts, cellId);
1085 break;
1086
1087 case VTK_TRIANGLE_STRIP:
1088 localData->Strips.InsertNextCell(npts, pts, cellId);
1089 break;
1090
1091 case VTK_PIXEL:
1092 // pixelConvert (in the following loop) is an int[4]. GCC 5.1.1
1093 // warns about pixelConvert[4] being uninitialized due to loop
1094 // unrolling -- forcibly restricting npts <= 4 prevents this warning.
1095 ptIds[0] = pts[pixelConvert[0]];
1096 ptIds[1] = pts[pixelConvert[1]];
1097 ptIds[2] = pts[pixelConvert[2]];
1098 ptIds[3] = pts[pixelConvert[3]];
1099 localData->Polys.InsertNextCell(static_cast<vtkIdType>(npts), ptIds, cellId);
1100 break;
1101
1102 case VTK_TETRA:
1103 faceVerts = vtkTetra::GetFaceArray(faceId);
1104 ptIds[0] = pts[faceVerts[0]];
1105 ptIds[1] = pts[faceVerts[1]];
1106 ptIds[2] = pts[faceVerts[2]];
1107 localData->FaceList.Insert(Triangle(cellId, ptIds, isGhost));
1108 break;
1109

Callers 1

operator()Method · 0.85

Calls 14

TriangleClass · 0.85
InsertAFaceFunction · 0.85
GetCellPointAtIdMethod · 0.80
InsertNextCellMethod · 0.45
InsertMethod · 0.45
GetCellAtIdMethod · 0.45
GetPolyhedronFacesMethod · 0.45
GetCellMethod · 0.45
GetCellDimensionMethod · 0.45
GetNumberOfFacesMethod · 0.45
GetFaceMethod · 0.45

Tested by

no test coverage detected