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() -> Self
pub fn new() -> Self
Create a new instance of the builder with default parameters
pub fn energy_groups(self, groups: Vec<usize>) -> Self
pub fn energy_groups(self, groups: Vec<usize>) -> Self
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>) -> Self
pub fn time_groups(self, groups: Vec<usize>) -> Self
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) -> Self
pub fn include_errors(self, include: bool) -> Self
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) -> Self
pub fn resolution(self, resolution: u8) -> Self
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) -> Self
pub fn byte_order(self, order: ByteOrder) -> Self
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) -> Self
pub fn compressor(self, xml_compressor: Compressor) -> Self
Set the compression method for xml file formats
Generally just use LZMA but other options are available:
- lzma (default)
- lz4
- zlib
- none
Trait Implementations§
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
§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.