Struct WeightsToVtkBuilder
pub struct WeightsToVtkBuilder { /* private fields */ }
Expand description
Builder implementation for WeightsToVtk configuration
The fields of WeightsToVtk are left public for direct use but the module also implements a builder.
For those not familiar, the builder allows for chained setter calls for a functional approach that could be considered more readable. Any number of parameters can be set this way (including none).
To get the final WeightsToVtk from the builder, call build().
// Make a new builder, change some values
let converter = WeightsToVtk::builder()
.resolution(3)
.compressor(Compressor::LZMA)
.byte_order(ByteOrder::LittleEndian)
.build();
// Convert the weight windows using the parameters set
let vtk = weights_to_vtk(&WeightWindow::default());
// Wite the VTK to a file in one of several formats
write_vtk(vtk, "output.vtk", VtkFormat::Xml).unwrap();
This helps separate the configuration from the actual conversion logic, and is often a style preference for many users.
Implementations§
§impl WeightsToVtkBuilder
impl WeightsToVtkBuilder
pub fn new() -> WeightsToVtkBuilder
pub fn new() -> WeightsToVtkBuilder
Create a new instance of the builder with default parameters
pub fn build(self) -> WeightsToVtk
pub fn build(self) -> WeightsToVtk
Build the WeightsToVtk type
pub fn resolution(self, resolution: u8) -> WeightsToVtkBuilder
pub fn resolution(self, resolution: u8) -> WeightsToVtkBuilder
Cylindrical mesh resolution
Warning: Every vertex is defined explicitly, so large values will significantly increase memory usage and file size.
Integer value for increasing angular resolution of cylindrical meshes. Cylinders are approximated to straight edge segments so it can be useful to round this off by splitting voxels into multiple smaller segments.
e.g. 4 theta bins gives 4 edges and therefore looks square. Using
--resolution 3
generates 12 edges instead and looks more rounded in
plots.
pub fn byte_order(self, order: ByteOrder) -> WeightsToVtkBuilder
pub fn byte_order(self, order: ByteOrder) -> WeightsToVtkBuilder
Set the byte ordering
Note that Visit being Visit only reads big endian, even though most systems are little endian. The byte order has one variant of the ByteOrder, defaulting to big endian for convenience.
pub fn compressor(self, xml_compressor: Compressor) -> WeightsToVtkBuilder
pub fn compressor(self, xml_compressor: Compressor) -> WeightsToVtkBuilder
Set the compression method for xml file formats
Generally just use LZMA but other options are available:
- lzma (default)
- lz4
- zlib
- none
Trait Implementations§
§impl Default for WeightsToVtkBuilder
impl Default for WeightsToVtkBuilder
§fn default() -> WeightsToVtkBuilder
fn default() -> WeightsToVtkBuilder
Auto Trait Implementations§
impl Freeze for WeightsToVtkBuilder
impl RefUnwindSafe for WeightsToVtkBuilder
impl Send for WeightsToVtkBuilder
impl Sync for WeightsToVtkBuilder
impl Unpin for WeightsToVtkBuilder
impl UnwindSafe for WeightsToVtkBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.