aboutsummaryrefslogtreecommitdiff
path: root/Carpet
diff options
context:
space:
mode:
authorschnetter <>2003-02-24 16:11:00 +0000
committerschnetter <>2003-02-24 16:11:00 +0000
commit69c57d13232ad89dd518ba86331a0110e64aab6e (patch)
tree97e9a194646384614f109f7dea198328d4a6bf8c /Carpet
parentfa00022e88033b49e15b42a29279076c490c9ac8 (diff)
Forbid to expand and contract empty boxes. This exposed a few bugs in
Forbid to expand and contract empty boxes. This exposed a few bugs in other places. darcs-hash:20030224161129-07bb3-41c06d9a0fa2e2d62e1785183fe55683c8a55808.gz
Diffstat (limited to 'Carpet')
-rw-r--r--Carpet/CarpetLib/src/bbox.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/Carpet/CarpetLib/src/bbox.cc b/Carpet/CarpetLib/src/bbox.cc
index 4a4bfcea6..0369aec9e 100644
--- a/Carpet/CarpetLib/src/bbox.cc
+++ b/Carpet/CarpetLib/src/bbox.cc
@@ -1,4 +1,4 @@
-// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.cc,v 1.11 2003/01/03 15:49:36 schnetter Exp $
+// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.cc,v 1.12 2003/02/24 17:11:29 schnetter Exp $
#include <assert.h>
@@ -130,6 +130,7 @@ bool bbox<T,D>::is_aligned_with (const bbox& b) const {
// Expand the bbox a little by multiples of the stride
template<class T, int D>
bbox<T,D> bbox<T,D>::expand (const vect<T,D>& lo, const vect<T,D>& hi) const {
+ assert (! empty());
const vect<T,D> str = stride();
const vect<T,D> lb = lower() - lo * str;
const vect<T,D> ub = upper() + hi * str;
@@ -139,6 +140,7 @@ bbox<T,D> bbox<T,D>::expand (const vect<T,D>& lo, const vect<T,D>& hi) const {
// Find the smallest b-compatible box around *this
template<class T, int D>
bbox<T,D> bbox<T,D>::expanded_for (const bbox& b) const {
+ assert (! empty());
const vect<T,D> str = b.stride();
const vect<T,D> loff = ((lower() - b.lower()) % str + str) % str;
const vect<T,D> uoff = ((upper() - b.lower()) % str + str) % str;
@@ -150,6 +152,7 @@ bbox<T,D> bbox<T,D>::expanded_for (const bbox& b) const {
// Find the largest b-compatible box inside *this
template<class T, int D>
bbox<T,D> bbox<T,D>::contracted_for (const bbox& b) const {
+ assert (! empty());
const vect<T,D> str = b.stride();
const vect<T,D> loff = ((lower() - b.lower()) % str + str) % str;
const vect<T,D> uoff = ((upper() - b.lower()) % str + str) % str;