pub struct vtkCellArrayIterator(/* private fields */);Expand description
Encapsulate traversal logic for vtkCellArray.
This is iterator for thread-safe traversal of a vtkCellArray. It provides random access and forward iteration. Typical usage for forward iteration looks like:
auto iter = vtk::TakeSmartPointer(cellArray->NewIterator());
for (iter->GoToFirstCell(); !iter->IsDoneWithTraversal(); iter->GoToNextCell())
{
// do work with iter
iter->GetCurrentCell(numCellPts, cellPts);
}Typical usage for random access looks like:
auto iter = vtk::TakeSmartPointer(cellArray->NewIterator());
iter->GetCellAtId(cellId, numCellPts, cellPts);Here @a cellId is the id of the ith cell in the vtkCellArray; @a numCellPts is the number of points defining the cell represented as vtkIdType; and @a cellPts is a pointer to the point ids defined as vtkIdType const*&.
Internally the iterator may copy data from the vtkCellArray, or reference the internal vtkCellArray storage. This depends on the relationship of vtkIdType to the type and structure of internal storage. If the type of storage is the same as vtkIdType, and the storage is a single-component AOS array (i.e., a 1D array), then shared access to the vtkCellArray storage is provided. Otherwise, the data from storage is copied into an internal iterator buffer. (Of course copying is slower and can result in 3-4x reduction in traversal performance. On the other hand, the vtkCellArray can use the appropriate storage to save memory, perform zero-copy, and/or efficiently represent the cell connectivity information.) Note that referencing internal vtkCellArray storage has implications on the validity of the iterator. If the underlying vtkCellArray storage changes while iterating, and the iterator is referencing this storage, unpredictable and catastrophic results are likely - hence do not modify the vtkCellArray while iterating.
@sa vtkCellArray
Implementations§
Source§impl vtkCellArrayIterator
impl vtkCellArrayIterator
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new vtkCellArrayIterator wrapped inside vtkNew