diff --git a/splashsurf/src/reconstruction.rs b/splashsurf/src/reconstruction.rs index 6a5bd8a..a93e645 100644 --- a/splashsurf/src/reconstruction.rs +++ b/splashsurf/src/reconstruction.rs @@ -459,8 +459,8 @@ mod arguments { } fn try_aabb_from_min_max( - min: &Vec, - max: &Vec, + min: &[f64], + max: &[f64], error_str: &'static str, ) -> Result, anyhow::Error> { // This should already be ensured by StructOpt parsing @@ -468,8 +468,8 @@ mod arguments { assert_eq!(max.len(), 3); let aabb = Aabb3d::new( - Vector3::from_iterator(min.clone()), - Vector3::from_iterator(max.clone()), + Vector3::from_column_slice(min), + Vector3::from_column_slice(max), ); if !aabb.is_consistent() { diff --git a/splashsurf_lib/src/aabb.rs b/splashsurf_lib/src/aabb.rs index b5ec7e5..8545b95 100644 --- a/splashsurf_lib/src/aabb.rs +++ b/splashsurf_lib/src/aabb.rs @@ -209,7 +209,7 @@ where /// Returns the geometric centroid of the AABB (mean of the corner points) pub fn centroid(&self) -> SVector { - &self.min + (self.extents() / (R::one() + R::one())) + self.min + (self.extents() / (R::one() + R::one())) } /// Checks if the given AABB is inside of the AABB, the AABB is considered to be half-open to its max coordinate @@ -236,7 +236,7 @@ where /// Multiplies a uniform, local scaling to the AABB (i.e. multiplying its extents as if it was centered at the origin) pub fn scale_uniformly(&mut self, scaling: R) { let center = self.centroid(); - self.translate(&(¢er * R::one().neg())); + self.translate(&(center * R::one().neg())); self.min *= scaling; self.max *= scaling; self.translate(¢er); diff --git a/splashsurf_lib/src/io/bgeo_format.rs b/splashsurf_lib/src/io/bgeo_format.rs index bdbb206..b5fbbeb 100644 --- a/splashsurf_lib/src/io/bgeo_format.rs +++ b/splashsurf_lib/src/io/bgeo_format.rs @@ -719,10 +719,7 @@ mod error { impl BgeoParserErrorKind { /// Returns whether the variant is an internal nom error pub fn is_nom_error(&self) -> bool { - match self { - BgeoParserErrorKind::NomError(_) => true, - _ => false, - } + matches!(self, BgeoParserErrorKind::NomError(_)) } } diff --git a/splashsurf_lib/src/io/vtk_format.rs b/splashsurf_lib/src/io/vtk_format.rs index 8922f96..150c22a 100644 --- a/splashsurf_lib/src/io/vtk_format.rs +++ b/splashsurf_lib/src/io/vtk_format.rs @@ -361,7 +361,7 @@ fn try_map_scalars_to_real Result( - coords: &Vec, + coords: &[RealIn], ) -> Result>, anyhow::Error> { if coords.len() % 3 != 0 { return Err(anyhow!( diff --git a/splashsurf_lib/src/lib.rs b/splashsurf_lib/src/lib.rs index 1d497f8..7e5e42b 100644 --- a/splashsurf_lib/src/lib.rs +++ b/splashsurf_lib/src/lib.rs @@ -9,18 +9,18 @@ //! The following features are all non-default features to reduce the amount of additional dependencies. //! //! - **`vtk_extras`**: Enables helper functions and trait implementations to export meshes using [`vtkio`](https://github.com/elrnv/vtkio). -//! In particular it adds `From` impls for the [mesh] types used by this crate to convert them to -//! [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) and [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html) -//! types. If the feature is enabled, The crate exposes its `vtkio` dependency as `splashsurflib::vtkio`. +//! In particular it adds `From` impls for the [mesh] types used by this crate to convert them to +//! [`vtkio::model::UnstructuredGridPiece`](https://docs.rs/vtkio/0.6.*/vtkio/model/struct.UnstructuredGridPiece.html) and [`vtkio::model::DataSet`](https://docs.rs/vtkio/0.6.*/vtkio/model/enum.DataSet.html) +//! types. If the feature is enabled, The crate exposes its `vtkio` dependency as `splashsurflib::vtkio`. //! - **`io`**: Enables the [`io`] module, containing functions to load and store particle and mesh files -//! from various file formats, e.g. `VTK`, `OBJ`, `BGEO` etc. This feature implies the `vtk_extras` feature. -//! It is disabled by default because a pure "online" surface reconstruction might not need any file IO. -//! The feature adds several dependencies to support the file formats. +//! from various file formats, e.g. `VTK`, `OBJ`, `BGEO` etc. This feature implies the `vtk_extras` feature. +//! It is disabled by default because a pure "online" surface reconstruction might not need any file IO. +//! The feature adds several dependencies to support the file formats. //! - **`profiling`**: Enables profiling of internal functions. The resulting data can be displayed using the functions -//! from the [`profiling`] module of this crate. Furthermore, it exposes the [`profile`] macro that can be used e.g. -//! by binary crates calling into this library to add their own profiling scopes to the measurements. -//! If this features is not enabled, the macro will just expend to a no-op and remove the (small) -//! performance overhead of the profiling. +//! from the [`profiling`] module of this crate. Furthermore, it exposes the [`profile`] macro that can be used e.g. +//! by binary crates calling into this library to add their own profiling scopes to the measurements. +//! If this features is not enabled, the macro will just expend to a no-op and remove the (small) +//! performance overhead of the profiling. //! use log::info; diff --git a/splashsurf_lib/src/marching_cubes.rs b/splashsurf_lib/src/marching_cubes.rs index 9aa3bb4..2d1080b 100644 --- a/splashsurf_lib/src/marching_cubes.rs +++ b/splashsurf_lib/src/marching_cubes.rs @@ -167,7 +167,7 @@ pub fn check_mesh_consistency( .get_point(*cell_index.index()) .expect("Unable to get point index of cell"); let cell_center = grid.point_coordinates(&point_index) - + &Vector3::repeat(grid.cell_size().times_f64(0.5)); + + Vector3::repeat(grid.cell_size().times_f64(0.5)); *error_string += &format!("\n\tTriangle {}, boundary edge {:?} is located in cell with {:?} with center coordinates {:?} and edge length {}.", tri_idx, edge, cell_index, cell_center, grid.cell_size()); } else { @@ -242,7 +242,7 @@ fn check_mesh_with_cell_data( .get_point(*cell_index.index()) .expect("Unable to get point index of cell"); let cell_center = grid.point_coordinates(&point_index) - + &Vector3::repeat(grid.cell_size().times_f64(0.5)); + + Vector3::repeat(grid.cell_size().times_f64(0.5)); let cell_data = marching_cubes_data .cell_data diff --git a/splashsurf_lib/src/marching_cubes/narrow_band_extraction.rs b/splashsurf_lib/src/marching_cubes/narrow_band_extraction.rs index db5d5d7..497f37a 100644 --- a/splashsurf_lib/src/marching_cubes/narrow_band_extraction.rs +++ b/splashsurf_lib/src/marching_cubes/narrow_band_extraction.rs @@ -42,6 +42,7 @@ pub(crate) fn construct_mc_input( /// For each cell, this function collects /// 1) an array with a flag per corner vertex, indicating whether it's above/below the iso-surface threshold /// 2) an array with an optional index per edge, referring to the interpolated vertex if the edge crosses the iso-surface +/// /// Note: The threshold flags in the resulting cell data are not complete and still have to be updated after /// this procedure using the [update_cell_data_threshold_flags] function. ///