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

Function GetCellNeighborsImpl

Common/DataModel/vtkPolyData.cxx:1277–1315  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1275// use all the points in the points list (pts).
1276template <class TLinks>
1277inline void GetCellNeighborsImpl(
1278 TLinks* links, vtkIdType cellId, vtkIdType numPts, const vtkIdType* pts, vtkIdList* cellIds)
1279{
1280 const vtkIdType nCells0 = links->GetNcells(pts[0]);
1281 const vtkIdType* cells0 = links->GetCells(pts[0]);
1282
1283 // for each potential cell
1284 for (vtkIdType j = 0; j < nCells0; ++j)
1285 {
1286 // ignore the original cell
1287 if (cells0[j] != cellId)
1288 {
1289 // are all the remaining points in the cell ?
1290 bool match = true;
1291 for (vtkIdType i = 1; i < numPts && match; i++)
1292 {
1293 const vtkIdType nCellsI = links->GetNcells(pts[i]);
1294 const vtkIdType* cellsI = links->GetCells(pts[i]);
1295
1296 match = false;
1297 for (vtkIdType k = 0; k < nCellsI; k++)
1298 {
1299 if (cells0[j] == cellsI[k])
1300 {
1301 match = true;
1302 break;
1303 }
1304 }
1305 }
1306 if (match)
1307 {
1308 // For degenerate cells, the same cells are linked several times to the degenerate
1309 // point. So InsertUniqueId is used to prevent duplicates. This is not impacting
1310 // performances compared to InsertNextId, because most of the time, cellIds is empty.
1311 cellIds->InsertUniqueId(cells0[j]);
1312 }
1313 }
1314 }
1315}
1316} // end anonymous namespace
1317
1318//------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 2

InsertUniqueIdMethod · 0.80
GetCellsMethod · 0.45

Tested by

no test coverage detected