Skip to main content

VtrWriter

Struct VtrWriter 

Source
pub struct VtrWriter<'a> { /* private fields */ }
Expand description

Builder for one .vtr file. See the module documentation.

All inputs are borrowed; nothing is copied. Inconsistent inputs (wrong array lengths, duplicate names, non-increasing coordinates, …) are reported as Error::Invalid by write / write_to before anything is written.

Implementations§

Source§

impl<'a> VtrWriter<'a>

Source

pub fn new(x: &'a [f64], y: &'a [f64], z: &'a [f64]) -> Self

Starts a file for the rectilinear grid with coordinates x, y, z (metres, each non-empty and strictly increasing).

Source

pub fn encoding(self, encoding: Encoding) -> Self

Sets the data encoding (default Encoding::Binary).

Source

pub fn header_type(self, header: HeaderType) -> Self

Sets the binary header type (default HeaderType::UInt64).

Source

pub fn time(self, t: f64) -> Self

Stores t as the TimeValue field-data entry, the time ParaView assigns to this dataset. For a frequency-domain dump, pass the frequency (and consider also adding it with field under a descriptive name).

Source

pub fn field(self, name: impl Into<String>, values: &'a [f64]) -> Self

Adds a Float64 field-data array (dataset-wide metadata, not attached to points or cells), e.g. field("Frequency", &[f]).

Source

pub fn point<T: VtkFloat>( self, name: impl Into<String>, field: Field<'a, T>, layout: Layout, ) -> Self

Adds a point array (one tuple per grid node).

Source

pub fn cell<T: VtkFloat>( self, name: impl Into<String>, field: Field<'a, T>, layout: Layout, ) -> Self

Adds a cell array (one tuple per grid cell).

Source

pub fn point_scalar<T: VtkFloat>( self, name: impl Into<String>, data: &'a [T], layout: Layout, ) -> Self

Adds a scalar point array; shorthand for point(name, Field::Scalar(data), layout).

Source

pub fn point_vector<T: VtkFloat>( self, name: impl Into<String>, data: &'a [[T; 3]], layout: Layout, ) -> Self

Adds an interleaved vector point array; shorthand for point(name, Field::Vector(data), layout).

Source

pub fn cell_scalar<T: VtkFloat>( self, name: impl Into<String>, data: &'a [T], layout: Layout, ) -> Self

Adds a scalar cell array; shorthand for cell(name, Field::Scalar(data), layout).

Source

pub fn cell_vector<T: VtkFloat>( self, name: impl Into<String>, data: &'a [[T; 3]], layout: Layout, ) -> Self

Adds an interleaved vector cell array; shorthand for cell(name, Field::Vector(data), layout).

Source

pub fn point_complex<T: VtkFloat>( self, name: &str, re: Field<'a, T>, im: Field<'a, T>, layout: Layout, form: ComplexForm, ) -> Self

Adds a complex point array as two real arrays (see ComplexForm). re and im must have the same shape (both scalar or both vector).

Source

pub fn cell_complex<T: VtkFloat>( self, name: &str, re: Field<'a, T>, im: Field<'a, T>, layout: Layout, form: ComplexForm, ) -> Self

Adds a complex cell array as two real arrays (see ComplexForm). re and im must have the same shape (both scalar or both vector).

Source

pub fn write(&self, path: impl AsRef<Path>) -> Result<()>

Writes the file to path (buffered).

Source

pub fn write_to<W: Write>(&self, w: W) -> Result<()>

Writes the file to w. The output is produced in many small writes; wrap unbuffered sinks (files, sockets) in a BufWriter.

Trait Implementations§

Source§

impl<'a> Clone for VtrWriter<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for VtrWriter<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for VtrWriter<'a>

§

impl<'a> RefUnwindSafe for VtrWriter<'a>

§

impl<'a> Send for VtrWriter<'a>

§

impl<'a> Sync for VtrWriter<'a>

§

impl<'a> Unpin for VtrWriter<'a>

§

impl<'a> UnsafeUnpin for VtrWriter<'a>

§

impl<'a> UnwindSafe for VtrWriter<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.