vtkCellArrayIterator

Struct vtkCellArrayIterator 

Source
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

Source

pub fn new() -> Self

Creates a new vtkCellArrayIterator wrapped inside vtkNew

Trait Implementations§

Source§

impl Default for vtkCellArrayIterator

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for vtkCellArrayIterator

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.