@@ -22,15 +22,9 @@ pub struct FormatParameters {
2222}
2323
2424/// File format parameters for input files
25- #[ derive( Clone , Debug ) ]
25+ #[ derive( Clone , Debug , Default ) ]
2626pub struct InputFormatParameters { }
2727
28- impl Default for InputFormatParameters {
29- fn default ( ) -> Self {
30- Self { }
31- }
32- }
33-
3428/// File format parameters for output files
3529#[ derive( Clone , Debug ) ]
3630pub struct OutputFormatParameters {
@@ -107,7 +101,7 @@ pub fn read_particle_positions_with_attributes<R: Real, P: AsRef<Path>>(
107101
108102 let vtk_pieces = VtkFile :: load_file ( input_file)
109103 . map ( |f| f. into_pieces ( ) )
110- . with_context ( || format ! ( "Failed to load particle positions from file" ) ) ?;
104+ . with_context ( || "Failed to load particle positions from file" . to_string ( ) ) ?;
111105
112106 if vtk_pieces. len ( ) > 1 {
113107 warn ! ( "VTK file contains more than one \" piece\" . Only the first one will be loaded." ) ;
@@ -176,13 +170,13 @@ pub fn write_particle_positions<R: Real, P: AsRef<Path>>(
176170 . ok_or ( anyhow ! ( "Invalid extension of output file" ) ) ?;
177171
178172 match extension. to_lowercase ( ) . as_str ( ) {
179- "vtk" => vtk_format:: particles_to_vtk ( particles, & output_file) ,
173+ "vtk" => vtk_format:: particles_to_vtk ( particles, output_file) ,
180174 "bgeo" => bgeo_format:: particles_to_bgeo (
181175 particles,
182- & output_file,
176+ output_file,
183177 format_params. enable_compression ,
184178 ) ,
185- "json" => json_format:: particles_to_json ( particles, & output_file) ,
179+ "json" => json_format:: particles_to_json ( particles, output_file) ,
186180 _ => Err ( anyhow ! (
187181 "Unsupported file format extension \" {}\" for writing particles" ,
188182 extension
@@ -214,8 +208,8 @@ pub fn read_surface_mesh<R: Real, P: AsRef<Path>>(
214208 . ok_or ( anyhow ! ( "Invalid extension of input file" ) ) ?;
215209
216210 match extension. to_lowercase ( ) . as_str ( ) {
217- "vtk" => vtk_format:: surface_mesh_from_vtk ( & input_file) ,
218- "ply" => ply_format:: surface_mesh_from_ply ( & input_file) ,
211+ "vtk" => vtk_format:: surface_mesh_from_vtk ( input_file) ,
212+ "ply" => ply_format:: surface_mesh_from_ply ( input_file) ,
219213 _ => Err ( anyhow ! (
220214 "Unsupported file format extension \" {}\" for reading surface meshes" ,
221215 extension
@@ -261,9 +255,9 @@ where
261255 . ok_or ( anyhow ! ( "Invalid extension of output file" ) ) ?;
262256
263257 match extension. to_lowercase ( ) . as_str ( ) {
264- "vtk" => vtk_format:: write_vtk ( mesh, & output_file, "mesh" ) ,
265- "ply" => ply_format:: mesh_to_ply ( mesh, & output_file) ,
266- "obj" => obj_format:: mesh_to_obj ( mesh, & output_file) ,
258+ "vtk" => vtk_format:: write_vtk ( mesh, output_file, "mesh" ) ,
259+ "ply" => ply_format:: mesh_to_ply ( mesh, output_file) ,
260+ "obj" => obj_format:: mesh_to_obj ( mesh, output_file) ,
267261 _ => Err ( anyhow ! (
268262 "Unsupported file format extension \" {}\" " ,
269263 extension,
0 commit comments