Struct vtkio::model::DataArrayBase[][src]

pub struct DataArrayBase<E> {
    pub name: String,
    pub elem: E,
    pub data: IOBuffer,
}

A named array of elements.

This is stored as contiguous chunks of components represening and element described by elem.

Fields

name: String

The name of the data array.

elem: E

The type of element stored by the data storage buffer.

data: IOBuffer

A contiguous typed storage buffer.

This stores the actual attribute values in an appropriately typed vector.

Implementations

impl<E> DataArrayBase<E>[src]

pub fn scalar_type(&self) -> ScalarType[src]

Returns the scalar data type stored by the underlying buffer.

pub fn num_elem(&self) -> usize[src]

Returns the number of elements stored by this data array.

This is equal to self.len() / self.num_comp().

pub fn len(&self) -> usize[src]

Returns the raw length of the underlying buffer.

This is equal to self.num_elem() * self.num_comp().

pub fn is_empty(&self) -> bool[src]

Returns true if this data array is empty and false otherwise.

pub fn with_vec<T: ToPrimitive + 'static>(self, data: Vec<T>) -> Self[src]

Assigns data from a Vec to this attribute.

If T is not one of the types supported by IOBuffer, then the given vector will be converted into a Vec<f64> before being assigned. This makes with_vec more forgiving than with_data.

Use this only when the type T is not known ahead of time, otherwise use with_data.

If the data was previously already set, it will be overwritten with the one given in this function.

pub fn with_buf(mut self: Self, data: IOBuffer) -> Self[src]

Assigns data from an IOBuffer to this attribute.

If the data was previously already set, it will be overwritten with the one given in this function.

pub fn with_data(self, new_data: impl Into<IOBuffer>) -> Self[src]

Sets the data of this data array to the given buffer.

If the data was previously already set, it will be overwritten with the one given in this function.

impl DataArrayBase<ElementType>[src]

pub fn scalars_with_lookup(
    name: impl Into<String>,
    num_comp: u32,
    lookup_table: impl Into<String>
) -> Self
[src]

Constructs an empty scalars array with the given lookup table.

pub fn scalars(name: impl Into<String>, num_comp: u32) -> Self[src]

Constructs an empty scalars array.

pub fn color_scalars(name: impl Into<String>, num_comp: u32) -> Self[src]

Constructs an empty color scalars array.

pub fn lookup_table(name: impl Into<String>) -> Self[src]

Constructs an empty lookup table.

pub fn vectors(name: impl Into<String>) -> Self[src]

Constructs an empty vectors array.

pub fn normals(name: impl Into<String>) -> Self[src]

Constructs an empty normals array.

pub fn tensors(name: impl Into<String>) -> Self[src]

Constructs an empty tensors array.

pub fn tcoords(name: impl Into<String>, num_comp: u32) -> Self[src]

Constructs an empty texture coordinates array with the given dimensionality.

pub fn new(name: impl Into<String>, num_comp: u32) -> Self[src]

Constructs an empty generic array with the given number of components.

pub fn num_comp(&self) -> usize[src]

Returns the number of components per element.

This is equal to self.len() / self.num_elem().

impl DataArrayBase<u32>[src]

pub fn new(name: impl Into<String>, num_comp: u32) -> FieldArray[src]

Constructs an empty field array with the given number of components.

pub fn num_comp(&self) -> usize[src]

Returns the number of components per element.

This is equal to self.len() / self.num_elem().

Trait Implementations

impl<E: Clone> Clone for DataArrayBase<E>[src]

impl<E: Debug> Debug for DataArrayBase<E>[src]

impl<E: PartialEq> PartialEq<DataArrayBase<E>> for DataArrayBase<E>[src]

impl<E> StructuralPartialEq for DataArrayBase<E>[src]

Auto Trait Implementations

impl<E> RefUnwindSafe for DataArrayBase<E> where
    E: RefUnwindSafe
[src]

impl<E> Send for DataArrayBase<E> where
    E: Send
[src]

impl<E> Sync for DataArrayBase<E> where
    E: Sync
[src]

impl<E> Unpin for DataArrayBase<E> where
    E: Unpin
[src]

impl<E> UnwindSafe for DataArrayBase<E> where
    E: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.