Skip to content

Commit

Permalink
Fix boxArray getitem
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Jul 19, 2023
1 parent d5781f1 commit 3b9ad25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Base/BoxArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ void init_BoxArray(py::module &m) {
*/
.def("__getitem__",
[](const BoxArray& ba, const int i) {
const int ii = (i >= 0) ? i : AMREX_SPACEDIM + i;
if ((ii < 0) || (ii >= AMREX_SPACEDIM))
const int ii = (i >= 0) ? i : ba.size() + i;
if ((ii < 0) || (ii >= ba.size()))
throw py::index_error(
"Index must be between 0 and " +
std::to_string(AMREX_SPACEDIM));
std::to_string(ba.size()));
return ba[ii];
})

Expand Down

0 comments on commit 3b9ad25

Please sign in to comment.