vtkCellGridEvaluator

Struct vtkCellGridEvaluator 

Source
pub struct vtkCellGridEvaluator(/* private fields */);
Expand description

Evaluate a field (vtkCellAttribute) at some points inside cells.

This class is a cell-grid query whose purpose is to determine the value a vtkCellAttribute takes on at one or more points inside the domain of a vtkCellGrid.

This class performs its work in two phases:

  • Classification. Input points are classified by the type and index of cell in the grid in which they lie.
  • Attribute/field interpolation. Each cell is asked to interpolate the value of a cell-attribute at each point classified to it.

As an example, consider a cell-grid holding 10 triangles and 20 quads and a query that is provided 5 points. The first phase will identify which of the 5 points are insides triangles, which lie in quadrilaterals, and which lie in neither. Say that 2 lie inside triangles, 2 inside quadrilaterals, and 1 is outside the domain. Furthermore, the first phase will identify which particular triangles or quadrilaterals contain the input points. The two points which lie in triangles will report a number in [0,10[ while the two points which lie in quadrilaterals will report a number in [0, 20[. Finally, for cells which have a reference element, the parametric coordinates of each input point are computed.

The second phase additionally interpolates a cell-attribute (let’s say “Velocity” in our example) at each input point.

You may configure the query to skip either phase (classification or interpolation). If you skip classification, you must provide the the classification information for the input points. The method you call (ClassifyPoints, InterpolatePoints, or InterpolateCellParameters) determines which phase(s) are applied during evaluation.

When running in InterpolatePoints mode (both classification and interpolation phases are performed), the output from our example is reported like so:

  • GetClassifierCellTypes() – returns an array with a cell-type hash for each type of cell containing an input point. The hash value can be used to construct a vtkStringToken. Our example would return an array with 3 values which might be ordered: “vtkDGTri”_hash, “vtkDGQuad”_hash, and 0 (an “invalid” hash).
  • GetClassifierCellOffsets() – returns an array with the same number of values as the call above. Each value specifies the start of reporting for points contained in the corresponding cell type. Our example would return [0, 2, 4] to match the values above.
  • GetClassifierPointIDs() – returns an array whose length matches the number of input points. Each value is the index of an input point. Input points do not have their order preserved so that all the points contained in a single cell can be reported together. Our example might return [4, 2, 1, 0, 3]. This will always be a permutation of the counting integers and, for our example, always hold integers in [0, 5[.
  • GetClassifierCellIndices() – returns an array whose length matches the number of input points. Each value is the index into cells of the corresponding type, indicating which cell contains the input point. For our example, the first two numbers will be in [0, 10[, the second two will be in [0, 20[, and the last will be -1. (This is because we have two points inside 10 triangles, two points inside 20 quads, and one un-classifiable input point.)
  • GetClassifierPointParameters() – returns an array whose length matches the number of input points. Each value is a 3-tuple of reference-cell coordinates (or indeterminate if the cell type does not provide a reference cell).
  • GetInterpolatedValues() – returns an array whose number of tuples matches the number of input points and whose number of components matches the number of components of the requested cell-attribute. For our example, an array with 5 tuples of 3 components each would be returned; it would be named “Velocity” (matching the cell-attribute’s name).

Note that because you can pass in the arrays above (except the interpolated values) to short-circuit classification, it is possible to evaluate multiple cell-attributes without duplicating the classification work.

In InterpolateCellParameters mode, calling the methods above which begin with GetClassifier… will simply return the input arrays you passed to configure the query.

§Warnings

The output arrays above generally match the number of input points, but will sometimes exceed the number of input points. This will occur when multiple cells contain an input point (either on a shared boundary or because the cells overlap).

Note that the output should never have fewer points than the input as even points outside the cells will be classified as such.

Currently, this class is limited to evaluating numeric attributes; string or variant arrays are not supported.

Implementations§

Source§

impl vtkCellGridEvaluator

Source

pub fn new() -> Self

Creates a new vtkCellGridEvaluator wrapped inside vtkNew

Trait Implementations§

Source§

impl Default for vtkCellGridEvaluator

Source§

fn default() -> Self

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

impl Drop for vtkCellGridEvaluator

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.