Skip to content

Commit c3962bd

Browse files
committed
Update to main
1 parent 264cfab commit c3962bd

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

splashsurf_lib/src/dense_subdomains.rs

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -756,35 +756,21 @@ pub fn density_grid_loop_scalar<I: Index, R: Real, K: SymmetricKernel3d<R>>(
756756
// Compute lower and upper bounds of the grid points possibly affected by the particle
757757
// We want to loop over the vertices of the enclosing cells plus all points in `cube_radius` distance from the cell
758758

759-
let lower = [
760-
particle_cell[0]
761-
.saturating_sub(&cube_radius)
762-
.max(I::zero())
763-
.min(extents[0]),
764-
particle_cell[1]
765-
.saturating_sub(&cube_radius)
766-
.max(I::zero())
767-
.min(extents[1]),
768-
particle_cell[2]
759+
let lower = [0, 1, 2].map(|i| {
760+
particle_cell[i]
769761
.saturating_sub(&cube_radius)
770762
.max(I::zero())
771-
.min(extents[2]),
772-
];
763+
.min(extents[i])
764+
});
773765

774-
let upper = [
766+
let upper = [0, 1, 2].map(|i| {
775767
// We add 2 because
776768
// - we want to loop over all grid points of the cell (+1 for upper points) + the radius
777769
// - the upper range limit is exclusive (+1)
778-
(particle_cell[0] + cube_radius + I::two())
779-
.min(extents[0])
780-
.max(I::zero()),
781-
(particle_cell[1] + cube_radius + I::two())
782-
.min(extents[1])
783-
.max(I::zero()),
784-
(particle_cell[2] + cube_radius + I::two())
785-
.min(extents[2])
786-
.max(I::zero()),
787-
];
770+
(particle_cell[i] + cube_radius + I::two())
771+
.min(extents[i])
772+
.max(I::zero())
773+
});
788774

789775
// Loop over all grid points around the enclosing cell
790776
for i in I::range(lower[0], upper[0]).iter() {

0 commit comments

Comments
 (0)