Struct WeightsToVtk

pub struct WeightsToVtk {
    pub byte_order: ByteOrder,
    pub compressor: Compressor,
    pub resolution: u8,
}
Expand description

Convert weight window sets to vtk formats for plotting

All of the of logic for converting weight window sets into the right VTK types and formats is implemented here. This includes calculating verticies for cylindrical cases as an unstructured mesh.

The fields remain public for direct use, but for convenience and style preference a builder pattern is also implemented and recommended.

§Formatting

Included are a couple of more advanced options for VTK preferences.

Most useful is the byte ordering, which is important for binary file compatability with plotting software. ParaView does not care, but something like Visit only likes big endian. This is the default for convenience but is completely up to the user.

let converter = WeightsToVtk::builder()
    .byte_order(ByteOrder::LittleEndian)
    .build();

Perhaps less useful is the compression method for XML file formats, but it is included for completeness anyway.

let converter = WeightsToVtk::builder()
    .compressor(Compressor::LZMA)
    .build();

Generally just use LZMA but other options are available:

  • lzma (default)
  • lz4
  • zlib
  • none

§A note on Cylindrical meshes

There is no VTK representation of cylindrical meshes, so an unstructured mesh is generated from verticies based on the RZT bounds.

Unfortunately, this can result in “low-resolution” plots for meshes with few theta bins. The number of theta bins can be increased to round off these edges. This simply subdivides the voxels by an integer number of theta bins.

Cylindrical mesh resolution option

For example:

let converter = WeightsToVtk::builder()
    .resolution(3)
    .build();

Setting the resolution to 3 will subbdivide the theta bins into 3, thereby tripling the number of edges plotted from 8 to 24 for a more rounded look.

Note that this can increase memory usage and file size significantly but is a nice feature for generating more accurate cylinders.

Fields§

§byte_order: ByteOrder

Byte ordering as big or little endian

§compressor: Compressor

compression method for xml file formats

§resolution: u8

Cylindrical mesh resolution

Implementations§

§

impl WeightsToVtk

pub fn new() -> WeightsToVtk

Start with the default configuration

pub fn builder() -> WeightsToVtkBuilder

Get an instance of the WeightsToVtkBuilder

pub fn convert(&self, weight_window: &WeightWindow) -> Vtk

Convert a WeightWindow to Vtk object

Once the configuration is set through either the builder or changing the fields directly, convert any WeightWindow into a Vtk ready for writing or futher processing.

§

impl WeightsToVtk

This impl block contains no items.

Implementations for proecessing Rectangular mesh types

§

impl WeightsToVtk

This impl block contains no items.

Implementations for proecessing Cylindrical mesh types

Trait Implementations§

§

impl Debug for WeightsToVtk

§

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

Formats the value using the given formatter. Read more
§

impl Default for WeightsToVtk

§

fn default() -> WeightsToVtk

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

impl PartialEq for WeightsToVtk

§

fn eq(&self, other: &WeightsToVtk) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl StructuralPartialEq for WeightsToVtk

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.