diff options
Diffstat (limited to 'Carpet/CarpetLib/src')
-rw-r--r-- | Carpet/CarpetLib/src/bbox.hh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh index 8386f58a2..9ac9a9af3 100644 --- a/Carpet/CarpetLib/src/bbox.hh +++ b/Carpet/CarpetLib/src/bbox.hh @@ -189,6 +189,17 @@ public: which means that it also points to the first point. */ iterator end () const; + size_type index (const vect<T,D>& pos) const + { + assert (not empty()); + bbox const posbox (pos, pos, stride()); + assert (is_aligned_with (posbox)); + assert (contains(pos)); + size_type const i = ::index (shape(), (pos - lower()) / stride()); + assert (i>=0 and i<size()); + return i; + } + // Memory usage size_t memory () const CCTK_ATTRIBUTE_CONST { |