Skip to content

Commit d58e92e

Browse files
committed
Update Changelog, add Default trait bound to Index and Real
1 parent 31c0bfe commit d58e92e

5 files changed

Lines changed: 18 additions & 23 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
## Master
22

3+
- Lib: Allow passing in an existing `SurfaceReconstruction` to reuse allocated memory (currently only memory for the resulting surface mesh is reused)
4+
- Lib: Add `Default` trait bound to `Index` and `Real` types
5+
36
## Version 0.3.0
47

5-
- Move `vtkio` convenience trait implementations in `splashsurf_lib` behind a non-default feature flag (flag `vtk-extras`). Flag is enabled in the CLI crate.
6-
- Re-export `vtkio` from lib if feature is enabled and use this from CLI
7-
- Move `coarse_prof` usage in `splashsurf_lib` behind a non-default feature flag (flag `profiling`). Flag is enabled in the CLI crate.
8+
- Lib: Move `vtkio` convenience trait implementations in `splashsurf_lib` behind a non-default feature flag (flag `vtk-extras`). Flag is enabled in the CLI crate.
9+
- Lib: Move `coarse_prof` usage in `splashsurf_lib` behind a non-default feature flag (flag `profiling`). Flag is enabled in the CLI crate.
10+
- Re-export `vtkio` from lib if feature is enabled and use this from CLI
811
- Re-export `coarse_prof` from lib if feature is enabled and use this from CLI
9-
- Instead of directly writing into a global density map (`dashmap`) in parallel, use thread local density maps (`HashMap`s) which are then merged in a second step (in parallel, into a `dashmap`). Improves performance of the test scene in the readme from 20 seconds to 12 seconds.
10-
- Fix bug which forced some parts in the library to divided work into 8 chunks, preventing use of more threads
12+
- Lib: Instead of directly writing into a global density map (`dashmap`) in parallel, use thread local density maps (`HashMap`s) which are then merged in a second step (in parallel, into a `dashmap`). Improves performance of the test scene in the readme from 20 seconds to 12 seconds.
13+
- Lib: Fix bug which forced some parts in the library to divided work into 8 chunks, preventing use of more threads
1114

1215
## Version 0.2.0
1316

14-
- Add support for reading PLY files (https://github.com/w1th0utnam3/splashsurf/pull/1)
17+
- CLI: Add support for reading PLY files (https://github.com/w1th0utnam3/splashsurf/pull/1)
1518
- Update dependencies
1619
- Re-export `nalgebra` from lib, use this from CLI
1720

splashsurf_lib/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,12 @@ pub struct SurfaceReconstruction<I: Index, R: Real> {
152152
}
153153

154154
impl<I: Index, R: Real> Default for SurfaceReconstruction<I, R> {
155+
/// Returns an empty [SurfaceReconstruction] to pass into the inplace surface reconstruction
155156
fn default() -> Self {
156-
let grid = UniformGrid::new_zero();
157-
let mesh = TriMesh3d::default();
158157
Self {
159-
grid,
158+
grid: UniformGrid::new_zero(),
160159
density_map: None,
161-
mesh,
160+
mesh: TriMesh3d::default(),
162161
}
163162
}
164163
}

splashsurf_lib/src/mesh.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,14 @@ use nalgebra::Vector3;
55
use crate::Real;
66

77
/// A triangle (surface) mesh in 3D
8-
#[derive(Clone, Debug)]
8+
#[derive(Clone, Debug, Default)]
99
pub struct TriMesh3d<R: Real> {
1010
/// Coordinates of all vertices of the mesh
1111
pub vertices: Vec<Vector3<R>>,
1212
/// The triangles of the mesh identified by their vertex indices
1313
pub triangles: Vec<[usize; 3]>,
1414
}
1515

16-
impl<R: Real> Default for TriMesh3d<R> {
17-
fn default() -> Self {
18-
Self {
19-
vertices: Vec::new(),
20-
triangles: Vec::new(),
21-
}
22-
}
23-
}
24-
2516
/// A hexahedral (volumetric) mesh in 3D
2617
#[derive(Clone, Debug, Default)]
2718
pub struct HexMesh3d<R: Real> {

splashsurf_lib/src/numeric_types.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub trait Index:
2020
+ CheckedMul
2121
+ FromPrimitive
2222
+ ToPrimitive
23+
+ Default
2324
+ Debug
2425
+ Display
2526
+ ThreadSafe
@@ -41,7 +42,7 @@ pub trait Index:
4142
}
4243

4344
/// Trait that has to be implemented for types to be used as floating points values in the context of the library (e.g. for coordinates, density values)
44-
pub trait Real: RealField + FromPrimitive + ToPrimitive + Debug + ThreadSafe {
45+
pub trait Real: RealField + FromPrimitive + ToPrimitive + Debug + Default + ThreadSafe {
4546
fn try_convert<T: Real>(self) -> Option<T> {
4647
Some(T::from_f64(self.to_f64()?)?)
4748
}
@@ -92,9 +93,10 @@ impl<T> Index for T where
9293
+ FromPrimitive
9394
+ ToPrimitive
9495
+ Debug
96+
+ Default
9597
+ Display
9698
+ ThreadSafe
9799
{
98100
}
99101

100-
impl<T: RealField + FromPrimitive + ToPrimitive + Debug + ThreadSafe> Real for T {}
102+
impl<T: RealField + FromPrimitive + ToPrimitive + Debug + Default + ThreadSafe> Real for T {}

splashsurf_lib/src/uniform_grid.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl<I: Index, R: Real> UniformCartesianCubeGrid3d<I, R> {
200200
})
201201
}
202202

203-
/// Create a new zeroed grid
203+
/// Constructs a degenerate grid with zero extents, zero cells and zero points
204204
pub(crate) fn new_zero() -> Self {
205205
Self {
206206
aabb: AxisAlignedBoundingBox3d::new(Vector3::zeros(), Vector3::zeros()),

0 commit comments

Comments
 (0)