-------------------------------------------------------------------------- Given a cell, mark boundary features from the cell. This method works with unstructured grids.
| 330 | // Given a cell, mark boundary features from the cell. This method works |
| 331 | // with unstructured grids. |
| 332 | void MarkUGCell(vtkUnstructuredGrid* input, vtkIdType cellId, int cellType, vtkIdType npts, |
| 333 | const vtkIdType* pts, vtkUnstructuredGridCellIterator* cellIter, vtkGenericCell* cell, |
| 334 | MarkCellBoundary* marker) |
| 335 | { |
| 336 | vtkIdType faceId, numEdgePts, numFacePts; |
| 337 | constexpr int MAX_FACE_POINTS = 32; |
| 338 | vtkIdType ptIds[MAX_FACE_POINTS]; // cell face point ids |
| 339 | const vtkIdType* faceVerts; |
| 340 | bool insertEdge, insertFace; |
| 341 | static const int pixelConvert[4] = { 0, 1, 3, 2 }; |
| 342 | vtkIdType edgePts[2]; |
| 343 | |
| 344 | switch (cellType) |
| 345 | { |
| 346 | case VTK_EMPTY_CELL: |
| 347 | break; |
| 348 | |
| 349 | case VTK_VERTEX: |
| 350 | case VTK_POLY_VERTEX: |
| 351 | // All verts are considered boundary |
| 352 | marker->MarkCell(cellId, 0, npts, pts); |
| 353 | break; |
| 354 | |
| 355 | case VTK_LINE: |
| 356 | case VTK_POLY_LINE: |
| 357 | // The end points, used by one line, are boundary |
| 358 | if (input->IsCellBoundary(cellId, 1, pts)) |
| 359 | { |
| 360 | marker->MarkCell(cellId, 0, 1, pts); |
| 361 | } |
| 362 | if (input->IsCellBoundary(cellId, 1, pts + npts - 1)) |
| 363 | { |
| 364 | marker->MarkCell(cellId, 1, 1, pts + npts - 1); |
| 365 | } |
| 366 | break; |
| 367 | |
| 368 | case VTK_TRIANGLE: |
| 369 | case VTK_QUAD: |
| 370 | case VTK_POLYGON: |
| 371 | // Polygons with boundary edges are boundary cells |
| 372 | for (auto i = 0; i < npts; ++i) |
| 373 | { |
| 374 | edgePts[0] = pts[i]; |
| 375 | edgePts[1] = pts[(i + 1) % npts]; |
| 376 | if (input->IsCellBoundary(cellId, 2, edgePts)) |
| 377 | { |
| 378 | marker->MarkCell(cellId, i, 2, edgePts); |
| 379 | } |
| 380 | } |
| 381 | break; |
| 382 | |
| 383 | case VTK_TRIANGLE_STRIP: |
| 384 | // Currently not supported. Internal edges are a pain; |
| 385 | // this could be fixed if needed. |
| 386 | vtkLog(ERROR, "Triangle strips not supported."); |
| 387 | break; |
| 388 | |
| 389 | case VTK_PIXEL: |
no test coverage detected