Module vtk
Expand description
Conversion to Visual Toolkit (VTK) formats
This module handles all the conversions of weight window sets to Visual
Toolkit formats, and is mostly a coupling layer between internal types and
the vtkio
crate.
§Overview
The intended workflow is to:
- Configure the converter
- Convert into a
vtkio
VTK - Write to file in the required format with write_vtk()
Often the default configuration will suffice. The convenience function weights_to_vtk() will quickly convert to a VTK ready for writing with write_vtk().
// Convert to VTK with the default configuration
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();
For more comprehensive examples, see the relevant struct documentation and the next section.
§Manual conversion
The fields of WeightsToVtk are left public for direct use but builder patterns are also implemented. A builder helps separate the configuration from the conversion logic, and is often a style preference.
The following examples are therefore equivalent.
§The builder approach:
// 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());
§The direct approach:
// Make a new instance, change some values
let mut converter = WeightsToVtk::new();
converter.resolution = 2;
converter.compressor = Compressor::LZMA;
converter.byte_order = ByteOrder::LittleEndian;
// Convert the weight windows using the parameters set
let vtk = weights_to_vtk(&WeightWindow::default());
In the background, a call to WeightsToVtk::new() simply returns a default configuration generated by the builder anyway.
Structs§
- Vertex
- Vertex for use in cylindrical and unstructured mesh types
- Weights
ToVtk - Convert weight window sets to vtk formats for plotting
- Weights
ToVtk Builder - Builder implementation for WeightsToVtk configuration
Enums§
- VtkFormat
- Enum of VTK output formats
Functions§
- weights_
to_ vtk - Convert a set of weight windows to vtk using default options
- write_
vtk - Write any vtk to file