diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-07-25 13:21:56 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2008-07-25 13:48:35 -0500 |
commit | 5542f02701603b5efdd7538a9b88d3ffc9610978 (patch) | |
tree | a135615dd1458a86a0b2d2582ebbdc692ae3c1b2 /Carpet | |
parent | c8746c53015a2440ab211cf099e4d8d552cce904 (diff) |
CarpetLib: Allow negative array indices in vect<T,D>::index
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetLib/src/vect.hh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh index 3c4232525..56898d970 100644 --- a/Carpet/CarpetLib/src/vect.hh +++ b/Carpet/CarpetLib/src/vect.hh @@ -442,7 +442,9 @@ inline T index (const vect<T,D>& lsh, const vect<T,D>& ind) { T r(0); for (int d=D-1; d>=0; --d) { assert (lsh[d]>=0); - assert (ind[d]>=0 and ind[d]<lsh[d]); + // Be generous, and allow relative indices which may be negtive + // assert (ind[d]>=0 and ind[d]<lsh[d]); + assert (abs(ind[d])<=lsh[d]); r = r * lsh[d] + ind[d]; } return r; |