pub struct VtuWriter { /* private fields */ }Expand description
Builder-style writer for VTK XML unstructured grid (.vtu) files.
Add points, cells, and optional point data; then call VtuWriter::to_xml or
VtuWriter::write_to_file.
Implementations§
Source§impl VtuWriter
impl VtuWriter
Sourcepub fn add_points(&mut self, pts: &[[f64; 3]]) -> usize
pub fn add_points(&mut self, pts: &[[f64; 3]]) -> usize
Add multiple points at once and return the index of the first added point.
Sourcepub fn num_points(&self) -> usize
pub fn num_points(&self) -> usize
Return the number of points currently stored.
Sourcepub fn add_cell(&mut self, connectivity: Vec<usize>, cell_type_id: u8)
pub fn add_cell(&mut self, connectivity: Vec<usize>, cell_type_id: u8)
Add a cell defined by its connectivity (0-based point indices) and VTK cell type.
Sourcepub fn add_triangle(&mut self, i0: usize, i1: usize, i2: usize)
pub fn add_triangle(&mut self, i0: usize, i1: usize, i2: usize)
Add a triangle cell from three point indices.
Sourcepub fn add_quad(&mut self, i0: usize, i1: usize, i2: usize, i3: usize)
pub fn add_quad(&mut self, i0: usize, i1: usize, i2: usize, i3: usize)
Add a quad cell from four point indices.
Sourcepub fn add_tet(&mut self, i0: usize, i1: usize, i2: usize, i3: usize)
pub fn add_tet(&mut self, i0: usize, i1: usize, i2: usize, i3: usize)
Add a tetrahedron cell from four point indices.
Sourcepub fn add_hex(
&mut self,
i0: usize,
i1: usize,
i2: usize,
i3: usize,
i4: usize,
i5: usize,
i6: usize,
i7: usize,
)
pub fn add_hex( &mut self, i0: usize, i1: usize, i2: usize, i3: usize, i4: usize, i5: usize, i6: usize, i7: usize, )
Add a hexahedron cell from eight point indices.
Sourcepub fn add_point_data_scalar(&mut self, name: &str, values: &[f64])
pub fn add_point_data_scalar(&mut self, name: &str, values: &[f64])
Attach a named scalar field on points.
Sourcepub fn add_point_data_vector(&mut self, name: &str, vectors: &[[f64; 3]])
pub fn add_point_data_vector(&mut self, name: &str, vectors: &[[f64; 3]])
Attach a named vector field on points.
Sourcepub fn write_cell_data_tensor(name: &str, tensors: &[[f64; 6]]) -> String
pub fn write_cell_data_tensor(name: &str, tensors: &[[f64; 6]]) -> String
Write symmetric tensor cell data as a VTK XML snippet.
Each cell supplies 6 components (Voigt notation): xx, yy, zz, xy, xz, yz.
Returns an XML DataArray` element string ready to embed in CellData`.
Sourcepub fn write_pvtu_parallel(
piece_files: &[&str],
point_data_names: &[&str],
cell_data_names: &[&str],
) -> String
pub fn write_pvtu_parallel( piece_files: &[&str], point_data_names: &[&str], cell_data_names: &[&str], ) -> String
Generate a parallel VTU master file (.pvtu) referencing the given piece files.
piece_files is a slice of relative paths to the individual .vtu pieces.
Returns the pvtu XML string.
Sourcepub fn add_cell_data_scalar(&mut self, name: &str, values: &[f64])
pub fn add_cell_data_scalar(&mut self, name: &str, values: &[f64])
Attach a named scalar field on cells.
Sourcepub fn add_cell_data_vector(&mut self, name: &str, vectors: &[[f64; 3]])
pub fn add_cell_data_vector(&mut self, name: &str, vectors: &[[f64; 3]])
Attach a named vector field on cells.
Sourcepub fn bounding_box(&self) -> Option<([f64; 3], [f64; 3])>
pub fn bounding_box(&self) -> Option<([f64; 3], [f64; 3])>
Compute the bounding box of all points.
Returns (min, max) or None if there are no points.
Sourcepub fn write_to_file(&self, path: &str) -> Result<()>
pub fn write_to_file(&self, path: &str) -> Result<()>
Write the VTU XML to a file.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the writer state: check that cell connectivity references only existing point indices and that data arrays have correct length.
Sourcepub fn cell_types(&self) -> &[u8] ⓘ
pub fn cell_types(&self) -> &[u8] ⓘ
Return the cell types slice.
Sourcepub fn cells_per_cell(&self) -> &[Vec<usize>]
pub fn cells_per_cell(&self) -> &[Vec<usize>]
Return the per-cell connectivity (each entry is a Vec of point indices).
Sourcepub fn cells_flat(&self) -> Vec<usize>
pub fn cells_flat(&self) -> Vec<usize>
Return a flat connectivity array (concatenation of all cell index lists).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VtuWriter
impl RefUnwindSafe for VtuWriter
impl Send for VtuWriter
impl Sync for VtuWriter
impl Unpin for VtuWriter
impl UnsafeUnpin for VtuWriter
impl UnwindSafe for VtuWriter
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.