Struct MeshToVtkBuilder
pub struct MeshToVtkBuilder { /* private fields */ }
Expand description
Builder implementation for MeshToVtk configuration
The fields of MeshToVtk 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 MeshToVtk from the builder, call build().
// Make a new builder, change some values
let converter = MeshToVtk::builder()
.include_errors(true)
.energy_groups(vec![0]) // first energy group
.time_groups(vec![1, 2]) // second and third time groups
.compressor(Compressor::LZMA)
.byte_order(ByteOrder::LittleEndian)
.resolution(3)
.build();
// Convert the mesh using the parameters set
let vtk = converter.convert(&mesh);
// Write to "output.vtk" using the old ASCII text format
write_vtk(vtk, "./output.vtk", VtkFormat::LegacyAscii).unwrap();
This helps separate the configuration from the actual conversion logic, and is often a style preference for many users.
Implementations§
§impl MeshToVtkBuilder
impl MeshToVtkBuilder
pub fn new() -> MeshToVtkBuilder
pub fn new() -> MeshToVtkBuilder
Create a new instance of the builder with default parameters
pub fn energy_groups(self, groups: Vec<usize>) -> MeshToVtkBuilder
pub fn energy_groups(self, groups: Vec<usize>) -> MeshToVtkBuilder
Target energy group(s)
By default all energy groups are included in the vtk. Specific energy groups can be provided to reduce file sizes.
pub fn time_groups(self, groups: Vec<usize>) -> MeshToVtkBuilder
pub fn time_groups(self, groups: Vec<usize>) -> MeshToVtkBuilder
Target time group(s)
By default all time groups are included in the vtk. Specific time groups can be provided to reduce file sizes.
pub fn include_errors(self, include: bool) -> MeshToVtkBuilder
pub fn include_errors(self, include: bool) -> MeshToVtkBuilder
Include errors mesh in output files
Error meshes omitted by default to save space. If enabled, every mesh will have a corresponding relative uncertainty dataset. Of course, this ~doubles file size, which is fine in most cases.
pub fn resolution(self, resolution: u8) -> MeshToVtkBuilder
pub fn resolution(self, resolution: u8) -> MeshToVtkBuilder
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) -> MeshToVtkBuilder
pub fn byte_order(self, order: ByteOrder) -> MeshToVtkBuilder
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) -> MeshToVtkBuilder
pub fn compressor(self, xml_compressor: Compressor) -> MeshToVtkBuilder
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 MeshToVtkBuilder
impl Default for MeshToVtkBuilder
§fn default() -> MeshToVtkBuilder
fn default() -> MeshToVtkBuilder
Auto Trait Implementations§
impl Freeze for MeshToVtkBuilder
impl RefUnwindSafe for MeshToVtkBuilder
impl Send for MeshToVtkBuilder
impl Sync for MeshToVtkBuilder
impl Unpin for MeshToVtkBuilder
impl UnwindSafe for MeshToVtkBuilder
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.