aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/modes.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-04-27 10:20:03 -0500
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:48 +0000
commitf69747c422faeed04848bf1a485238a927c33304 (patch)
tree100c83aebdd28f0b2ebf1b93c77e0ffc9c007a8b /Carpet/Carpet/src/modes.cc
parent298d4af50f5abcd3c0d1655349d960f87f54f658 (diff)
Carpet: Introduce bbox and bboxset loop iterators
Introduce LOOP_OVER_BBOX and LOOP_OVER_BSET iterators. Introduce ibbox2iminimax function.
Diffstat (limited to 'Carpet/Carpet/src/modes.cc')
-rw-r--r--Carpet/Carpet/src/modes.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/Carpet/Carpet/src/modes.cc b/Carpet/Carpet/src/modes.cc
index f426b73f6..d101a509b 100644
--- a/Carpet/Carpet/src/modes.cc
+++ b/Carpet/Carpet/src/modes.cc
@@ -1352,6 +1352,30 @@ namespace Carpet {
//
+ // Loop over a bounding box
+ //
+
+ void ibbox2iminimax (ibbox const& ext, // component extent
+ ibbox const& box, // this bbox
+ ivect& imin, ivect& imax)
+ {
+ ivect const izero = ivect(0);
+
+ assert (all ((box.lower() - ext.lower() ) >= 0));
+ assert (all ((box.upper() - ext.lower() + ext.stride()) >= 0));
+ assert (all ((box.lower() - ext.lower() ) % ext.stride() == 0));
+ assert (all ((box.upper() - ext.lower() + ext.stride()) % ext.stride() == 0));
+
+ imin = (box.lower() - ext.lower() ) / ext.stride();
+ imax = (box.upper() - ext.lower() + ext.stride()) / ext.stride();
+
+ assert (all (0 <= imin));
+ assert (box.empty() xor all (imin <= imax));
+ }
+
+
+
+ //
// Call a scheduling group
//