Struct MeshToVtk
pub struct MeshToVtk {
pub energy_groups: Vec<usize>,
pub time_groups: Vec<usize>,
pub include_errors: bool,
pub byte_order: ByteOrder,
pub compressor: Compressor,
pub resolution: u8,
}
Expand description
Convert mesh tallies to vtk formats for plotting
All of the of logic for converting voxel data 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.
§General properties
§Error meshes
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, but that is fine in most cases.
// Include error meshes for each result
let converter = MeshToVtk::builder()
.include_errors(true)
.build();
§Target specific voxel groups
Important: By default all energy groups are included in the vtk.
Specific energy groups can be provided to reduce file sizes. This is also especially useful if only certain groups are of interest.
For specific energy/time groups:
// Choose specific energy and time groups by group index
let converter = MeshToVtk::builder()
.energy_groups(vec![0, 1, 2, 6])
.build();
If the groups indicies are unknown the index may be found with:
// Find the group index of a 20 MeV particle and index of the "total" group
let e_idx = vec![
mesh.energy_index_from_group(Group::Value(20.0)).unwrap(),
mesh.energy_index_from_group(Group::Total).unwrap()
];
§Vtk 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.
// Change the byte ordering to little endian
let converter = MeshToVtk::builder()
.byte_order(ByteOrder::LittleEndian)
.build();
Perhaps less useful is the compression method for XML file formats, but it is included for completeness anyway.
// Select the LZMA compression method
let converter = MeshToVtk::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.
For example:
// Split every theta bin into 3 to round off the edges
let converter = MeshToVtk::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§
§energy_groups: Vec<usize>
Target energy group(s)
time_groups: Vec<usize>
Target energy group(s)
include_errors: bool
Include errors mesh in output files
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 MeshToVtk
impl MeshToVtk
pub fn builder() -> MeshToVtkBuilder
pub fn builder() -> MeshToVtkBuilder
Get an instance of the MeshToVtkBuilder
impl MeshToVtk
Common use implementations
impl MeshToVtk
Implementations for proecessing Rectangular mesh types
impl MeshToVtk
Implementations for proecessing Cylindrical mesh types
Trait Implementations§
impl StructuralPartialEq for MeshToVtk
Auto Trait Implementations§
impl Freeze for MeshToVtk
impl RefUnwindSafe for MeshToVtk
impl Send for MeshToVtk
impl Sync for MeshToVtk
impl Unpin for MeshToVtk
impl UnwindSafe for MeshToVtk
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.