<div>Hi,</div>
<div>&nbsp;</div>
<div>I am traversing cells in an unstructured grid the following way:</div>
<div>&nbsp;</div>
<div>vtkCellArray *cells = vtkCellArray::New();</div>
<div>cells-&gt;InitTraversal();</div>
<div>&nbsp;</div>
<div>int npts, *pts;</div>
<div>&nbsp;</div>
<div>while(cells-&gt;GetNextCell(npts, pts))</div>
<div>{</div>
<div>...</div>
<div>}</div>
<div>&nbsp;</div>
<div>This way I obtain the cell with points &quot;pts&quot; in constant time O(1), but I lose any kind of direct cell identification. I need to use many of the functions where I need cellId's, like GetCellNeighbors(cellId, ...).
</div>
<div>&nbsp;</div>
<div>I could use another approach with the function ugrid-&gt;GetCell(cellId) in a for-loop to get my cells, where I simply loop over an increasing index &quot;cellId&quot;, and later obtain the pointId's and coordinates, etc. But the call to GetCell is supposed to be worst case O(n) (really true?) in time, and if I traverse a grid of n cells, this might end up being worst case O(n^2) in time. With a large number of cells this probably is not a good idea.
</div>
<div>&nbsp;</div>
<div>So my question is, is there a&nbsp;(fast) way to keep an identification of which cell I just got the points from in the above GetNextCell-method using a vtkCellArray? Or any other recommendation.</div>
<div>&nbsp;</div>
<div>Thanks,</div>
<div>&nbsp;</div>
<div>/Mark</div>
<div>&nbsp;</div>
<div>&nbsp;</div>