Skip to content

Commit 306099d

Browse files
committed
Fix minimum octree leaf size if stitching is enabled
1 parent 1e17a49 commit 306099d

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

splashsurf_lib/src/octree.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ impl<I: Index, R: Real> Octree<I, R> {
131131
subdivision_criterion: SubdivisionCriterion,
132132
margin: R,
133133
enable_multi_threading: bool,
134+
enable_stitching: bool,
134135
) -> Self {
135136
let mut tree = Octree::new(&grid, particle_positions.len());
136137

@@ -140,13 +141,15 @@ impl<I: Index, R: Real> Octree<I, R> {
140141
particle_positions,
141142
subdivision_criterion,
142143
margin,
144+
enable_stitching,
143145
);
144146
} else {
145147
tree.subdivide_recursively_margin(
146148
grid,
147149
particle_positions,
148150
subdivision_criterion,
149151
margin,
152+
enable_stitching,
150153
);
151154
}
152155

@@ -175,11 +178,15 @@ impl<I: Index, R: Real> Octree<I, R> {
175178
particle_positions: &[Vector3<R>],
176179
subdivision_criterion: SubdivisionCriterion,
177180
margin: R,
181+
enable_stitching: bool,
178182
) {
179183
profile!("octree subdivide_recursively_margin");
180184

181-
let split_criterion =
182-
default_split_criterion(subdivision_criterion, particle_positions.len());
185+
let split_criterion = default_split_criterion(
186+
subdivision_criterion,
187+
particle_positions.len(),
188+
enable_stitching,
189+
);
183190

184191
self.root.visit_mut_bfs(|node| {
185192
// Stop recursion if split criterion is not fulfilled
@@ -199,11 +206,15 @@ impl<I: Index, R: Real> Octree<I, R> {
199206
particle_positions: &[Vector3<R>],
200207
subdivision_criterion: SubdivisionCriterion,
201208
margin: R,
209+
enable_stitching: bool,
202210
) {
203211
profile!("octree subdivide_recursively_margin_par");
204212

205-
let split_criterion =
206-
default_split_criterion(subdivision_criterion, particle_positions.len());
213+
let split_criterion = default_split_criterion(
214+
subdivision_criterion,
215+
particle_positions.len(),
216+
enable_stitching,
217+
);
207218
let parallel_policy = ParallelPolicy::default();
208219

209220
let visitor = move |node: &mut OctreeNode<I, R>| {
@@ -846,6 +857,7 @@ mod split_criterion {
846857
pub(super) fn default_split_criterion<I: Index>(
847858
subdivision_criterion: SubdivisionCriterion,
848859
num_particles: usize,
860+
enable_stitching: bool,
849861
) -> (
850862
MaxNonGhostParticleLeafSplitCriterion,
851863
MinimumExtentSplitCriterion<I>,
@@ -866,7 +878,11 @@ mod split_criterion {
866878

867879
(
868880
MaxNonGhostParticleLeafSplitCriterion::new(particles_per_cell),
869-
MinimumExtentSplitCriterion::new(I::one()),
881+
MinimumExtentSplitCriterion::new(if enable_stitching {
882+
I::one() + I::one() + I::one()
883+
} else {
884+
I::one()
885+
}),
870886
)
871887
}
872888
}

splashsurf_lib/src/reconstruction.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ impl<I: Index, R: Real> SurfaceReconstructionOctreeVisitor<I, R> {
4141
decomposition_parameters.subdivision_criterion.clone(),
4242
parameters.compact_support_radius * margin_factor,
4343
parameters.enable_multi_threading,
44+
decomposition_parameters.enable_stitching,
4445
)
4546
} else {
4647
// TODO: Use default values instead?

0 commit comments

Comments
 (0)