Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/amrex/extensions/MultiFab.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ def _process_index(self, index):
index = [index]
elif isinstance(index, tuple):
if len(index) == 0:
# The empty tuple specifies all valid and ghost cells
index = [index]
# The empty tuple specifies all valid and ghost cells for all axis
index = dims * [index]
else:
index = list(index)
for i in range(len(index)):
Expand Down
7 changes: 5 additions & 2 deletions tests/test_multifab.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@ def test_mfab_numpy(mfab):
# Config = sim.extension.Config

# Using global indexing
# Set all valid cells (and internal ghost cells)
# Set all cells, valid and ghost cells, using the empty tuple
mfab[()] = np.pi

# Set all valid cells (and ghost cells overlapping valid cells), using the Ellipsis
mfab[...] = 42.0

# Set a range of cells. Indices are in Fortran order.
Expand All @@ -87,7 +90,7 @@ def test_mfab_numpy(mfab):
# Third dimension, sets all valid and ghost cells
# - The empty tuple is used to specify the range to include all valid and ghost cells.
# Components dimension, sets first component.
mfab[-1j:2j, :, (), 0] = 42.0
mfab[-1j:2j, :, (), 0] = 37.0

# Get a range of cells
# Get the data along the valid cells in the first dimension (gathering data across blocks
Expand Down
Loading