Function write_vtk
pub fn write_vtk(
vtk: Vtk,
path: impl AsRef<Path>,
format: VtkFormat,
) -> Result<(), Error>
Expand description
Write any vtk to file
Takes any VTK and calls the appropriate vtkio writer depending on the desired format.
The file format is set using variants of the VtkFormat enum. The compression and endian options are set as part of the VTK, typically done in the conversion phase.
// Get a mesh
let mesh = read_target("path/to/file.msht", 104).unwrap();
// Convert to VTK with the default configuration
let vtk = mesh_to_vtk(&mesh);
// Wite the VTK to a file in one of several formats
write_vtk(vtk, "output.vtk", VtkFormat::Xml).unwrap();
Note that if this is called manually the path extension must be correct or vtkio will get thow and error.
For XML, the file must end in .vtr
for rectangular meshes (rectilinear
grid), and .vtu
for cylindrical meshes (unstructured). For both legacy
formats .vtk
will work fine.