diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2009-09-03 16:19:15 -0500 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2011-12-14 16:42:31 +0000 |
commit | 11c4d98017cbb86d08e15fd1b549180184b58a26 (patch) | |
tree | 2546a154c6f7bc0bec87de7316125ae7d1453569 /Carpet/CarpetLib/src/bbox.hh | |
parent | f520477b1c14e02f1495cfa8d3e09f4e21ab34d0 (diff) |
Import Carpet
Ignore-this: 309b4dd613f4af2b84aa5d6743fdb6b3
Diffstat (limited to 'Carpet/CarpetLib/src/bbox.hh')
-rw-r--r-- | Carpet/CarpetLib/src/bbox.hh | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh index a79fbe87b..8386f58a2 100644 --- a/Carpet/CarpetLib/src/bbox.hh +++ b/Carpet/CarpetLib/src/bbox.hh @@ -13,6 +13,14 @@ using namespace std; +#ifdef CARPET_DEBUG +# define ASSERT_BBOX(x) assert(x) +#else +# define ASSERT_BBOX(x) +#endif + + + // Forward declaration template<class T, int D> class bbox; @@ -69,11 +77,14 @@ public: const vect<T,D>& stride_) : _lower(lower_), _upper(upper_), _stride(stride_) { -#ifndef NDEBUG +#ifndef CARPET_DEBUG assert_bbox_limits(); #endif } + // Poison + static bbox poison (); + // Accessors // (Don't return references; *this might be a temporary) @@ -131,7 +142,7 @@ public: bbox b. */ bbox operator& (const bbox& b) const { - assert (all(stride()==b.stride())); + ASSERT_BBOX (all(stride()==b.stride())); vect<T,D> lo = max(lower(),b.lower()); vect<T,D> up = min(upper(),b.upper()); return bbox(lo,up,stride()); @@ -179,7 +190,7 @@ public: iterator end () const; // Memory usage - size_t memory () const + size_t memory () const CCTK_ATTRIBUTE_CONST { return memoryof (_lower) + memoryof (_upper) + memoryof (_stride); } @@ -194,6 +205,8 @@ public: // Memory usage template<class T, int D> +inline size_t memoryof (bbox<T,D> const & b) CCTK_ATTRIBUTE_CONST; +template<class T, int D> inline size_t memoryof (bbox<T,D> const & b) { return b.memory(); } |