@@ -11,7 +11,7 @@ use splashsurf_lib::vtkio;
1111use splashsurf_lib:: Real ;
1212
1313use vtkio:: model:: { ByteOrder , DataSet , Version , Vtk } ;
14- use vtkio:: { export_be , import_be , IOBuffer } ;
14+ use vtkio:: IOBuffer ;
1515
1616/// Tries to read a set of particles from the VTK file at the given path
1717pub fn particles_from_vtk < R : Real , P : AsRef < Path > > (
@@ -42,6 +42,7 @@ pub fn write_vtk<P: AsRef<Path>>(
4242 let vtk_file = Vtk {
4343 version : Version :: new ( ( 4 , 1 ) ) ,
4444 title : title. to_string ( ) ,
45+ file_path : None ,
4546 byte_order : ByteOrder :: BigEndian ,
4647 data : data. into ( ) ,
4748 } ;
@@ -50,13 +51,15 @@ pub fn write_vtk<P: AsRef<Path>>(
5051 if let Some ( dir) = filename. parent ( ) {
5152 create_dir_all ( dir) . context ( "Failed to create parent directory of output file" ) ?;
5253 }
53- export_be ( vtk_file, filename) . context ( "Error while writing VTK output to file" )
54+ vtk_file
55+ . export_be ( filename)
56+ . context ( "Error while writing VTK output to file" )
5457}
5558
5659/// Tries to read the given file into a VTK `DataSet`
5760pub fn read_vtk < P : AsRef < Path > > ( filename : P ) -> Result < DataSet , vtkio:: Error > {
5861 let filename = filename. as_ref ( ) ;
59- import_be ( filename) . map ( |vtk| vtk. data )
62+ Vtk :: import_legacy_be ( filename) . map ( |vtk| vtk. data )
6063}
6164
6265/// Tries to convert a vector of consecutive coordinate triplets into a vector of `Vector3`, also converts between floating point types
@@ -85,7 +88,7 @@ pub fn particles_from_dataset<R: Real>(dataset: DataSet) -> Result<Vec<Vector3<R
8588 if let DataSet :: UnstructuredGrid { pieces, .. } = dataset {
8689 if let Some ( piece) = pieces. into_iter ( ) . next ( ) {
8790 let points = piece
88- . load_piece_data ( )
91+ . into_loaded_piece_data ( None )
8992 . context ( "Failed to load unstructured grid piece" ) ?
9093 . points ;
9194
0 commit comments