Skip to content

Commit 1c48b21

Browse files
committed
Use box.grow_low and grow_high
1 parent 2392f32 commit 1c48b21

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

Python/pywarpx/fields.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,26 +350,20 @@ def _get_intersect_slice(self, mfi, starts, stops, icstart, icstop, with_interna
350350
The slice of the intersection relative to the global array where the data from individual block will go
351351
"""
352352
box = mfi.tilebox()
353-
box_small_end = box.small_end
354-
box_big_end = box.big_end
355353
if self.include_ghosts:
356354
nghosts = self.mf.n_grow_vect()
357355
if with_internal_ghosts:
358-
box.grow(self.mf.n_grow_vect())
359-
box_small_end = box.small_end
360-
box_big_end = box.big_end
356+
box.grow(nghosts)
361357
else:
362-
# When available, this could be somewhat simplified by using box.grow_low and box.grow_high,
363-
# which would remove the need of the temporary copies of small_end and big_end.
364358
min_box = self.mf.box_array().minimal_box()
365359
for i in range(self.dim):
366-
if box_small_end[i] == min_box.small_end[i]:
367-
box_small_end[i] -= nghosts[i]
368-
if box_big_end[i] == min_box.big_end[i]:
369-
box_big_end[i] += nghosts[i]
360+
if box.small_end[i] == min_box.small_end[i]:
361+
box.grow_low(i, nghosts[i])
362+
if box.big_end[i] == min_box.big_end[i]:
363+
box.grow_high(i, nghosts[i])
370364

371-
ilo = self._get_indices(box_small_end, 0)
372-
ihi = self._get_indices(box_big_end, 0)
365+
ilo = self._get_indices(box.small_end, 0)
366+
ihi = self._get_indices(box.big_end, 0)
373367

374368
# Add 1 to the upper end to be consistent with the slicing notation
375369
ihi_p1 = [i + 1 for i in ihi]

0 commit comments

Comments
 (0)