Enum gut::io::vtk::model::Attribute [−]
pub enum Attribute {
DataArray(DataArrayBase<ElementType>),
Field {
name: String,
data_array: Vec<DataArrayBase<u32>, Global>,
},
}
Expand description
Data structure that stores a VTK attribute.
Variants
DataArray(DataArrayBase<ElementType>)
A data array with any number of components.
This is the standard way to represent data in XML formats.
It is also used to represent VECTORS
, NORMALS
, TEXTURE_COORDINATES
, LOOKUP_TABLE
s,
COLOR_SCALARS
and TENSORS
in the legacy VTK format, each of which are identified by the
elem
field in the DataArray
struct.
Tuple Fields of DataArray
Field attribute.
Essentially an array of arrays of any size. This can be used to represent data for alternative topologies that don’t correspond to the current data set, like UV coordinate topology with seams.
This is a Legacy only attribute type.
Fields of Field
name: String
data_array: Vec<DataArrayBase<u32>, Global>
Implementations
impl Attribute
impl Attribute
Constructs a new scalars attribute with an associated lookup table.
Constructs a new scalars attribute.
pub fn color_scalars(name: impl Into<String>, num_comp: u32) -> Attribute
pub fn color_scalars(name: impl Into<String>, num_comp: u32) -> Attribute
Constructs a new color scalars attribute.
pub fn lookup_table(name: impl Into<String>) -> Attribute
pub fn lookup_table(name: impl Into<String>) -> Attribute
Constructs a new lookup table attribute.
Constructs a new texture coordinates attribute with the given dimensionality.
Constructs a new generic attribute with the given number of components.
Constructs a new field attribute with the given name.
Sets the data of this attribute to the given buffer.
If this attribute is a Field
, then nothing is changed.
If the data was previously already set, it will be overwritten with the one given in this function.
pub fn with_field_data(
self,
arrays: impl IntoIterator<Item = DataArrayBase<u32>>
) -> Attribute
pub fn with_field_data(
self,
arrays: impl IntoIterator<Item = DataArrayBase<u32>>
) -> Attribute
Adds a vector of FieldArray
s to this field attribute.
If this attribute is not a Field
, then nothing is changed.
Examples
If it is more convenient to construct all field arrays individually, one can collect them all at once as follows
use vtkio::model::{Attribute, FieldArray};
let field_arrays = vec![
FieldArray::new("A", 1),
FieldArray::new("B", 2),
FieldArray::new("C", 5),
];
let field = Attribute::field("Data").with_field_data(field_arrays);
pub fn add_field_data(self, data: impl Into<DataArrayBase<u32>>) -> Attribute
pub fn add_field_data(self, data: impl Into<DataArrayBase<u32>>) -> Attribute
Adds a field array to the field attribute.
If this attribute is not a Field
, then nothing is changed.
Examples
One can collect a number of field arrays into a field attribute using with a sequence of
calls to add_field_data
.
use vtkio::model::{Attribute, FieldArray};
let field = Attribute::field("Data")
.add_field_data(FieldArray::new("A", 1))
.add_field_data(FieldArray::new("B", 2))
.add_field_data(FieldArray::new("C", 5));
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Attribute
impl UnwindSafe for Attribute
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> CloneBytes for T where
T: 'static + Clone,
impl<T> CloneBytes for T where
T: 'static + Clone,
pub unsafe fn clone_bytes(
src: &[MaybeUninit<u8>]
) -> Box<[MaybeUninit<u8>], Global>
pub unsafe fn clone_from_bytes(
dst: &mut [MaybeUninit<u8>],
src: &[MaybeUninit<u8>]
)
pub unsafe fn clone_into_raw_bytes(
src: &[MaybeUninit<u8>],
dst: &mut [MaybeUninit<u8>]
)
impl<T> DebugBytes for T where
T: 'static + Debug,
impl<T> DebugBytes for T where
T: 'static + Debug,
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
pub unsafe fn drop_bytes(bytes: &mut [MaybeUninit<u8>])
type Output = <I as GetIndex<'a, S>>::Output
fn at(&self, idx: I) -> Self::Output
fn at(&self, idx: I) -> Self::Output
Return a value at the given index. This is provided as the checked
version of get
that will panic if the equivalent get
call is None
,
which typically means that the given index is out of bounds. Read more
unsafe fn at_unchecked(&self, idx: I) -> Self::Output
unsafe fn at_unchecked(&self, idx: I) -> Self::Output
Return a value at the given index. This is provided as the unchecked
version of get
that has undefined behavior when the index is out of bounds. Read more
type Output = <I as IsolateIndex<S>>::Output
pub unsafe fn isolate_unchecked(self, idx: I) -> <S as Isolate<I>>::Output
pub fn try_isolate(self, idx: I) -> Option<<S as Isolate<I>>::Output>
impl<T> PartialEqBytes for T where
T: 'static + PartialEq<T>,
impl<T> PartialEqBytes for T where
T: 'static + PartialEq<T>,
pub unsafe fn eq_bytes(a: &[MaybeUninit<u8>], b: &[MaybeUninit<u8>]) -> bool
impl<T, N> PushArrayToVec<N> for T where
T: Clone,
N: Array<T>,
impl<T, N> PushArrayToVec<N> for T where
T: Clone,
N: Array<T>,
pub fn push_to_vec(element: <N as Array<T>>::Array, set: &mut Vec<T, Global>)
pub fn push_to_vec(element: <N as Array<T>>::Array, set: &mut Vec<T, Global>)
This method tells this type how it can be pushed to a Vec
as an array.
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.