You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
use ndarray::{Array1, Array2, Array3};
use vtk::{Spans2D, Mesh2D, Rectilinear2D};
let nx = 100;
let ny = 100;
// define all the points and their location in the grid
let x_locations : Vec<f64> = Array1::linspace(0., (nx * ny) as f64, nx*ny).to_vec();
let y_locations : Vec<f64> = x_locations.clone();
// vtk::Ascii will render a file that functions perfectly normally
let mesh = Mesh2D::<vtk::Binary>::new(x_locations, y_locations);
// define the global location of this data in the domain
// most of the time, you want something like this:
let spans = Spans2D::new(nx, ny);
// create an object to describe the entire domain
let domain = Rectilinear2D::new(mesh, spans);
#[derive(vtk::DataArray)]
#[vtk_write(encoding="binary")]
pub struct OurData {
pressure: vtk::Scalar2D,
}
let pressure =vtk::Scalar2D::new(Array2::ones((nx,ny)));
let data = OurData { pressure };
let vtk_data = vtk::VtkData::new(domain, data);
let file = std::fs::File::create("./test_vtks/your_file.vtr").unwrap();
let writer = std::io::BufWriter::new(file);
vtk::write_vtk(writer, vtk_data);
Current workaround: use ascii or base64 encoding for arrays
The text was updated successfully, but these errors were encountered:
Example:
Current workaround: use ascii or base64 encoding for arrays
The text was updated successfully, but these errors were encountered: