diff options
author | eschnett <> | 2001-03-01 12:40:00 +0000 |
---|---|---|
committer | eschnett <> | 2001-03-01 12:40:00 +0000 |
commit | ece47455bad491c45b3136362e9239f505de23b9 (patch) | |
tree | 0e121ebd44c2fbb7711943fcd8804e85626daca3 /Carpet/CarpetLib/src/bboxset.hh | |
parent | 310f0ea48d18866b773136aed11200b6eda6378b (diff) |
Initial revision
darcs-hash:20010301124010-f6438-fca5ed1e25f84efd816aa0d13fc23b58add7195d.gz
Diffstat (limited to 'Carpet/CarpetLib/src/bboxset.hh')
-rw-r--r-- | Carpet/CarpetLib/src/bboxset.hh | 98 |
1 files changed, 33 insertions, 65 deletions
diff --git a/Carpet/CarpetLib/src/bboxset.hh b/Carpet/CarpetLib/src/bboxset.hh index a94c8940a..009d9afdd 100644 --- a/Carpet/CarpetLib/src/bboxset.hh +++ b/Carpet/CarpetLib/src/bboxset.hh @@ -1,10 +1,27 @@ -// $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.hh,v 1.11 2003/09/19 16:06:41 schnetter Exp $ +/*************************************************************************** + bboxset.hh - Sets of bounding boxes + ------------------- + begin : Sun Jun 11 2000 + copyright : (C) 2000 by Erik Schnetter + email : schnetter@astro.psu.edu + + $Header: /home/eschnett/C/carpet/Carpet/Carpet/CarpetLib/src/bboxset.hh,v 1.1 2001/03/01 13:40:10 eschnett Exp $ + + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ #ifndef BBOXSET_HH #define BBOXSET_HH -#include <assert.h> - +#include <cassert> #include <iostream> #include <set> @@ -12,22 +29,15 @@ #include "defs.hh" #include "vect.hh" -using namespace std; - -// Forward declaration +// Forward definition template<class T, int D> class bboxset; -// template<class T,int D> -// bboxset<T,D> operator+ (const bbox<T,D>& b1, const bbox<T,D>& b2); -// template<class T,int D> -// bboxset<T,D> operator+ (const bbox<T,D>& b, const bboxset<T,D>& s); - -// template<class T,int D> -// bboxset<T,D> operator- (const bbox<T,D>& b1, const bbox<T,D>& b2); -// template<class T,int D> -// bboxset<T,D> operator- (const bbox<T,D>& b, const bboxset<T,D>& s); +template<class T,int D> +bboxset<T,D> operator- (const bbox<T,D>& b1, const bbox<T,D>& b2); +template<class T,int D> +bboxset<T,D> operator- (const bbox<T,D>& b, const bboxset<T,D>& s); // Output template<class T,int D> @@ -67,15 +77,12 @@ public: // Accessors bool empty () const { return bs.empty(); } T size () const; - int setsize () const { return bs.size(); } // Add (bboxes that don't overlap) bboxset& operator+= (const box& b); bboxset& operator+= (const bboxset& s); bboxset operator+ (const box& b) const; bboxset operator+ (const bboxset& s) const; - static bboxset plus (const box& b1, const box& b2); - static bboxset plus (const box& b, const bboxset& s); // Union bboxset& operator|= (const box& b); @@ -91,66 +98,27 @@ public: // Difference // friend bboxset operator- <T,D>(const box& b1, const box& b2); - static bboxset minus (const box& b1, const box& b2); bboxset operator- (const box& b) const; bboxset& operator-= (const box& b); bboxset& operator-= (const bboxset& s); bboxset operator- (const bboxset& s) const; // friend bboxset operator- <T,D>(const box& b, const bboxset& s); - static bboxset minus (const box& b, const bboxset& s); - - // Equality - bool operator== (const bboxset& s) const; - bool operator!= (const bboxset& s) const; - bool operator< (const bboxset& s) const; - bool operator<= (const bboxset& s) const; - bool operator> (const bboxset& s) const; - bool operator>= (const bboxset& s) const; // Iterators - typedef typename bset::const_iterator const_iterator; - typedef typename bset::iterator iterator; + typedef bset::const_iterator const_iterator; + typedef bset::iterator iterator; - const_iterator begin () const { return bs.begin(); } - const_iterator end () const { return bs.end(); } -// iterator begin () const { return bs.begin(); } -// iterator end () const { return bs.end(); } + iterator begin () const { return bs.begin(); } + iterator end () const { return bs.end(); } // Output - void output (ostream& os) const; + friend ostream& operator<< <>(ostream& os, const bboxset& s); }; -template<class T,int D> -inline bboxset<T,D> operator+ (const bbox<T,D>& b1, const bbox<T,D>& b2) { - return bboxset<T,D>::plus(b1,b2); -} - -template<class T,int D> -inline bboxset<T,D> operator+ (const bbox<T,D>& b, const bboxset<T,D>& s) { - return bboxset<T,D>::plus(b,s); -} - -template<class T,int D> -inline bboxset<T,D> operator- (const bbox<T,D>& b1, const bbox<T,D>& b2) { - return bboxset<T,D>::minus(b1,b2); -} - -template<class T,int D> -inline bboxset<T,D> operator- (const bbox<T,D>& b, const bboxset<T,D>& s) { - return bboxset<T,D>::minus(b,s); -} - - - -// Output -template<class T,int D> -inline ostream& operator<< (ostream& os, const bboxset<T,D>& s) { - s.output(os); - return os; -} - - +#if defined(TMPL_IMPLICIT) +# include "bboxset.cc" +#endif #endif // BBOXSET_HH |