diff options
author | schnetter <> | 2003-02-25 21:57:00 +0000 |
---|---|---|
committer | schnetter <> | 2003-02-25 21:57:00 +0000 |
commit | 79e352620a10b9a9a81beeecc1017f7539052c1f (patch) | |
tree | dbcbdb962ee1f0c59adc93aec35e5f90cdafd3b2 /Carpet/CarpetLib/src/bbox.cc | |
parent | b39d59163852b03bed8ff1babde11248c0760b0b (diff) |
Handle empty bboxes.
Handle empty bboxes.
*.F77: Better error checking whether the active region is contained in
the source and destination arrays.
*.F77: Temporarily activated per-gridpoint checking of array accesses.
bbox.cc bboxset.cc: Handle empty bboxes better -- either handle them
correctly, or abort.
gdata.cc: Recognise empty regions.
ggf.cc: Remove line that was commented out for a long time.
dh.cc: Choose send and recv regions for syncing and prolongation so
that they don't overlap.
dh.cc: Handle empty bboxes.
darcs-hash:20030225215700-07bb3-a7296dd92353c003bc0bd3ff435e4939f8041eae.gz
Diffstat (limited to 'Carpet/CarpetLib/src/bbox.cc')
-rw-r--r-- | Carpet/CarpetLib/src/bbox.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Carpet/CarpetLib/src/bbox.cc b/Carpet/CarpetLib/src/bbox.cc index 0369aec9e..dcae93c02 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.12 2003/02/24 17:11:29 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.cc,v 1.13 2003/02/25 22:57:00 schnetter Exp $ #include <assert.h> @@ -117,6 +117,7 @@ bbox<T,D> bbox<T,D>::operator& (const bbox& b) const { // Containment template<class T, int D> bool bbox<T,D>::is_contained_in (const bbox& b) const { + if (empty()) return true; // no alignment check return all(lower()>=b.lower() && upper()<=b.upper()); } @@ -140,7 +141,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()); + if (empty()) return bbox(b.lower(), b.lower()-b.stride(), b.stride()); 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; @@ -152,7 +153,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()); + if (empty()) return bbox(b.lower(), b.lower()-b.stride(), b.stride()); 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; |