<div>Hi,</div>
<div> </div>
<div>I am traversing cells in an unstructured grid the following way:</div>
<div> </div>
<div>vtkCellArray *cells = vtkCellArray::New();</div>
<div>cells->InitTraversal();</div>
<div> </div>
<div>int npts, *pts;</div>
<div> </div>
<div>while(cells->GetNextCell(npts, pts))</div>
<div>{</div>
<div>...</div>
<div>}</div>
<div> </div>
<div>This way I obtain the cell with points "pts" 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> </div>
<div>I could use another approach with the function ugrid->GetCell(cellId) in a for-loop to get my cells, where I simply loop over an increasing index "cellId", 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> </div>
<div>So my question is, is there a (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> </div>
<div>Thanks,</div>
<div> </div>
<div>/Mark</div>
<div> </div>
<div> </div>