diff options
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetIOASCII/src/ioascii.cc | 4 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/bbox.cc | 14 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/bbox.hh | 5 |
3 files changed, 14 insertions, 9 deletions
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc index 8684ae6e8..144b6e660 100644 --- a/Carpet/CarpetIOASCII/src/ioascii.cc +++ b/Carpet/CarpetIOASCII/src/ioascii.cc @@ -31,7 +31,7 @@ #include "ioascii.hh" extern "C" { - static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.67 2004/04/03 12:38:12 schnetter Exp $"; + static const char* rcsid = "$Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetIOASCII/src/ioascii.cc,v 1.68 2004/04/18 13:03:44 schnetter Exp $"; CCTK_FILEVERSION(Carpet_CarpetIOASCII_ioascii_cc); } @@ -1018,7 +1018,7 @@ namespace CarpetIOASCII { ++it; - for (int d=DD-1; d>=0; --d) { + for (int d=0; d<DD; ++d) { if ((*it)[d]!=(*ext.end())[d]) break; os << endl; } diff --git a/Carpet/CarpetLib/src/bbox.cc b/Carpet/CarpetLib/src/bbox.cc index 9cf82183c..174fdc7e0 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.22 2004/03/11 12:03:44 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.cc,v 1.23 2004/04/18 13:03:44 schnetter Exp $ #include <assert.h> @@ -34,8 +34,8 @@ bbox<T,D>::bbox (const vect<T,D>& lower, const vect<T,D>& upper, const vect<T,D>& stride) : _lower(lower), _upper(upper), _stride(stride) { - assert (all(stride>=1)); - assert (all((upper-lower)%stride == T(0))); + assert (all(_stride>T(0))); + assert (all((_upper-_lower)%_stride == T(0))); } // Accessors @@ -194,7 +194,7 @@ template<class T, int D> typename bbox<T,D>::iterator& bbox<T,D>::iterator::operator++ () { for (int d=0; d<D; ++d) { pos[d]+=box.stride()[d]; - if (pos[d]<=box.upper()[d]) return *this; + if (pos[d]<=box.upper()[d]) break; pos[d]=box.lower()[d]; } return *this; @@ -207,7 +207,7 @@ typename bbox<T,D>::iterator bbox<T,D>::begin () const { template<class T, int D> typename bbox<T,D>::iterator bbox<T,D>::end () const { - return iterator(*this, upper()); + return iterator(*this, lower()); } @@ -226,6 +226,10 @@ void bbox<T,D>::input (istream& is) { is >> _stride; skipws (is); consume (is, ')'); + cerr << "bbox " << *this << endl; + cerr << (_upper-_lower)%_stride << endl; + assert (all(_stride>T(0))); + assert (all((_upper-_lower)%_stride == T(0))); } diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh index d22ad33b6..e23d000ac 100644 --- a/Carpet/CarpetLib/src/bbox.hh +++ b/Carpet/CarpetLib/src/bbox.hh @@ -1,4 +1,4 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.hh,v 1.14 2004/03/11 12:03:44 schnetter Exp $ +// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bbox.hh,v 1.15 2004/04/18 13:03:44 schnetter Exp $ #ifndef BBOX_HH #define BBOX_HH @@ -135,7 +135,8 @@ public: /** Create an iterator that points to the first point in a bbox. */ iterator begin () const; - /** Create an iterator that points to the last point in a bbox. */ + /** Create an iterator that points "after the last point" in a bbox, + which means that it also points to the first point. */ iterator end () const; // Input/Output helpers |