diff options
Diffstat (limited to 'Carpet/CarpetLib/src')
-rw-r--r-- | Carpet/CarpetLib/src/bbox.hh | 47 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/bboxset.hh | 116 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/bintree.hh | 4 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/data.hh | 2 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/defs.hh | 234 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/dh.hh | 33 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/dist.hh | 75 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/fulltree.hh | 27 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/gdata.hh | 9 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/gf.hh | 2 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/ggf.hh | 9 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/gh.hh | 36 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/mem.hh | 11 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/operator_prototypes_3d.hh | 5 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/operator_prototypes_4d.hh | 5 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/region.hh | 21 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/th.hh | 9 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/timestat.hh | 2 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/vect.hh | 109 | ||||
-rw-r--r-- | Carpet/CarpetLib/src/vect_helpers.hh | 194 |
20 files changed, 311 insertions, 639 deletions
diff --git a/Carpet/CarpetLib/src/bbox.hh b/Carpet/CarpetLib/src/bbox.hh index 5f286befb..f9fe2b906 100644 --- a/Carpet/CarpetLib/src/bbox.hh +++ b/Carpet/CarpetLib/src/bbox.hh @@ -46,7 +46,7 @@ class bbox { // Consistency checks - void assert_bbox_limits () const; + void assert_bbox_limits () const CCTK_MEMBER_ATTRIBUTE_PURE; public: @@ -85,7 +85,7 @@ public: } // Poison - static bbox poison (); + static bbox poison () CCTK_MEMBER_ATTRIBUTE_PURE; // Accessors // (Don't return references; *this might be a temporary) @@ -117,31 +117,31 @@ public: /** Return the size, which is the number of contained points. */ // T size () const; typedef long long int size_type; - size_type size () const; + size_type size () const CCTK_MEMBER_ATTRIBUTE_PURE; // Queries /** Find out whether the bbox contains the point x. */ - bool contains (const vect<T,D>& x) const; + bool contains (const vect<T,D>& x) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Find out whether this bbox is contained in the bbox b. */ - bool is_contained_in (const bbox& b) const; + bool is_contained_in (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Find out whether this bbox intersects the bbox b. */ - bool intersects (const bbox& b) const; + bool intersects (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Find out whether this bbox is aligned with the bbox b. ("aligned" means that both bboxes have the same stride and that their boundaries are commensurate.) */ - bool is_aligned_with (const bbox& b) const; + bool is_aligned_with (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; // Operators - bool operator== (const bbox& b) const; - bool operator!= (const bbox& b) const; - bool operator<= (const bbox& b) const; - bool operator>= (const bbox& b) const; - bool operator< (const bbox& b) const; - bool operator> (const bbox& b) const; + bool operator== (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator!= (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator<= (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator>= (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator< (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator> (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Calculate the intersection (the set of common points) with the bbox b. */ @@ -155,7 +155,8 @@ public: } /** Expand (enlarge) the bbox by multiples of the stride. */ - bbox expand (const vect<T,D>& lo, const vect<T,D>& hi) const; + bbox expand (const vect<T,D>& lo, const vect<T,D>& hi) const + CCTK_MEMBER_ATTRIBUTE_PURE; bbox expand (const vect<vect<T,D>,2>& lohi) const { return expand (lohi[0], lohi[1]); } @@ -166,7 +167,8 @@ public: /** Expand (enlarge) the bbox by multiples of a fraction of the stride. */ bbox expand (const vect<T,D>& lo, const vect<T,D>& hi, - const vect<T,D>& denom) const; + const vect<T,D>& denom) const + CCTK_MEMBER_ATTRIBUTE_PURE; bbox expand (const vect<vect<T,D>,2>& lohi, const vect<T,D>& denom) const { return expand (lohi[0], lohi[1], denom); } @@ -176,13 +178,14 @@ public: /** Find the smallest b-compatible box around this bbox. ("compatible" means having the same stride.) */ - bbox expanded_for (const bbox& b) const; + bbox expanded_for (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Find the largest b-compatible box inside this bbox. */ - bbox contracted_for (const bbox& b) const; + bbox contracted_for (const bbox& b) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Find the smallest bbox containing both boxes. */ - bbox expanded_containing (const bbox<T,D>& b) const; + bbox expanded_containing (const bbox<T,D>& b) const + CCTK_MEMBER_ATTRIBUTE_PURE; // Iterators @@ -205,10 +208,10 @@ public: }; /** Create an iterator that points to the first point in a bbox. */ - iterator begin () const; + iterator begin () const CCTK_MEMBER_ATTRIBUTE_PURE; /** 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; + iterator end () const CCTK_MEMBER_ATTRIBUTE_PURE; size_type index (const vect<T,D>& pos) const { @@ -222,7 +225,7 @@ public: } // Memory usage - size_t memory () const CCTK_ATTRIBUTE_CONST + size_t memory () const { return memoryof (_lower) + memoryof (_upper) + memoryof (_stride); } @@ -237,8 +240,6 @@ public: // Memory usage template<typename T, int D> -inline size_t memoryof (bbox<T,D> const & b) CCTK_ATTRIBUTE_CONST; -template<typename T, int D> inline size_t memoryof (bbox<T,D> const & b) { return b.memory(); } diff --git a/Carpet/CarpetLib/src/bboxset.hh b/Carpet/CarpetLib/src/bboxset.hh index 281202edb..0608bdb81 100644 --- a/Carpet/CarpetLib/src/bboxset.hh +++ b/Carpet/CarpetLib/src/bboxset.hh @@ -93,7 +93,7 @@ public: static bboxset poison (); // Invariant - bool invariant () const; + bool invariant () const CCTK_MEMBER_ATTRIBUTE_PURE; private: // Normalisation @@ -104,35 +104,43 @@ public: bool empty () const { return bs.empty(); } // cost: O(1) // T size () const; typedef typename box::size_type size_type; - size_type size () const; // cost: O(n) + size_type size () const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) int setsize () const { return bs.size(); } // cost: O(1) // Find out whether this bboxset intersects the bbox b - bool intersects (const box& b) const; // cost: O(n) + bool intersects (const box& b) const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) // Add (bboxes that don't overlap) - bboxset& operator+= (const box& b); // cost: O(1) - bboxset& operator+= (const bboxset& s); // cost: O(n) - bboxset& add_transfer (bboxset& s); // cost: O(1) - bboxset operator+ (const box& b) const; // cost: O(n) - bboxset operator+ (const bboxset& s) const; // cost: O(n) + bboxset& operator+= (const box& b); // cost: O(1) + bboxset& operator+= (const bboxset& s); // cost: O(n) + bboxset& add_transfer (bboxset& s); // cost: O(1) + bboxset operator+ (const box& b) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) + bboxset operator+ (const bboxset& s) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) // Union - bboxset& operator|= (const box& b); // cost: O(n) - bboxset& operator|= (const bboxset& s); // cost: O(n^2) - bboxset operator| (const box& b) const; // cost: O(n) - bboxset operator| (const bboxset& s) const; // cost: O(n^2) + bboxset& operator|= (const box& b); // cost: O(n) + bboxset& operator|= (const bboxset& s); // cost: O(n^2) + bboxset operator| (const box& b) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) + bboxset operator| (const bboxset& s) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n^2) // Intersection - bboxset operator& (const box& b) const; // cost: O(n) - bboxset operator& (const bboxset& s) const; // cost: O(n) - bboxset& operator&= (const box& b); // cost: O(n) - bboxset& operator&= (const bboxset& s); // cost: O(n) + bboxset operator& (const box& b) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) + bboxset operator& (const bboxset& s) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) + bboxset& operator&= (const box& b); // cost: O(n) + bboxset& operator&= (const bboxset& s); // cost: O(n) // Difference // friend bboxset operator- <T,D>(const box& b1, const box& b2); - static bboxset minus (const box& b1, const box& b2); // cost: O(1) - bboxset operator- (const box& b) const; // cost: O(n) + static bboxset minus (const box& b1, const box& b2) + CCTK_ATTRIBUTE_PURE; // cost: O(1) + bboxset operator- (const box& b) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) // cost: O(n) bboxset& operator-= (const box& b) { @@ -141,17 +149,20 @@ public: return *this; } bboxset& operator-= (const bboxset& s); // cost: O(n^2) - bboxset operator- (const bboxset& s) const; // cost: O(n^2) + bboxset operator- (const bboxset& s) + const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n^2) // friend bboxset operator- <T,D>(const box& b, const bboxset& s); - static bboxset minus (const box& b, const bboxset& s); // cost: O(n^2) + static bboxset minus (const box& b, const bboxset& s) + CCTK_ATTRIBUTE_PURE; // cost: O(n^2) /** Find a bbox containing the whole set. */ - box container () const; // cost: O(n) + box container () const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n) /** Find the pseudo-inverse. */ - bboxset pseudo_inverse (const int n) const; + bboxset pseudo_inverse (const int n) const CCTK_MEMBER_ATTRIBUTE_PURE; /** Expand (enlarge) the bboxset by multiples of the stride. */ - bboxset expand (const vect<T,D>& lo, const vect<T,D>& hi) const; + bboxset expand (const vect<T,D>& lo, const vect<T,D>& hi) + const CCTK_MEMBER_ATTRIBUTE_PURE; bboxset expand (const vect<vect<T,D>,2>& lohi) const { return expand (lohi[0], lohi[1]); } @@ -163,7 +174,7 @@ public: stride. */ // cost: O(n^2) in general, but only O(n) for shifting bboxset expand (const vect<T,D>& lo, const vect<T,D>& hi, - const vect<T,D>& denom) const; + const vect<T,D>& denom) const CCTK_MEMBER_ATTRIBUTE_PURE; // cost: O(n^2) in general, but only O(n) for shifting bboxset expand (const vect<vect<T,D>,2>& lohi, const vect<T,D>& denom) const { return expand (lohi[0], lohi[1], denom); } @@ -175,21 +186,21 @@ public: /** Find the smallest b-compatible box around this bbox. ("compatible" means having the same stride.) */ - bboxset expanded_for (const box& b) const; + bboxset expanded_for (const box& b) const CCTK_MEMBER_ATTRIBUTE_PURE; #warning "TODO: this is incorrect" #if 1 /** Find the largest b-compatible box inside this bbox. */ - bboxset contracted_for (const box& b) const; + bboxset contracted_for (const box& b) const CCTK_MEMBER_ATTRIBUTE_PURE; #endif // 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; + bool operator== (const bboxset& s) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator!= (const bboxset& s) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator< (const bboxset& s) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator<= (const bboxset& s) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator> (const bboxset& s) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator>= (const bboxset& s) const CCTK_MEMBER_ATTRIBUTE_PURE; // Iterators typedef typename bset::const_iterator const_iterator; @@ -201,7 +212,7 @@ public: // iterator end () const { return bs.end(); } // Memory usage - size_t memory () const CCTK_ATTRIBUTE_PURE { return memoryof (bs); } + size_t memory () const { return memoryof (bs); } // Input istream& input (istream& is); @@ -250,54 +261,36 @@ inline bboxset<T,D> operator& (const bbox<T,D>& b, const bboxset<T,D>& s) { template<typename T,int D> inline bool operator== (const bbox<T,D>& b, const bboxset<T,D>& s) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator== (const bbox<T,D>& b, const bboxset<T,D>& s) { return bboxset<T,D>(b) == s; } template<typename T,int D> inline bool operator!= (const bbox<T,D>& b, const bboxset<T,D>& s) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator!= (const bbox<T,D>& b, const bboxset<T,D>& s) { return bboxset<T,D>(b) != s; } template<typename T,int D> inline bool operator< (const bbox<T,D>& b, const bboxset<T,D>& s) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator< (const bbox<T,D>& b, const bboxset<T,D>& s) { return bboxset<T,D>(b) < s; } template<typename T,int D> inline bool operator<= (const bbox<T,D>& b, const bboxset<T,D>& s) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator<= (const bbox<T,D>& b, const bboxset<T,D>& s) { return bboxset<T,D>(b) <= s; } template<typename T,int D> inline bool operator> (const bbox<T,D>& b, const bboxset<T,D>& s) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator> (const bbox<T,D>& b, const bboxset<T,D>& s) { return bboxset<T,D>(b) > s; } template<typename T,int D> inline bool operator>= (const bbox<T,D>& b, const bboxset<T,D>& s) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator>= (const bbox<T,D>& b, const bboxset<T,D>& s) { return bboxset<T,D>(b) >= s; } @@ -306,54 +299,36 @@ inline bool operator>= (const bbox<T,D>& b, const bboxset<T,D>& s) template<typename T,int D> inline bool operator== (const bboxset<T,D>& s, const bbox<T,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator== (const bboxset<T,D>& s, const bbox<T,D>& b) { return s == bboxset<T,D>(b); } template<typename T,int D> inline bool operator!= (const bboxset<T,D>& s, const bbox<T,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator!= (const bboxset<T,D>& s, const bbox<T,D>& b) { return s != bboxset<T,D>(b); } template<typename T,int D> inline bool operator< (const bboxset<T,D>& s, const bbox<T,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator< (const bboxset<T,D>& s, const bbox<T,D>& b) { return s < bboxset<T,D>(b); } template<typename T,int D> inline bool operator<= (const bboxset<T,D>& s, const bbox<T,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator<= (const bboxset<T,D>& s, const bbox<T,D>& b) { return s <= bboxset<T,D>(b); } template<typename T,int D> inline bool operator> (const bboxset<T,D>& s, const bbox<T,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator> (const bboxset<T,D>& s, const bbox<T,D>& b) { return s > bboxset<T,D>(b); } template<typename T,int D> inline bool operator>= (const bboxset<T,D>& s, const bbox<T,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline bool operator>= (const bboxset<T,D>& s, const bbox<T,D>& b) { return s >= bboxset<T,D>(b); } @@ -363,9 +338,6 @@ inline bool operator>= (const bboxset<T,D>& s, const bbox<T,D>& b) // Memory usage template<typename T, int D> inline size_t memoryof (bboxset<T,D> const & s) - CCTK_ATTRIBUTE_PURE; -template<typename T, int D> -inline size_t memoryof (bboxset<T,D> const & s) { return s.memory(); } diff --git a/Carpet/CarpetLib/src/bintree.hh b/Carpet/CarpetLib/src/bintree.hh index 7a7927d9a..83e81f86c 100644 --- a/Carpet/CarpetLib/src/bintree.hh +++ b/Carpet/CarpetLib/src/bintree.hh @@ -142,7 +142,7 @@ public: }; // Memory usage - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; // Output helper void output (ostream & os) const; @@ -152,8 +152,6 @@ public: // Memory usage template <typename T, int D, typename P> -inline size_t memoryof (bintree<T,D,P> const & f) CCTK_ATTRIBUTE_PURE; -template <typename T, int D, typename P> inline size_t memoryof (bintree<T,D,P> const & f) { return f.memory(); } diff --git a/Carpet/CarpetLib/src/data.hh b/Carpet/CarpetLib/src/data.hh index f7a79e202..9a40f9bfa 100644 --- a/Carpet/CarpetLib/src/data.hh +++ b/Carpet/CarpetLib/src/data.hh @@ -164,7 +164,7 @@ private: public: // Memory usage - virtual size_t memory () const CCTK_ATTRIBUTE_PURE; + virtual size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; // Output virtual ostream & output (ostream& os) const; diff --git a/Carpet/CarpetLib/src/defs.hh b/Carpet/CarpetLib/src/defs.hh index 7c9a98f42..31fad850c 100644 --- a/Carpet/CarpetLib/src/defs.hh +++ b/Carpet/CarpetLib/src/defs.hh @@ -122,9 +122,7 @@ enum centering { error_centered, vertex_centered, cell_centered }; // Useful helper template<class T> -inline T square (const T& x) CCTK_ATTRIBUTE_CONST; -template<class T> -inline T square (const T& x) { return x*x; } +inline T square (const T x) { return x*x; } // Another useful helper template<class T> @@ -133,8 +131,8 @@ T ipow (T x, int y) CCTK_ATTRIBUTE_CONST; // Access to CarpetLib parameters -CCTK_INT get_poison_value() CCTK_ATTRIBUTE_CONST; -CCTK_INT get_deadbeef() CCTK_ATTRIBUTE_CONST; +CCTK_INT get_poison_value() CCTK_ATTRIBUTE_PURE; +CCTK_INT get_deadbeef() CCTK_ATTRIBUTE_PURE; @@ -150,61 +148,51 @@ void consume (istream& is, char const * c); // Names for types #ifdef HAVE_CCTK_INT1 -inline const char * typestring (const CCTK_INT1&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_INT1&) { return "CCTK_INT1"; } #endif #ifdef HAVE_CCTK_INT2 -inline const char * typestring (const CCTK_INT2&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_INT2&) { return "CCTK_INT2"; } #endif #ifdef HAVE_CCTK_INT4 -inline const char * typestring (const CCTK_INT4&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_INT4&) { return "CCTK_INT4"; } #endif #ifdef HAVE_CCTK_INT8 -inline const char * typestring (const CCTK_INT8&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_INT8&) { return "CCTK_INT8"; } #endif #ifdef HAVE_CCTK_REAL4 -inline const char * typestring (const CCTK_REAL4&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_REAL4&) { return "CCTK_REAL4"; } #endif #ifdef HAVE_CCTK_REAL8 -inline const char * typestring (const CCTK_REAL8&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_REAL8&) { return "CCTK_REAL8"; } #endif #ifdef HAVE_CCTK_REAL16 -inline const char * typestring (const CCTK_REAL16&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_REAL16&) { return "CCTK_REAL16"; } #endif #ifdef HAVE_CCTK_REAL4 -inline const char * typestring (const CCTK_COMPLEX8&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_COMPLEX8&) { return "CCTK_COMPLEX8"; } #endif #ifdef HAVE_CCTK_REAL8 -inline const char * typestring (const CCTK_COMPLEX16&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_COMPLEX16&) { return "CCTK_COMPLEX16"; } #endif #ifdef HAVE_CCTK_REAL16 -inline const char * typestring (const CCTK_COMPLEX32&) CCTK_ATTRIBUTE_CONST; inline const char * typestring (const CCTK_COMPLEX32&) { return "CCTK_COMPLEX32"; } #endif @@ -215,90 +203,75 @@ inline const char * typestring (const CCTK_COMPLEX32&) // isnormal functions // #ifdef HAVE_CCTK_REAL4 -// inline int myfpclassify (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; -// int myfpclassify (CCTK_REAL4 const & x) +// inline int myfpclassify (CCTK_REAL4 const x) // { return fpclassify (x); } // #endif // #ifdef HAVE_CCTK_REAL8 -// inline int myfpclassify (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; -// inline int myfpclassify (CCTK_REAL8 const & x) +// inline int myfpclassify (CCTK_REAL8 const x) // { return fpclassify (x); } // #endif // #ifdef HAVE_CCTK_REAL16 -// inline int myfpclassify (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; -// inline int myfpclassify (CCTK_REAL16 const & x) +// inline int myfpclassify (CCTK_REAL16 const x) // { return fpclassify (x); } // #endif // // #undef fpclassify #ifdef HAVE_CCTK_REAL4 -inline int myisfinite (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; -int myisfinite (CCTK_REAL4 const & x) +inline int myisfinite (CCTK_REAL4 const x) { return isfinite (x); } #endif #ifdef HAVE_CCTK_REAL8 -inline int myisfinite (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisfinite (CCTK_REAL8 const & x) +inline int myisfinite (CCTK_REAL8 const x) { return isfinite (x); } #endif #ifdef HAVE_CCTK_REAL16 -inline int myisfinite (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisfinite (CCTK_REAL16 const & x) +inline int myisfinite (CCTK_REAL16 const x) { return isfinite (x); } #endif #undef isfinite #ifdef HAVE_CCTK_REAL4 -inline int myisinf (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; -int myisinf (CCTK_REAL4 const & x) +inline int myisinf (CCTK_REAL4 const x) { return isinf (x); } #endif #ifdef HAVE_CCTK_REAL8 -inline int myisinf (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisinf (CCTK_REAL8 const & x) +inline int myisinf (CCTK_REAL8 const x) { return isinf (x); } #endif #ifdef HAVE_CCTK_REAL16 -inline int myisinf (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisinf (CCTK_REAL16 const & x) +inline int myisinf (CCTK_REAL16 const x) { return isinf (x); } #endif #undef isinf #ifdef HAVE_CCTK_REAL4 -inline int myisnan (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; -int myisnan (CCTK_REAL4 const & x) +inline int myisnan (CCTK_REAL4 const x) { return isnan (x); } #endif #ifdef HAVE_CCTK_REAL8 -inline int myisnan (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisnan (CCTK_REAL8 const & x) +inline int myisnan (CCTK_REAL8 const x) { return isnan (x); } #endif #ifdef HAVE_CCTK_REAL16 -inline int myisnan (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisnan (CCTK_REAL16 const & x) +inline int myisnan (CCTK_REAL16 const x) { return isnan (x); } #endif #undef isnan #ifdef HAVE_CCTK_REAL4 -inline int myisnormal (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; -int myisnormal (CCTK_REAL4 const & x) +inline int myisnormal (CCTK_REAL4 const x) { return isnormal (x); } #endif #ifdef HAVE_CCTK_REAL8 -inline int myisnormal (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisnormal (CCTK_REAL8 const & x) +inline int myisnormal (CCTK_REAL8 const x) { return isnormal (x); } #endif #ifdef HAVE_CCTK_REAL16 -inline int myisnormal (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; -inline int myisnormal (CCTK_REAL16 const & x) +inline int myisnormal (CCTK_REAL16 const x) { return isnormal (x); } #endif @@ -318,50 +291,45 @@ namespace CarpetLib { // template <typename T> - inline typename typeprops<T>::real abs (T const & x) CCTK_ATTRIBUTE_CONST; - template <typename T> - inline typename typeprops<T>::real abs (T const & x) + inline typename typeprops<T>::real abs (T const x) { return std::abs (x); } // // This does not work on Linux with Intel compilers, which do not // // always have long long llabs (long long) -// template<> inline signed char abs<signed char> (signed char const & x) CCTK_ATTRIBUTE_CONST { return ::abs (x); } -// template<> inline unsigned char abs<unsigned char> (unsigned char const & x) CCTK_ATTRIBUTE_CONST { return ::abs (x); } -// template<> inline short abs<short> (short const & x) { return ::abs (x); } -// template<> inline int abs<int> (int const & x) CCTK_ATTRIBUTE_CONST { return ::abs (x); } -// template<> inline long abs<long> (long const & x) CCTK_ATTRIBUTE_CONST { return ::labs (x); } +// template<> inline signed char abs<signed char> (signed char const x) { return ::abs (x); } +// template<> inline unsigned char abs<unsigned char> (unsigned char const x) CCTK_ATTRIBUTE_CONST { return ::abs (x); } +// template<> inline short abs<short> (short const x) { return ::abs (x); } +// template<> inline int abs<int> (int const x) { return ::abs (x); } +// template<> inline long abs<long> (long const x) { return ::labs (x); } // #ifdef SIZEOF_LONG_LONG -// inline long long abs<long long> (long long const & x) CCTK_ATTRIBUTE_CONST { return ::llabs (x); } +// inline long long abs<long long> (long long const x) { return ::llabs (x); } // #endif // // This template does not work on AIX, which does not have long // // long abs (long long) // #ifdef HAVE_CCTK_INT1 -// template<> inline CCTK_INT1 abs<CCTK_INT1> (CCTK_INT1 const & x) CCTK_ATTRIBUTE_CONST { return x < 0 ? - x : x; } +// template<> inline CCTK_INT1 abs<CCTK_INT1> (CCTK_INT1 const x) { return x < 0 ? - x : x; } // #endif // #ifdef HAVE_CCTK_INT2 -// template<> inline CCTK_INT2 abs<CCTK_INT2> (CCTK_INT2 const & x) CCTK_ATTRIBUTE_CONST { return x < 0 ? - x : x; } +// template<> inline CCTK_INT2 abs<CCTK_INT2> (CCTK_INT2 const x) { return x < 0 ? - x : x; } // #endif // #ifdef HAVE_CCTK_INT4 -// template<> inline CCTK_INT4 abs<CCTK_INT4> (CCTK_INT4 const & x) CCTK_ATTRIBUTE_CONST { return x < 0 ? - x : x; } +// template<> inline CCTK_INT4 abs<CCTK_INT4> (CCTK_INT4 const x) { return x < 0 ? - x : x; } // #endif // #ifdef HAVE_CCTK_INT8 -// template<> inline CCTK_INT8 abs<CCTK_INT8> (CCTK_INT8 const & x) CCTK_ATTRIBUTE_CONST { return x < 0 ? - x : x; } +// template<> inline CCTK_INT8 abs<CCTK_INT8> (CCTK_INT8 const x) { return x < 0 ? - x : x; } // #endif #ifdef HAVE_CCTK_COMPLEX8 - template<> inline CCTK_REAL4 abs<CCTK_COMPLEX8> (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline CCTK_REAL4 abs<CCTK_COMPLEX8> (CCTK_COMPLEX8 const & x) + template<> inline CCTK_REAL4 abs<CCTK_COMPLEX8> (CCTK_COMPLEX8 const x) { return CCTK_Cmplx8Abs (x); } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline CCTK_REAL8 abs<CCTK_COMPLEX16> (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline CCTK_REAL8 abs<CCTK_COMPLEX16> (CCTK_COMPLEX16 const & x) + template<> inline CCTK_REAL8 abs<CCTK_COMPLEX16> (CCTK_COMPLEX16 const x) { return CCTK_Cmplx16Abs (x); } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline CCTK_REAL16 abs<CCTK_COMPLEX32> (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline CCTK_REAL16 abs<CCTK_COMPLEX32> (CCTK_COMPLEX32 const & x) + template<> inline CCTK_REAL16 abs<CCTK_COMPLEX32> (CCTK_COMPLEX32 const x) { return CCTK_Cmplx32Abs (x); } #endif @@ -371,40 +339,32 @@ namespace CarpetLib { // // // Default implementation, only good for integers // template <typename T> -// inline int fpclassify (T const & x) CCTK_ATTRIBUTE_CONST; -// template <typename T> -// inline int fpclassify (T const & x) +// inline int fpclassify (T const x) // { return x ? FP_NORMAL : FP_ZERO; } // // #ifdef HAVE_CCTK_REAL4 -// template<> inline int fpclassify (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; -// template<> inline int fpclassify (CCTK_REAL4 const & x) +// template<> inline int fpclassify (CCTK_REAL4 const x) // { return myfpclassify (x); } // #endif // #ifdef HAVE_CCTK_REAL8 -// template<> inline int fpclassify (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; -// template<> inline int fpclassify (CCTK_REAL8 const & x) +// template<> inline int fpclassify (CCTK_REAL8 const x) // { return myfpclassify (x); } // #endif // #ifdef HAVE_CCTK_REAL16 -// template<> inline int fpclassify (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; -// template<> inline int fpclassify (CCTK_REAL16 const & x) +// template<> inline int fpclassify (CCTK_REAL16 const x) // { return myfpclassify (x); } // #endif // // #ifdef HAVE_CCTK_COMPLEX8 -// template<> inline int fpclassify (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST; -// template<> inline int fpclassify (CCTK_COMPLEX8 const & x) +// template<> inline int fpclassify (CCTK_COMPLEX8 const x) // { assert(0); } // #endif // #ifdef HAVE_CCTK_COMPLEX16 -// template<> inline int fpclassify (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST; -// template<> inline int fpclassify (CCTK_COMPLEX16 const & x) +// template<> inline int fpclassify (CCTK_COMPLEX16 const x) // { assert(0); } // #endif // #ifdef HAVE_CCTK_COMPLEX32 -// template<> inline int fpclassify (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST; -// template<> inline int fpclassify (CCTK_COMPLEX32 const & x) +// template<> inline int fpclassify (CCTK_COMPLEX32 const x) // { assert(0); } // #endif @@ -414,40 +374,32 @@ namespace CarpetLib { // Default implementation, only good for integers template <typename T> - inline int isfinite (T const & x) CCTK_ATTRIBUTE_CONST; - template <typename T> - inline int isfinite (T const & x) + inline int isfinite (T const x) { return 1; } #ifdef HAVE_CCTK_REAL4 - template<> inline int isfinite (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isfinite (CCTK_REAL4 const & x) + template<> inline int isfinite (CCTK_REAL4 const x) { return myisfinite (x); } #endif #ifdef HAVE_CCTK_REAL8 - template<> inline int isfinite (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isfinite (CCTK_REAL8 const & x) + template<> inline int isfinite (CCTK_REAL8 const x) { return myisfinite (x); } #endif #ifdef HAVE_CCTK_REAL16 - template<> inline int isfinite (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isfinite (CCTK_REAL16 const & x) + template<> inline int isfinite (CCTK_REAL16 const x) { return myisfinite (x); } #endif #ifdef HAVE_CCTK_COMPLEX8 - template<> inline int isfinite (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isfinite (CCTK_COMPLEX8 const & x) + template<> inline int isfinite (CCTK_COMPLEX8 const x) { return myisfinite (CCTK_Cmplx8Real (x)) and myisfinite (CCTK_Cmplx8Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline int isfinite (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isfinite (CCTK_COMPLEX16 const & x) + template<> inline int isfinite (CCTK_COMPLEX16 const x) { return myisfinite (CCTK_Cmplx16Real (x)) and myisfinite (CCTK_Cmplx16Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline int isfinite (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isfinite (CCTK_COMPLEX32 const & x) + template<> inline int isfinite (CCTK_COMPLEX32 const x) { return myisfinite (CCTK_Cmplx32Real (x)) and myisfinite (CCTK_Cmplx32Imag (x)); } #endif @@ -457,40 +409,32 @@ namespace CarpetLib { // Default implementation, only good for integers template <typename T> - inline int isinf (T const & x) CCTK_ATTRIBUTE_CONST; - template <typename T> - inline int isinf (T const & x) + inline int isinf (T const x) { return 0; } #ifdef HAVE_CCTK_REAL4 - template<> inline int isinf (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isinf (CCTK_REAL4 const & x) + template<> inline int isinf (CCTK_REAL4 const x) { return myisinf (x); } #endif #ifdef HAVE_CCTK_REAL8 - template<> inline int isinf (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isinf (CCTK_REAL8 const & x) + template<> inline int isinf (CCTK_REAL8 const x) { return myisinf (x); } #endif #ifdef HAVE_CCTK_REAL16 - template<> inline int isinf (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isinf (CCTK_REAL16 const & x) + template<> inline int isinf (CCTK_REAL16 const x) { return myisinf (x); } #endif #ifdef HAVE_CCTK_COMPLEX8 - template<> inline int isinf (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isinf (CCTK_COMPLEX8 const & x) + template<> inline int isinf (CCTK_COMPLEX8 const x) { return myisinf (CCTK_Cmplx8Real (x)) or myisinf (CCTK_Cmplx8Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline int isinf (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isinf (CCTK_COMPLEX16 const & x) + template<> inline int isinf (CCTK_COMPLEX16 const x) { return myisinf (CCTK_Cmplx16Real (x)) or myisinf (CCTK_Cmplx16Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline int isinf (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isinf (CCTK_COMPLEX32 const & x) + template<> inline int isinf (CCTK_COMPLEX32 const x) { return myisinf (CCTK_Cmplx32Real (x)) or myisinf (CCTK_Cmplx32Imag (x)); } #endif @@ -500,40 +444,32 @@ namespace CarpetLib { // Default implementation, only good for integers template <typename T> - inline int isnan (T const & x) CCTK_ATTRIBUTE_CONST; - template <typename T> - inline int isnan (T const & x) + inline int isnan (T const x) { return 0; } #ifdef HAVE_CCTK_REAL4 - template<> inline int isnan (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnan (CCTK_REAL4 const & x) + template<> inline int isnan (CCTK_REAL4 const x) { return myisnan (x); } #endif #ifdef HAVE_CCTK_REAL8 - template<> inline int isnan (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnan (CCTK_REAL8 const & x) + template<> inline int isnan (CCTK_REAL8 const x) { return myisnan (x); } #endif #ifdef HAVE_CCTK_REAL16 - template<> inline int isnan (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnan (CCTK_REAL16 const & x) + template<> inline int isnan (CCTK_REAL16 const x) { return myisnan (x); } #endif #ifdef HAVE_CCTK_COMPLEX8 - template<> inline int isnan (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnan (CCTK_COMPLEX8 const & x) + template<> inline int isnan (CCTK_COMPLEX8 const x) { return myisnan (CCTK_Cmplx8Real (x)) or myisnan (CCTK_Cmplx8Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline int isnan (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnan (CCTK_COMPLEX16 const & x) + template<> inline int isnan (CCTK_COMPLEX16 const x) { return myisnan (CCTK_Cmplx16Real (x)) or myisnan (CCTK_Cmplx16Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline int isnan (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnan (CCTK_COMPLEX32 const & x) + template<> inline int isnan (CCTK_COMPLEX32 const x) { return myisnan (CCTK_Cmplx32Real (x)) or myisnan (CCTK_Cmplx32Imag (x)); } #endif @@ -543,40 +479,32 @@ namespace CarpetLib { // Default implementation, only good for integers template <typename T> - inline int isnormal (T const & x) CCTK_ATTRIBUTE_CONST; - template <typename T> - inline int isnormal (T const & x) + inline int isnormal (T const x) { return 1; } #ifdef HAVE_CCTK_REAL4 - template<> inline int isnormal (CCTK_REAL4 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnormal (CCTK_REAL4 const & x) + template<> inline int isnormal (CCTK_REAL4 const x) { return myisnormal (x); } #endif #ifdef HAVE_CCTK_REAL8 - template<> inline int isnormal (CCTK_REAL8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnormal (CCTK_REAL8 const & x) + template<> inline int isnormal (CCTK_REAL8 const x) { return myisnormal (x); } #endif #ifdef HAVE_CCTK_REAL16 - template<> inline int isnormal (CCTK_REAL16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnormal (CCTK_REAL16 const & x) + template<> inline int isnormal (CCTK_REAL16 const x) { return myisnormal (x); } #endif #ifdef HAVE_CCTK_COMPLEX8 - template<> inline int isnormal (CCTK_COMPLEX8 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnormal (CCTK_COMPLEX8 const & x) + template<> inline int isnormal (CCTK_COMPLEX8 const x) { return myisnormal (CCTK_Cmplx8Real (x)) and myisnormal (CCTK_Cmplx8Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline int isnormal (CCTK_COMPLEX16 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnormal (CCTK_COMPLEX16 const & x) + template<> inline int isnormal (CCTK_COMPLEX16 const x) { return myisnormal (CCTK_Cmplx16Real (x)) and myisnormal (CCTK_Cmplx16Imag (x)); } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline int isnormal (CCTK_COMPLEX32 const & x) CCTK_ATTRIBUTE_CONST; - template<> inline int isnormal (CCTK_COMPLEX32 const & x) + template<> inline int isnormal (CCTK_COMPLEX32 const x) { return myisnormal (CCTK_Cmplx32Real (x)) and myisnormal (CCTK_Cmplx32Imag (x)); } #endif @@ -593,11 +521,9 @@ namespace CarpetLib { namespace CarpetLib { namespace good { -#define ALIAS_GOOD_FUNCTION(typ,func) \ - template <typename T> \ - inline typ func##_ (T const & x) CCTK_ATTRIBUTE_CONST; \ - template <typename T> \ - inline typ func##_ (T const & x) \ +#define ALIAS_GOOD_FUNCTION(typ,func) \ + template <typename T> \ + inline typ func##_ (T const x) \ { return func (x); } // ALIAS_GOOD_FUNCTION(int,fpclassify) @@ -632,26 +558,6 @@ bool equals (vector<T> const& v, vector<T> const& w) // Container memory usage -inline size_t memoryof (char const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (short const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (int const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (long const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (long long const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (unsigned char const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (unsigned short const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (unsigned int const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (unsigned long const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (unsigned long long const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (float const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (double const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (long double const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (void * const e) CCTK_ATTRIBUTE_CONST; -inline size_t memoryof (void const * const e) CCTK_ATTRIBUTE_CONST; -template<class T> inline size_t memoryof (T * const e) CCTK_ATTRIBUTE_CONST; -template<class T> inline size_t memoryof (T const * const e) CCTK_ATTRIBUTE_CONST; -template<class T> inline size_t memoryof (typename list<T>::iterator const & i) CCTK_ATTRIBUTE_CONST; -template<class T> inline size_t memoryof (typename list<T>::const_iterator const & i) CCTK_ATTRIBUTE_CONST; - inline size_t memoryof (char const e) { return sizeof e; } inline size_t memoryof (short const e) { return sizeof e; } inline size_t memoryof (int const e) { return sizeof e; } diff --git a/Carpet/CarpetLib/src/dh.hh b/Carpet/CarpetLib/src/dh.hh index 505196472..9cb2a4789 100644 --- a/Carpet/CarpetLib/src/dh.hh +++ b/Carpet/CarpetLib/src/dh.hh @@ -52,7 +52,7 @@ public: typedef ibbox::size_type size_type; size_type exterior_size, owned_size, active_size; - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; istream & input (istream & is); ostream & output (ostream & os) const; }; @@ -82,7 +82,7 @@ public: vect<vect<ibset,2>,dim> coarse_boundary; vect<vect<ibset,2>,dim> fine_boundary; - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; istream & input (istream & is); ostream & output (ostream & os) const; }; @@ -126,13 +126,13 @@ public: ibset ghosts; // ghost zones, as seen from Cactus ibbox interior; // interior (without ghost zones) - bool operator== (full_dboxes const & b) const; + bool operator== (full_dboxes const & b) const CCTK_MEMBER_ATTRIBUTE_PURE; bool operator!= (full_dboxes const & b) const { return not operator==(b); } - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; istream & input (istream& is); ostream & output (ostream & os) const; }; @@ -172,13 +172,13 @@ public: srpvect fast_old2new_sync_sendrecv; srpvect fast_old2new_ref_prol_sendrecv; - bool operator== (fast_dboxes const & b) const CCTK_ATTRIBUTE_PURE; + bool operator== (fast_dboxes const & b) const CCTK_MEMBER_ATTRIBUTE_PURE; bool operator!= (fast_dboxes const & b) const { return not operator==(b); } - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; istream & input (istream & is); ostream & output (ostream & os) const; }; @@ -240,7 +240,7 @@ public: ~dh (); // Helpers - int prolongation_stencil_size (int rl) const CCTK_ATTRIBUTE_CONST; + int prolongation_stencil_size (int rl) const CCTK_MEMBER_ATTRIBUTE_PURE; // Modifiers void regrid (bool do_init); @@ -248,11 +248,11 @@ public: void recompose (int rl, bool do_prolongate); private: - int this_proc (int rl, int c) const CCTK_ATTRIBUTE_PURE; - bool on_this_proc (int rl, int c) const CCTK_ATTRIBUTE_PURE; - bool on_this_proc (int rl, int c, int cc) const CCTK_ATTRIBUTE_PURE; - int this_oldproc (int rl, int c) const CCTK_ATTRIBUTE_PURE; - bool on_this_oldproc (int rl, int c) const CCTK_ATTRIBUTE_PURE; + int this_proc (int rl, int c) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool on_this_proc (int rl, int c) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool on_this_proc (int rl, int c, int cc) const CCTK_MEMBER_ATTRIBUTE_PURE; + int this_oldproc (int rl, int c) const CCTK_MEMBER_ATTRIBUTE_PURE; + bool on_this_oldproc (int rl, int c) const CCTK_MEMBER_ATTRIBUTE_PURE; static void @@ -266,8 +266,8 @@ public: void erase (ggf_handle fi); // Output - size_t memory () const CCTK_ATTRIBUTE_PURE; - static size_t allmemory () CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; + static size_t allmemory () CCTK_MEMBER_ATTRIBUTE_PURE; ostream & output (ostream & os) const; }; @@ -282,31 +282,26 @@ namespace dist { { dh::fast_dboxes dummy; return mpi_datatype(dummy); } } -inline size_t memoryof (dh::light_dboxes const & b) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (dh::light_dboxes const & b) { return b.memory (); } -inline size_t memoryof (dh::local_dboxes const & b) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (dh::local_dboxes const & b) { return b.memory (); } -inline size_t memoryof (dh::full_dboxes const & b) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (dh::full_dboxes const & b) { return b.memory (); } -inline size_t memoryof (dh::fast_dboxes const & b) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (dh::fast_dboxes const & b) { return b.memory (); } -inline size_t memoryof (dh const & d) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (dh const & d) { return d.memory (); diff --git a/Carpet/CarpetLib/src/dist.hh b/Carpet/CarpetLib/src/dist.hh index 7fd084bb3..cb0770efe 100644 --- a/Carpet/CarpetLib/src/dist.hh +++ b/Carpet/CarpetLib/src/dist.hh @@ -145,21 +145,18 @@ namespace dist { // Information about the communicator // Return the communicator - inline MPI_Comm comm () CCTK_ATTRIBUTE_CONST; inline MPI_Comm comm () { return comm_; } // Always return a good communicator - inline MPI_Comm goodcomm () CCTK_ATTRIBUTE_CONST; inline MPI_Comm goodcomm () { return comm_ != MPI_COMM_NULL ? comm_ : MPI_COMM_WORLD; } // Rank in the communicator (this processor's number, 0 .. size-1) - inline int rank () CCTK_ATTRIBUTE_CONST; inline int rank () { static int rank_ = -1; @@ -168,7 +165,6 @@ namespace dist { } // Size of the communicator - inline int size () CCTK_ATTRIBUTE_CONST; inline int size () { static int size_ = -1; @@ -180,7 +176,6 @@ namespace dist { void set_num_threads (int num_threads); // Local number of threads - inline int num_threads () CCTK_ATTRIBUTE_CONST; inline int num_threads () { return num_threads_; @@ -188,7 +183,6 @@ namespace dist { // Global number of threads void collect_total_num_threads (); - inline int total_num_threads () CCTK_ATTRIBUTE_CONST; inline int total_num_threads () { return total_num_threads_; @@ -200,124 +194,89 @@ namespace dist { // C Datatype helpers // Map a C datatype to a 0-based index running up to c_ndatatypes(). ///////////////////////////////////////////////////////////////////////// - inline unsigned int c_datatype (const char&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const char&) { return 0; } - inline unsigned int c_datatype (const signed char&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const signed char&) { return 1; } - inline unsigned int c_datatype (const unsigned char&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const unsigned char&) { return 2; } - inline unsigned int c_datatype (const short&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const short&) { return 3; } - inline unsigned int c_datatype (const unsigned short&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const unsigned short&) { return 4; } - inline unsigned int c_datatype (const int&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const int&) { return 5; } - inline unsigned int c_datatype (const unsigned int&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const unsigned int&) { return 6; } - inline unsigned int c_datatype (const long&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const long&) { return 7; } - inline unsigned int c_datatype (const unsigned long&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const unsigned long&) { return 8; } - inline unsigned int c_datatype (const long long&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const long long&) { return 9; } - inline unsigned int c_datatype (const unsigned long long&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const unsigned long long&) { return 10; } - inline unsigned int c_datatype (const float&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const float&) { return 11; } - inline unsigned int c_datatype (const double&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const double&) { return 12; } - inline unsigned int c_datatype (const long double&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const long double&) { return 13; } #ifdef HAVE_CCTK_COMPLEX8 - inline unsigned int c_datatype (const CCTK_COMPLEX8&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const CCTK_COMPLEX8&) { return 14; } #endif #ifdef HAVE_CCTK_COMPLEX16 - inline unsigned int c_datatype (const CCTK_COMPLEX16&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const CCTK_COMPLEX16&) { return 15; } #endif #ifdef HAVE_CCTK_COMPLEX32 - inline unsigned int c_datatype (const CCTK_COMPLEX32&) CCTK_ATTRIBUTE_CONST; inline unsigned int c_datatype (const CCTK_COMPLEX32&) { return 16; } #endif // keep this function's return code consistent with functions above - inline unsigned int c_ndatatypes () CCTK_ATTRIBUTE_CONST; inline unsigned int c_ndatatypes () { return 17; } template <typename T> unsigned int c_datatype () { abort(); } - template<> inline unsigned int c_datatype <char> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <char> () { return 0; } - template<> inline unsigned int c_datatype <signed char> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <signed char> () { return 1; } - template<> inline unsigned int c_datatype <unsigned char> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <unsigned char> () { return 2; } - template<> inline unsigned int c_datatype <short> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <short> () { return 3; } - template<> inline unsigned int c_datatype <unsigned short> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <unsigned short> () { return 4; } - template<> inline unsigned int c_datatype <int> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <int> () { return 5; } - template<> inline unsigned int c_datatype <unsigned int> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <unsigned int> () { return 6; } - template<> inline unsigned int c_datatype <long> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <long> () { return 7; } - template<> inline unsigned int c_datatype <unsigned long> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <unsigned long> () { return 8; } - template<> inline unsigned int c_datatype <long long> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <long long> () { return 9; } - template<> inline unsigned int c_datatype <unsigned long long> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <unsigned long long> () { return 10; } - template<> inline unsigned int c_datatype <float> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <float> () { return 11; } - template<> inline unsigned int c_datatype <double> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <double> () { return 12; } - template<> inline unsigned int c_datatype <long double> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <long double> () { return 13; } #ifdef HAVE_CCTK_COMPLEX8 - template<> inline unsigned int c_datatype <CCTK_COMPLEX8> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <CCTK_COMPLEX8> () { return 14; } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline unsigned int c_datatype <CCTK_COMPLEX16> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <CCTK_COMPLEX16> () { return 15; } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline unsigned int c_datatype <CCTK_COMPLEX32> () CCTK_ATTRIBUTE_CONST; template<> inline unsigned int c_datatype <CCTK_COMPLEX32> () { return 16; } #endif @@ -328,119 +287,85 @@ namespace dist { // MPI Datatype helpers // Map a C datatype to its corresponding MPI datatype. ///////////////////////////////////////////////////////////////// - inline MPI_Datatype mpi_datatype (const char&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const char&) { return MPI_CHAR; } - inline MPI_Datatype mpi_datatype (const signed char&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const signed char&) { return MPI_CHAR; } - inline MPI_Datatype mpi_datatype (const unsigned char&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const unsigned char&) { return MPI_UNSIGNED_CHAR; } - inline MPI_Datatype mpi_datatype (const short&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const short&) { return MPI_SHORT; } - inline MPI_Datatype mpi_datatype (const unsigned short&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const unsigned short&) { return MPI_UNSIGNED_SHORT; } - inline MPI_Datatype mpi_datatype (const int&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const int&) { return MPI_INT; } - inline MPI_Datatype mpi_datatype (const unsigned int&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const unsigned int&) { return MPI_UNSIGNED; } - inline MPI_Datatype mpi_datatype (const long&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const long&) { return MPI_LONG; } - inline MPI_Datatype mpi_datatype (const unsigned long&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const unsigned long&) { return MPI_UNSIGNED_LONG; } - inline MPI_Datatype mpi_datatype (const long long&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const long long&) { return MPI_LONG_LONG_INT; } - inline MPI_Datatype mpi_datatype (const unsigned long long&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const unsigned long long&) { return MPI_LONG_LONG_INT; } // should be unsigned, but this doesn't exist - inline MPI_Datatype mpi_datatype (const float&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const float&) { return MPI_FLOAT; } - inline MPI_Datatype mpi_datatype (const double&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const double&) { return MPI_DOUBLE; } - inline MPI_Datatype mpi_datatype (const long double&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const long double&) { return MPI_LONG_DOUBLE; } #ifdef HAVE_CCTK_COMPLEX8 - inline MPI_Datatype mpi_datatype (const CCTK_COMPLEX8&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const CCTK_COMPLEX8&) { return mpi_complex8; } #endif #ifdef HAVE_CCTK_COMPLEX16 - inline MPI_Datatype mpi_datatype (const CCTK_COMPLEX16&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const CCTK_COMPLEX16&) { return mpi_complex16; } #endif #ifdef HAVE_CCTK_COMPLEX32 - inline MPI_Datatype mpi_datatype (const CCTK_COMPLEX32&) CCTK_ATTRIBUTE_CONST; inline MPI_Datatype mpi_datatype (const CCTK_COMPLEX32&) { return mpi_complex32; } #endif template <typename T> MPI_Datatype mpi_datatype () { abort(); } - template<> inline MPI_Datatype mpi_datatype <char> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <char> () { return MPI_CHAR; } - template<> inline MPI_Datatype mpi_datatype <signed char> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <signed char> () { return MPI_CHAR; } - template<> inline MPI_Datatype mpi_datatype <unsigned char> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <unsigned char> () { return MPI_UNSIGNED_CHAR; } - template<> inline MPI_Datatype mpi_datatype <short> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <short> () { return MPI_SHORT; } - template<> inline MPI_Datatype mpi_datatype <unsigned short> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <unsigned short> () { return MPI_UNSIGNED_SHORT; } - template<> inline MPI_Datatype mpi_datatype <int> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <int> () { return MPI_INT; } - template<> inline MPI_Datatype mpi_datatype <unsigned int> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <unsigned int> () { return MPI_UNSIGNED; } - template<> inline MPI_Datatype mpi_datatype <long> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <long> () { return MPI_LONG; } - template<> inline MPI_Datatype mpi_datatype <unsigned long> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <unsigned long> () { return MPI_UNSIGNED_LONG; } - template<> inline MPI_Datatype mpi_datatype <long long> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <long long> () { return MPI_LONG_LONG_INT; } - template<> inline MPI_Datatype mpi_datatype <unsigned long long> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <unsigned long long> () { return MPI_LONG_LONG_INT; } // should be unsigned, but this doesn't exist - template<> inline MPI_Datatype mpi_datatype <float> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <float> () { return MPI_FLOAT; } - template<> inline MPI_Datatype mpi_datatype <double> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <double> () { return MPI_DOUBLE; } - template<> inline MPI_Datatype mpi_datatype <long double> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <long double> () { return MPI_LONG_DOUBLE; } #ifdef HAVE_CCTK_COMPLEX8 - template<> inline MPI_Datatype mpi_datatype <CCTK_COMPLEX8> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <CCTK_COMPLEX8> () { return mpi_complex8; } #endif #ifdef HAVE_CCTK_COMPLEX16 - template<> inline MPI_Datatype mpi_datatype <CCTK_COMPLEX16> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <CCTK_COMPLEX16> () { return mpi_complex16; } #endif #ifdef HAVE_CCTK_COMPLEX32 - template<> inline MPI_Datatype mpi_datatype <CCTK_COMPLEX32> () CCTK_ATTRIBUTE_CONST; template<> inline MPI_Datatype mpi_datatype <CCTK_COMPLEX32> () { return mpi_complex32; } #endif diff --git a/Carpet/CarpetLib/src/fulltree.hh b/Carpet/CarpetLib/src/fulltree.hh index aa01b1ba9..55a8d7fad 100644 --- a/Carpet/CarpetLib/src/fulltree.hh +++ b/Carpet/CarpetLib/src/fulltree.hh @@ -30,7 +30,7 @@ using namespace std; // Generic arithmetic search template <typename T> static -int asearch (T t, vector <T> const & ts); +int asearch (T t, vector <T> const & ts) CCTK_ATTRIBUTE_PURE; @@ -89,20 +89,20 @@ public: bool is_leaf() const { return type == type_leaf; } // Compare trees - bool operator== (fulltree const & t) const; + bool operator== (fulltree const & t) const CCTK_MEMBER_ATTRIBUTE_PURE; bool operator!= (fulltree const & t) const { return not (*this == t); } // Invariant - bool invariant () const; + bool invariant () const CCTK_MEMBER_ATTRIBUTE_PURE; // Access the payload P const & payload () const { assert (is_leaf()); return p; } P & payload () { assert (is_leaf()); return p; } // Find the leaf payload corresponding to a position - P const * search (tvect const & ipos) const; - P * search (tvect const & ipos); + P const * search (tvect const & ipos) const CCTK_MEMBER_ATTRIBUTE_PURE; + P * search (tvect const & ipos) CCTK_MEMBER_ATTRIBUTE_PURE; class const_iterator { fulltree const & f; @@ -116,12 +116,13 @@ public: const_iterator (const_iterator const &); const_iterator & operator= (const_iterator const &); public: - fulltree const & operator* () const; - bool operator== (const_iterator const & it2) const; + fulltree const & operator* () const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator== (const_iterator const & it2) const + CCTK_MEMBER_ATTRIBUTE_PURE; bool operator!= (const_iterator const & it2) const { return not (*this == it2); } const_iterator & operator++ (); - bool done () const; + bool done () const CCTK_MEMBER_ATTRIBUTE_PURE; }; class iterator { @@ -136,12 +137,12 @@ public: iterator (iterator const &); iterator & operator= (iterator const &); public: - fulltree & operator* () const; - bool operator== (iterator const & it2) const; + fulltree & operator* () const CCTK_MEMBER_ATTRIBUTE_PURE; + bool operator== (iterator const & it2) const CCTK_MEMBER_ATTRIBUTE_PURE; bool operator!= (iterator const & it2) const { return not (*this == it2); } iterator & operator++ (); - bool done () const; + bool done () const CCTK_MEMBER_ATTRIBUTE_PURE; }; #if 0 @@ -164,7 +165,7 @@ public: #endif // Memory usage - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; // Output helper void output (ostream & os) const; @@ -174,8 +175,6 @@ public: // Memory usage template <typename T, int D, typename P> -inline size_t memoryof (fulltree<T,D,P> const & f) CCTK_ATTRIBUTE_PURE; -template <typename T, int D, typename P> inline size_t memoryof (fulltree<T,D,P> const & f) { return f.memory(); } diff --git a/Carpet/CarpetLib/src/gdata.hh b/Carpet/CarpetLib/src/gdata.hh index 1b7e4f203..ea44bc6fc 100644 --- a/Carpet/CarpetLib/src/gdata.hh +++ b/Carpet/CarpetLib/src/gdata.hh @@ -171,8 +171,8 @@ public: private: // Datatype accessors // maps the C datatype of a data class object to a 0-based index - virtual unsigned int c_datatype () const = 0; - virtual size_t c_datatype_size () const = 0; + virtual unsigned int c_datatype () const CCTK_MEMBER_ATTRIBUTE_PURE = 0; + virtual size_t c_datatype_size () const CCTK_MEMBER_ATTRIBUTE_PURE = 0; // Data manipulators @@ -230,14 +230,13 @@ private: = 0; public: - virtual size_t memory () const CCTK_ATTRIBUTE_PURE = 0; - static size_t allmemory () CCTK_ATTRIBUTE_PURE; + virtual size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE = 0; + static size_t allmemory () CCTK_MEMBER_ATTRIBUTE_PURE; virtual ostream& output (ostream& os) const = 0; }; -inline size_t memoryof (gdata const & d) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (gdata const & d) { return d.memory (); diff --git a/Carpet/CarpetLib/src/gf.hh b/Carpet/CarpetLib/src/gf.hh index 227c739bf..a610ea46f 100644 --- a/Carpet/CarpetLib/src/gf.hh +++ b/Carpet/CarpetLib/src/gf.hh @@ -77,7 +77,7 @@ public: // Output - virtual size_t memory () const; + virtual size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; virtual ostream& output (ostream& os) const; private: gf (); // canonical default construtor diff --git a/Carpet/CarpetLib/src/ggf.hh b/Carpet/CarpetLib/src/ggf.hh index 74ebd15ae..56878611c 100644 --- a/Carpet/CarpetLib/src/ggf.hh +++ b/Carpet/CarpetLib/src/ggf.hh @@ -84,10 +84,10 @@ public: virtual ~ggf (); // Comparison - bool operator== (const ggf& f) const CCTK_ATTRIBUTE_PURE; + bool operator== (const ggf& f) const CCTK_MEMBER_ATTRIBUTE_PURE; // Querying - int timelevels (int const ml, int const rl) const CCTK_ATTRIBUTE_PURE + int timelevels (int const ml, int const rl) const { return timelevels_.AT(ml).AT(rl); } @@ -205,8 +205,8 @@ public: // Output - virtual size_t memory () const CCTK_ATTRIBUTE_PURE = 0; - static size_t allmemory () CCTK_ATTRIBUTE_PURE; + virtual size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE = 0; + static size_t allmemory () CCTK_MEMBER_ATTRIBUTE_PURE; virtual ostream& output (ostream& os) const = 0; private: @@ -218,7 +218,6 @@ private: -inline size_t memoryof (ggf const & f) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (ggf const & f) { return f.memory (); diff --git a/Carpet/CarpetLib/src/gh.hh b/Carpet/CarpetLib/src/gh.hh index 4b4f6c6f0..2a12a5c91 100644 --- a/Carpet/CarpetLib/src/gh.hh +++ b/Carpet/CarpetLib/src/gh.hh @@ -93,48 +93,48 @@ private: public: - ibbox const & extent (const int ml, const int rl, const int c) const CCTK_ATTRIBUTE_PURE + ibbox const & extent (const int ml, const int rl, const int c) const { return regions.AT(ml).AT(rl).AT(c).extent; } - ibbox const & baseextent (const int ml, const int rl) const CCTK_ATTRIBUTE_PURE + ibbox const & baseextent (const int ml, const int rl) const { return baseextents.AT(ml).AT(rl); } - b2vect const & outer_boundaries (const int rl, const int c) const CCTK_ATTRIBUTE_PURE + b2vect const & outer_boundaries (const int rl, const int c) const { return regions.AT(0).AT(rl).AT(c).outer_boundaries; } - int processor (const int rl, const int c) const CCTK_ATTRIBUTE_PURE + int processor (const int rl, const int c) const CCTK_MEMBER_ATTRIBUTE_PURE { return regions.AT(0).AT(rl).AT(c).processor; } - int old_processor (const int rl, const int c) const CCTK_ATTRIBUTE_PURE + int old_processor (const int rl, const int c) const CCTK_MEMBER_ATTRIBUTE_PURE { return oldregions.AT(0).AT(rl).AT(c).processor; } - int mglevels () const CCTK_ATTRIBUTE_PURE + int mglevels () const CCTK_MEMBER_ATTRIBUTE_PURE { return (int)regions.size(); } - int reflevels () const CCTK_ATTRIBUTE_PURE + int reflevels () const CCTK_MEMBER_ATTRIBUTE_PURE { if (mglevels() == 0) return 0; return (int)regions.AT(0).size(); } - int components (const int rl) const CCTK_ATTRIBUTE_PURE + int components (const int rl) const CCTK_MEMBER_ATTRIBUTE_PURE { return (int)regions.AT(0).AT(rl).size(); } - bool is_local (const int rl, const int c) const CCTK_ATTRIBUTE_PURE + bool is_local (const int rl, const int c) const CCTK_MEMBER_ATTRIBUTE_PURE { return processor(rl,c) == dist::rank(); } @@ -156,24 +156,27 @@ public: // Convert between index positions and coordinate positions rvect ipos2rpos (ivect const & ipos, rvect const & origin, rvect const & scale, - int const ml, int const rl) const; + int const ml, int const rl) const CCTK_MEMBER_ATTRIBUTE_PURE; ivect rpos2ipos (rvect const & rpos, rvect const & origin, rvect const & scale, - int const ml, int const rl) const; + int const ml, int const rl) const CCTK_MEMBER_ATTRIBUTE_PURE; ivect rpos2ipos1 (rvect const & rpos, rvect const & origin, rvect const & scale, - int const ml, int const rl) const; + int const ml, int const rl) const + CCTK_MEMBER_ATTRIBUTE_PURE; #endif void locate_position (rvect const & rpos, int const ml, int const minrl, int const maxrl, - int & rl, int & c, ivect & aligned_ipos) const; + int & rl, int & c, ivect & aligned_ipos) const + CCTK_MEMBER_ATTRIBUTE_PURE; void locate_position (ivect const & ipos, int const ml, int const minrl, int const maxrl, - int & rl, int & c, ivect & aligned_ipos) const; + int & rl, int & c, ivect & aligned_ipos) const + CCTK_MEMBER_ATTRIBUTE_PURE; // Time hierarchy management th_handle add (th * t); @@ -184,8 +187,8 @@ public: void erase (dh_handle di); // Output - size_t memory () const CCTK_ATTRIBUTE_PURE; - static size_t allmemory () CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; + static size_t allmemory () CCTK_MEMBER_ATTRIBUTE_PURE; ostream & output (ostream & os) const; private: @@ -196,7 +199,6 @@ private: -inline size_t memoryof (gh const & g) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (gh const & g) { return g.memory (); diff --git a/Carpet/CarpetLib/src/mem.hh b/Carpet/CarpetLib/src/mem.hh index 04748f436..ff7f05080 100644 --- a/Carpet/CarpetLib/src/mem.hh +++ b/Carpet/CarpetLib/src/mem.hh @@ -48,7 +48,7 @@ public: T * memptr = NULL, size_t memsize = 0); ~mem (); - T * storage (size_t vectorindex) const CCTK_ATTRIBUTE_PURE + T * storage (size_t vectorindex) const { assert (vectorindex < vectorlength_); assert (clients_.AT(vectorindex)); @@ -57,15 +57,13 @@ public: void register_client (size_t vectorindex); void unregister_client (size_t vectorindex); - bool has_clients () const CCTK_ATTRIBUTE_PURE; + bool has_clients () const CCTK_MEMBER_ATTRIBUTE_PURE; // Memory usage - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; }; template<typename T> -inline size_t memoryof (mem<T> const & m) CCTK_ATTRIBUTE_PURE; -template<typename T> inline size_t memoryof (mem<T> const & m) { return m.memory(); } @@ -110,10 +108,9 @@ public: void * alloc (size_t nbytes); // Memory usage - size_t memory () const CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; }; -inline size_t memoryof (mempool const & m) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (mempool const & m) { return m.memory(); } #endif // ifndef MEM_HH diff --git a/Carpet/CarpetLib/src/operator_prototypes_3d.hh b/Carpet/CarpetLib/src/operator_prototypes_3d.hh index dc775c271..dce5b5c51 100644 --- a/Carpet/CarpetLib/src/operator_prototypes_3d.hh +++ b/Carpet/CarpetLib/src/operator_prototypes_3d.hh @@ -23,11 +23,6 @@ namespace CarpetLib { size_t index3 (size_t const i, size_t const j, size_t const k, size_t const exti, size_t const extj, size_t const extk) - CCTK_ATTRIBUTE_CONST; - static inline - size_t - index3 (size_t const i, size_t const j, size_t const k, - size_t const exti, size_t const extj, size_t const extk) { #ifdef CARPET_DEBUG assert (static_cast <ptrdiff_t> (i) >= 0 and i < exti); diff --git a/Carpet/CarpetLib/src/operator_prototypes_4d.hh b/Carpet/CarpetLib/src/operator_prototypes_4d.hh index d18f288cf..1d0a4609a 100644 --- a/Carpet/CarpetLib/src/operator_prototypes_4d.hh +++ b/Carpet/CarpetLib/src/operator_prototypes_4d.hh @@ -21,11 +21,6 @@ namespace CarpetLib { static inline size_t - index4 (size_t const i, size_t const j, size_t const k, size_t const kl, - size_t const exti, size_t const extj, size_t const extk, size_t const extl) - CCTK_ATTRIBUTE_CONST; - static inline - size_t index4 (size_t const i, size_t const j, size_t const k, size_t const l, size_t const exti, size_t const extj, size_t const extk, size_t const extl) { diff --git a/Carpet/CarpetLib/src/region.hh b/Carpet/CarpetLib/src/region.hh index a8cecfc59..4c8bf25ac 100644 --- a/Carpet/CarpetLib/src/region.hh +++ b/Carpet/CarpetLib/src/region.hh @@ -25,10 +25,10 @@ struct region_t { region_t & operator= (region_t const & a); ~region_t (); - bool invariant () const CCTK_ATTRIBUTE_PURE; + bool invariant () const CCTK_MEMBER_ATTRIBUTE_PURE; // For regridding - CCTK_REAL load () const; + CCTK_REAL load () const CCTK_MEMBER_ATTRIBUTE_PURE; region_t split (CCTK_REAL ratio_new_over_old); // Output processor decomposition? (Off by default.) @@ -41,9 +41,6 @@ bool operator== (region_t const & a, region_t const & b) CCTK_ATTRIBUTE_PURE; inline bool operator!= (region_t const & a, region_t const & b) - CCTK_ATTRIBUTE_PURE; -inline -bool operator!= (region_t const & a, region_t const & b) { return not (a == b); } @@ -85,11 +82,9 @@ struct pseudoregion_t { }; MPI_Datatype mpi_datatype (pseudoregion_t const &) - CCTK_ATTRIBUTE_CONST; + CCTK_ATTRIBUTE_PURE; namespace dist { template<> inline MPI_Datatype mpi_datatype<pseudoregion_t> () - CCTK_ATTRIBUTE_CONST; - template<> inline MPI_Datatype mpi_datatype<pseudoregion_t> () { pseudoregion_t dummy; return mpi_datatype(dummy); } } @@ -97,14 +92,10 @@ bool operator== (pseudoregion_t const & a, pseudoregion_t const & b) CCTK_ATTRIBUTE_PURE; inline bool operator!= (pseudoregion_t const & a, pseudoregion_t const & b) - CCTK_ATTRIBUTE_PURE; -inline -bool operator!= (pseudoregion_t const & a, pseudoregion_t const & b) { return not (a == b); } -inline size_t memoryof (pseudoregion_t const & p) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (pseudoregion_t const & p) { return @@ -135,17 +126,13 @@ struct sendrecv_pseudoregion_t { }; MPI_Datatype mpi_datatype (sendrecv_pseudoregion_t const &) - CCTK_ATTRIBUTE_CONST; + CCTK_ATTRIBUTE_PURE; namespace dist { template<> inline MPI_Datatype mpi_datatype<sendrecv_pseudoregion_t> () - CCTK_ATTRIBUTE_CONST; - template<> inline MPI_Datatype mpi_datatype<sendrecv_pseudoregion_t> () { sendrecv_pseudoregion_t dummy; return mpi_datatype(dummy); } } inline size_t memoryof (sendrecv_pseudoregion_t const & srp) - CCTK_ATTRIBUTE_PURE; -inline size_t memoryof (sendrecv_pseudoregion_t const & srp) { return memoryof (srp.send) + memoryof (srp.recv); } diff --git a/Carpet/CarpetLib/src/th.hh b/Carpet/CarpetLib/src/th.hh index 107e6cc6d..45ca03915 100644 --- a/Carpet/CarpetLib/src/th.hh +++ b/Carpet/CarpetLib/src/th.hh @@ -72,7 +72,7 @@ public: } CCTK_REAL get_time (int const ml, int const rl, int const tl) - const CCTK_ATTRIBUTE_PURE + const { assert (ml>=0 and ml<h.mglevels()); assert (rl>=0 and rl<h.reflevels()); @@ -90,7 +90,7 @@ public: deltas.AT(ml).AT(rl) = dt; } - CCTK_REAL get_delta (int const ml, int const rl) const CCTK_ATTRIBUTE_PURE + CCTK_REAL get_delta (int const ml, int const rl) const { assert (ml>=0 and ml<h.mglevels()); assert (rl>=0 and rl<h.reflevels()); @@ -104,15 +104,14 @@ public: void flip_timelevels (int const ml, int const rl); // Output - size_t memory () const CCTK_ATTRIBUTE_PURE; - static size_t allmemory () CCTK_ATTRIBUTE_PURE; + size_t memory () const CCTK_MEMBER_ATTRIBUTE_PURE; + static size_t allmemory () CCTK_MEMBER_ATTRIBUTE_PURE; istream& input (istream& is); ostream& output (ostream& os) const; }; -inline size_t memoryof (th const & t) CCTK_ATTRIBUTE_PURE; inline size_t memoryof (th const & t) { return t.memory (); diff --git a/Carpet/CarpetLib/src/timestat.hh b/Carpet/CarpetLib/src/timestat.hh index ac7514fb5..e96d6aada 100644 --- a/Carpet/CarpetLib/src/timestat.hh +++ b/Carpet/CarpetLib/src/timestat.hh @@ -119,7 +119,7 @@ namespace CarpetLib { // Timer name string name () - const; + const CCTK_MEMBER_ATTRIBUTE_PURE; // Print timer data void diff --git a/Carpet/CarpetLib/src/vect.hh b/Carpet/CarpetLib/src/vect.hh index 7ff334886..32dc03213 100644 --- a/Carpet/CarpetLib/src/vect.hh +++ b/Carpet/CarpetLib/src/vect.hh @@ -51,23 +51,23 @@ public: // Constructors /** Explicit empty constructor. */ - explicit vect () CCTK_MEMBER_ATTRIBUTE_CONST { } + explicit vect () { } /** Copy constructor. */ - vect (const vect& a) CCTK_MEMBER_ATTRIBUTE_PURE + vect (const vect& a) { for (int d=0; d<D; ++d) elt[d]=a.elt[d]; } /** Constructor from a single element. This constructor might be confusing, but it is very convenient. */ - vect (const T& x) CCTK_MEMBER_ATTRIBUTE_PURE + vect (const T& x) { for (int d=0; d<D; ++d) elt[d]=x; } /** Constructor for 2-element vectors from 2 elements. */ - vect (const T& x, const T& y) CCTK_MEMBER_ATTRIBUTE_PURE + vect (const T& x, const T& y) { ASSERT_VECT (D==2); // Note: this statement may give "index out of range" warnings. @@ -76,7 +76,7 @@ public: } /** Constructor for 3-element vectors from 3 elements. */ - vect (const T& x, const T& y, const T& z) CCTK_MEMBER_ATTRIBUTE_PURE + vect (const T& x, const T& y, const T& z) { ASSERT_VECT (D==3); // Note: this statement may give "index out of range" warnings. @@ -86,7 +86,6 @@ public: /** Constructor for 4-element vectors from 4 elements. */ vect (const T& x, const T& y, const T& z, const T& t) - CCTK_MEMBER_ATTRIBUTE_PURE { ASSERT_VECT (D==4); // Note: this statement may give "index out of range" warnings. @@ -97,7 +96,7 @@ public: #if 0 // This creates confusion /** Constructor from a pointer, i.e., a C array. */ - explicit vect (const T* const x) CCTK_MEMBER_ATTRIBUTE_PURE + explicit vect (const T* const x) { for (int d=0; d<D; ++d) elt[d]=x[d]; } @@ -106,7 +105,7 @@ public: #if 0 // This leads to an ICE on AIX template<int E> - operator vect<vect<T,D>,E> () CCTK_MEMBER_ATTRIBUTE_CONST + operator vect<vect<T,D>,E> () { vect<vect<T,D>,E> r; for (int e=0; e<E; ++e) r[e]=*this; @@ -116,27 +115,27 @@ public: /** Constructor from a vector with a different type. */ template<typename S> - /*explicit*/ vect (const vect<S,D>& a) /*CCTK_MEMBER_ATTRIBUTE_PURE*/ + /*explicit*/ vect (const vect<S,D>& a) { for (int d=0; d<D; ++d) elt[d]=(T)a[d]; } /** Create a new 0-element vector with a specific type. */ - static vect make () CCTK_MEMBER_ATTRIBUTE_CONST + static vect make () { ASSERT_VECT (D==0); return vect(); } /** Create a new 1-element vector with a specific type. */ - static vect make (const T& x) CCTK_MEMBER_ATTRIBUTE_PURE + static vect make (const T& x) { ASSERT_VECT (D==1); return vect(x); } /** Create a new 2-element vector with a specific type. */ - static vect make (const T& x, const T& y) CCTK_MEMBER_ATTRIBUTE_PURE + static vect make (const T& x, const T& y) { ASSERT_VECT (D==2); return vect(x, y); @@ -144,7 +143,6 @@ public: /** Create a new 3-element vector with a specific type. */ static vect make (const T& x, const T& y, const T& z) - CCTK_MEMBER_ATTRIBUTE_PURE { ASSERT_VECT (D==3); return vect(x, y, z); @@ -152,27 +150,26 @@ public: /** Create a new 4-element vector with a specific type. */ static vect make (const T& x, const T& y, const T& z, const T& t) - CCTK_MEMBER_ATTRIBUTE_PURE { ASSERT_VECT (D==4); return vect(x, y, z, t); } /** Treat a constant pointer as a reference to a constant vector. */ - static const vect& ref (const T* const x) CCTK_MEMBER_ATTRIBUTE_PURE + static const vect& ref (const T* const x) { return *(const vect*)x; } /** Treat a pointer as a reference to a vector. */ - static vect& ref (T* const x) CCTK_MEMBER_ATTRIBUTE_PURE + static vect& ref (T* const x) { return *(vect*)x; } /** Create a vector with one element set to 1 and all other elements set to zero. */ - static vect dir (const int d) CCTK_MEMBER_ATTRIBUTE_CONST + static vect dir (const int d) { vect r=(T)0; r[d]=1; @@ -180,7 +177,7 @@ public: } /** Create a vector with e[i] = i. */ - static vect seq () CCTK_MEMBER_ATTRIBUTE_CONST + static vect seq () { vect r; for (int d=0; d<D; ++d) r[d]=d; @@ -188,7 +185,7 @@ public: } /** Create a vector with e[i] = n + i. */ - static vect seq (const int n) CCTK_MEMBER_ATTRIBUTE_CONST + static vect seq (const int n) { vect r; for (int d=0; d<D; ++d) r[d]=n+d; @@ -196,7 +193,7 @@ public: } /** Create a vector with e[i] = n + s * i. */ - static vect seq (const int n, const int s) CCTK_MEMBER_ATTRIBUTE_CONST + static vect seq (const int n, const int s) { vect r; for (int d=0; d<D; ++d) r[d]=n+s*d; @@ -208,14 +205,14 @@ public: /** Return a non-writable element of a vector. */ // (Don't return a reference; *this might be a temporary) // Do return a reference, so that a vector can be accessed as array - const T& operator[] (const int d) const CCTK_MEMBER_ATTRIBUTE_PURE + const T& operator[] (const int d) const { ASSERT_VECT(d>=0 && d<D); return elt[d]; } /** Return a writable element of a vector as reference. */ - T& operator[] (const int d) CCTK_MEMBER_ATTRIBUTE_PURE + T& operator[] (const int d) { ASSERT_VECT(d>=0 && d<D); return elt[d]; @@ -224,7 +221,7 @@ public: #if 0 // This creates confusion /** Return a pointer to a vector. */ - operator const T* () const CCTK_MEMBER_ATTRIBUTE_PURE + operator const T* () const { return this; } @@ -234,7 +231,7 @@ public: element combination is selected by another vector. */ template<typename TT, int DD> vect<T,DD> operator[] (const vect<TT,DD>& a) - const /*CCTK_MEMBER_ATTRIBUTE_PURE*/ + const { vect<T,DD> r; // (*this)[] performs index checking @@ -255,7 +252,7 @@ public: // Non-modifying operators /** Return a new vector where one element has been replaced. */ - vect replace (const int d, const T& x) const CCTK_MEMBER_ATTRIBUTE_PURE + vect replace (const int d, const T& x) const { ASSERT_VECT (d>=0 && d<D); vect r; @@ -263,7 +260,7 @@ public: return r; } - vect reverse () const CCTK_MEMBER_ATTRIBUTE_PURE + vect reverse () const { vect r; for (int d=0; d<D; ++d) r[d]=elt[D-1-d]; @@ -281,7 +278,7 @@ public: (*this)[i] is true or not. */ template<typename TT> vect<TT,D> ifthen (const vect<TT,D>& a, const vect<TT,D>& b) - const /*CCTK_MEMBER_ATTRIBUTE_PURE*/ + const { vect<TT,D> r; for (int d=0; d<D; ++d) r[d]=elt[d]?a[d]:b[d]; @@ -296,16 +293,20 @@ public: vect &vec; int d; public: - iter (vect &a) CCTK_MEMBER_ATTRIBUTE_PURE: vec(a), d(0) { } + iter (vect &a): vec(a), d(0) { } iter& operator++ () { ASSERT_VECT(d<D); ++d; return *this; } - bool operator bool () const CCTK_MEMBER_ATTRIBUTE_PURE { return d==D; } - T& operator* () CCTK_MEMBER_ATTRIBUTE_PURE { return vec[d]; } + bool operator bool () const { return d==D; } + T& operator* () { return vec[d]; } }; #endif // Memory usage - size_t memory () const CCTK_MEMBER_ATTRIBUTE_CONST - { return D * memoryof (*elt); } + size_t memory () const + { + size_t mem = 0; + for (int d=0; d<D; ++d) mem += memoryof(elt[d]); + return mem; + } // Input/Output helpers void input (istream& is); @@ -325,10 +326,6 @@ public: template<typename S,typename T,int D> inline vect<T,D> either (const vect<S,D>& a, const vect<T,D>& b, const vect<T,D>& c) - CCTK_ATTRIBUTE_PURE; -template<typename S,typename T,int D> -inline vect<T,D> either (const vect<S,D>& a, - const vect<T,D>& b, const vect<T,D>& c) { vect<T,D> r; for (int d=0; d<D; ++d) r[d]=a[d]?b[d]:c[d]; @@ -338,20 +335,12 @@ inline vect<T,D> either (const vect<S,D>& a, template<typename S,typename T,int D> inline vect<T,D> either (const vect<S,D>& a, const vect<T,D>& b, const T& c) - CCTK_ATTRIBUTE_PURE; -template<typename S,typename T,int D> -inline vect<T,D> either (const vect<S,D>& a, - const vect<T,D>& b, const T& c) { return either (a, b, vect<T,D>(c)); } template<typename S,typename T,int D> inline vect<T,D> either (const vect<S,D>& a, - const T& b, vect<T,D>& c) - CCTK_ATTRIBUTE_PURE; -template<typename S,typename T,int D> -inline vect<T,D> either (const vect<S,D>& a, const T& b, const vect<T,D>& c) { return either (a, vect<T,D>(b), c); @@ -360,10 +349,6 @@ inline vect<T,D> either (const vect<S,D>& a, template<typename S,typename T,int D> inline vect<T,D> either (const vect<S,D>& a, const T& b, const T& c) - CCTK_ATTRIBUTE_PURE; -template<typename S,typename T,int D> -inline vect<T,D> either (const vect<S,D>& a, - const T& b, const T& c) { return either (a, vect<T,D>(b), vect<T,D>(c)); } @@ -371,9 +356,6 @@ inline vect<T,D> either (const vect<S,D>& a, /** Transpose a vector of a vector */ template<typename T, int D, int DD> inline vect<vect<T,D>,DD> xpose (vect<vect<T,DD>,D> const & a) - CCTK_ATTRIBUTE_PURE; -template<typename T, int D, int DD> -inline vect<vect<T,D>,DD> xpose (vect<vect<T,DD>,D> const & a) { vect<vect<T,D>,DD> r; for (int dd=0; dd<DD; ++dd) for (int d=0; d<D; ++d) r[dd][d] = a[d][dd]; @@ -383,9 +365,6 @@ inline vect<vect<T,D>,DD> xpose (vect<vect<T,DD>,D> const & a) /** Return the element-wise integer power of two vectors. */ template<typename T,int D> inline vect<T,D> ipow (const vect<T,D>& a, const vect<int,D>& b) - CCTK_ATTRIBUTE_PURE; -template<typename T,int D> -inline vect<T,D> ipow (const vect<T,D>& a, const vect<int,D>& b) { vect<T,D> r; for (int d=0; d<D; ++d) r[d]=ipow(a[d],b[d]); @@ -463,8 +442,6 @@ DECLARE_REDUCTION_OPERATOR_2 (hypot,0,+=,*,sqrt) /** Count the number of elements in the vector. */ template<typename T,int D> -inline int count (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; -template<typename T,int D> inline int count (const vect<T,D>& a) { return D; @@ -472,8 +449,6 @@ inline int count (const vect<T,D>& a) /** Return the size (number of elements) of the vector. */ template<typename T,int D> -inline int size (const vect<T,D>& a) CCTK_ATTRIBUTE_CONST; -template<typename T,int D> inline int size (const vect<T,D>& a) { return D; @@ -481,8 +456,6 @@ inline int size (const vect<T,D>& a) /** Return the index of the first maximum element. */ template<typename T,int D> -inline int maxloc (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; -template<typename T,int D> inline int maxloc (const vect<T,D>& a) { ASSERT_VECT (D>0); @@ -493,8 +466,6 @@ inline int maxloc (const vect<T,D>& a) /** Return the index of the last maximum element. */ template<typename T,int D> -inline int maxloc1 (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; -template<typename T,int D> inline int maxloc1 (const vect<T,D>& a) { ASSERT_VECT (D>0); @@ -505,8 +476,6 @@ inline int maxloc1 (const vect<T,D>& a) /** Return the index of the first minimum element. */ template<typename T,int D> -inline int minloc (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; -template<typename T,int D> inline int minloc (const vect<T,D>& a) { ASSERT_VECT (D>0); @@ -517,8 +486,6 @@ inline int minloc (const vect<T,D>& a) /** Return the index of the last minimum element. */ template<typename T,int D> -inline int minloc1 (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; -template<typename T,int D> inline int minloc1 (const vect<T,D>& a) { ASSERT_VECT (D>0); @@ -529,8 +496,6 @@ inline int minloc1 (const vect<T,D>& a) /** Return the n-dimensional linear array index. */ template<typename T,int D> -inline T index (const vect<T,D>& lsh, const vect<T,D>& ind) CCTK_ATTRIBUTE_PURE; -template<typename T,int D> inline T index (const vect<T,D>& lsh, const vect<T,D>& ind) { T r(0); @@ -647,7 +612,7 @@ inline vect<U,D> scan1 (U (* const func)(U val, T x), U val, // Memory usage template<typename T,int D> -inline size_t memoryof (vect<T,D> const & a) CCTK_ATTRIBUTE_CONST; +inline size_t memoryof (vect<T,D> const & a); template<typename T,int D> inline size_t memoryof (vect<T,D> const & a) { return a.memory(); } @@ -694,7 +659,7 @@ namespace dist { /** Constructor for 2-element vectors from 2 elements. */ template<typename T> -inline vect<T,2>::vect<T,2> (const T& x, const T& y) CCTK_ATTRIBUTE_PURE; +inline vect<T,2>::vect<T,2> (const T& x, const T& y); template<typename T> inline vect<T,2>::vect<T,2> (const T& x, const T& y) { @@ -702,7 +667,7 @@ inline vect<T,2>::vect<T,2> (const T& x, const T& y) } /** Constructor for 3-element vectors from 3 elements. */ -vect (const T& x, const T& y, const T& z) CCTK_ATTRIBUTE_PURE; +vect (const T& x, const T& y, const T& z); vect (const T& x, const T& y, const T& z) { ASSERT_VECT (D==3); @@ -710,7 +675,7 @@ vect (const T& x, const T& y, const T& z) } /** Constructor for 4-element vectors from 4 elements. */ -vect (const T& x, const T& y, const T& z, const T& t) CCTK_ATTRIBUTE_PURE; +vect (const T& x, const T& y, const T& z, const T& t); vect (const T& x, const T& y, const T& z, const T& t) { ASSERT_VECT (D==4); diff --git a/Carpet/CarpetLib/src/vect_helpers.hh b/Carpet/CarpetLib/src/vect_helpers.hh index 471ae02ba..d5e512b7d 100644 --- a/Carpet/CarpetLib/src/vect_helpers.hh +++ b/Carpet/CarpetLib/src/vect_helpers.hh @@ -7,7 +7,7 @@ #define DECLARE_MEMBER_OPERATOR_0(fn,op) \ \ - vect fn () const CCTK_ATTRIBUTE_PURE \ + vect fn () const \ { \ vect r; \ for (int d=0; d<D; ++d) r[d]=op elt[d]; \ @@ -21,7 +21,7 @@ #define DECLARE_MEMBER_OPERATOR_0_RET(fn,op,R) \ \ - vect<R,D> fn () const CCTK_ATTRIBUTE_PURE \ + vect<R,D> fn () const \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=op elt[d]; \ @@ -51,26 +51,22 @@ // Declare a function which takes 1 argument and returns type R -#define DECLARE_FUNCTION_1_RET(fn,R) \ - \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a) \ - { \ - vect<R,D> r; \ - for (int d=0; d<D; ++d) r[d]=fn(a[d]); \ - return r; \ - } \ - \ - template<typename T,int D,int E> \ - inline vect<R,D> fn (const vect<vect<T,D>,E>& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<R,D> fn (const vect<vect<T,D>,E>& a) \ - { \ - vect<R,D> r; \ - for (int e=0; e<E; ++e) r[e]=fn(a[e]); \ - return r; \ +#define DECLARE_FUNCTION_1_RET(fn,R) \ + \ + template<typename T,int D> \ + inline vect<R,D> fn (const vect<T,D>& a) \ + { \ + vect<R,D> r; \ + for (int d=0; d<D; ++d) r[d]=fn(a[d]); \ + return r; \ + } \ + \ + template<typename T,int D,int E> \ + inline vect<R,D> fn (const vect<vect<T,D>,E>& a) \ + { \ + vect<R,D> r; \ + for (int e=0; e<E; ++e) r[e]=fn(a[e]); \ + return r; \ } @@ -87,9 +83,6 @@ \ template<typename T,int D> \ inline vect<R,D> fn (const vect<T,D>& a, const vect<T,D>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a, const vect<T,D>& b) \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=fn(a[d],b[d]); \ @@ -98,9 +91,6 @@ \ template<typename T,int D> \ inline vect<R,D> fn (const T& a, const vect<T,D>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const T& a, const vect<T,D>& b) \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=fn(a,b[d]); \ @@ -109,9 +99,6 @@ \ template<typename T,int D> \ inline vect<R,D> fn (const vect<T,D>& a, const T& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a, const T& b) \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=fn(a[d],b); \ @@ -121,10 +108,6 @@ template<typename T,int D,int E> \ inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, \ const vect<vect<T,D>,E>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, \ - const vect<vect<T,D>,E>& b) \ { \ vect<vect<R,D>,E> r; \ for (int e=0; e<E; ++e) r[e]=fn(a[e],b[e]); \ @@ -133,9 +116,6 @@ \ template<typename T,int D,int E> \ inline vect<vect<R,D>,E> fn (const T& a, const vect<vect<T,D>,E>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const T& a, const vect<vect<T,D>,E>& b) \ { \ vect<vect<R,D>,E> r; \ for (int e=0; e<E; ++e) r[e]=fn(a,b[e]); \ @@ -144,9 +124,6 @@ \ template<typename T,int D,int E> \ inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, const T& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, const T& b) \ { \ vect<vect<R,D>,E> r; \ for (int e=0; e<E; ++e) r[e]=fn(a[e],b); \ @@ -163,47 +140,38 @@ // Declare an operator which takes 1 argument and returns type R -#define DECLARE_OPERATOR_1_RET(fn,op,R) \ - \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a) \ - { \ - vect<R,D> r; \ - for (int d=0; d<D; ++d) r[d]=op a[d]; \ - return r; \ - } \ - \ - template<typename T,int D> \ - inline vect<R,D> fn (const T& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const T& a) \ - { \ - vect<R,D> r; \ - for (int d=0; d<D; ++d) r[d]=op a; \ - return r; \ - } \ - \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a) \ - { \ - vect<vect<R,D>,E> r; \ - for (int e=0; e<E; ++e) r[e]=op a[e]; \ - return r; \ - } \ - \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const T& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const T& a) \ - { \ - vect<vect<R,D>,E> r; \ - for (int e=0; e<E; ++e) r[e]=op a; \ - return r; \ +#define DECLARE_OPERATOR_1_RET(fn,op,R) \ + \ + template<typename T,int D> \ + inline vect<R,D> fn (const vect<T,D>& a) \ + { \ + vect<R,D> r; \ + for (int d=0; d<D; ++d) r[d]=op a[d]; \ + return r; \ + } \ + \ + template<typename T,int D> \ + inline vect<R,D> fn (const T& a) \ + { \ + vect<R,D> r; \ + for (int d=0; d<D; ++d) r[d]=op a; \ + return r; \ + } \ + \ + template<typename T,int D,int E> \ + inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a) \ + { \ + vect<vect<R,D>,E> r; \ + for (int e=0; e<E; ++e) r[e]=op a[e]; \ + return r; \ + } \ + \ + template<typename T,int D,int E> \ + inline vect<vect<R,D>,E> fn (const T& a) \ + { \ + vect<vect<R,D>,E> r; \ + for (int e=0; e<E; ++e) r[e]=op a; \ + return r; \ } @@ -214,9 +182,6 @@ \ template<typename T,int D> \ inline vect<R,D> fn (const vect<T,D>& a, const vect<T,D>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a, const vect<T,D>& b) \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=a[d] op b[d]; \ @@ -225,9 +190,6 @@ \ template<typename T,int D> \ inline vect<R,D> fn (const T& a, const vect<T,D>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const T& a, const vect<T,D>& b) \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=a op b[d]; \ @@ -236,9 +198,6 @@ \ template<typename T,int D> \ inline vect<R,D> fn (const vect<T,D>& a, const T& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline vect<R,D> fn (const vect<T,D>& a, const T& b) \ { \ vect<R,D> r; \ for (int d=0; d<D; ++d) r[d]=a[d] op b; \ @@ -248,10 +207,6 @@ template<typename T,int D,int E> \ inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, \ const vect<vect<T,D>,E>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, \ - const vect<vect<T,D>,E>& b) \ { \ vect<vect<R,D>,E> r; \ for (int e=0; e<E; ++e) r[e]=a[e] op b[e]; \ @@ -260,9 +215,6 @@ \ template<typename T,int D,int E> \ inline vect<vect<R,D>,E> fn (const T& a, const vect<vect<T,D>,E>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const T& a, const vect<vect<T,D>,E>& b) \ { \ vect<vect<R,D>,E> r; \ for (int e=0; e<E; ++e) r[e]=a op b[e]; \ @@ -271,9 +223,6 @@ \ template<typename T,int D,int E> \ inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, const T& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D,int E> \ - inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, const T& b) \ { \ vect<vect<R,D>,E> r; \ for (int e=0; e<E; ++e) r[e]=a[e] op b; \ @@ -294,8 +243,6 @@ #define DECLARE_REDUCTION_OPERATOR_1_T_RET(fn,init,op,final,T,R) \ \ template<typename U,int D> \ - inline vect<R,D> fn (const vect<U,D>& a) CCTK_ATTRIBUTE_PURE; \ - template<typename U,int D> \ inline vect<R,D> fn (const vect<U,D>& a) \ { \ vect<R,D> r; \ @@ -304,8 +251,6 @@ } \ \ template<int D> \ - inline R fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \ - template<int D> \ inline R fn (const vect<T,D>& a) \ { \ R r(init); \ @@ -317,16 +262,14 @@ // Declare a reduction function which takes 1 argument -#define DECLARE_REDUCTION_OPERATOR_1(fn,init,op,final) \ - \ - template<typename T,int D> \ - inline T fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline T fn (const vect<T,D>& a) \ - { \ - T r(init); \ - for (int d=0; d<D; ++d) r op a[d]; \ - return final(r); \ +#define DECLARE_REDUCTION_OPERATOR_1(fn,init,op,final) \ + \ + template<typename T,int D> \ + inline T fn (const vect<T,D>& a) \ + { \ + T r(init); \ + for (int d=0; d<D; ++d) r op a[d]; \ + return final(r); \ } @@ -336,8 +279,6 @@ #define DECLARE_REDUCTION_FUNCTION_1(fn,init,op,final) \ \ template<typename T,int D> \ - inline T fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ inline T fn (const vect<T,D>& a) \ { \ T r(init); \ @@ -349,17 +290,14 @@ // Declare a reduction function which takes 2 arguments -#define DECLARE_REDUCTION_OPERATOR_2(fn,init,op,op2,final) \ - \ - template<typename T,int D> \ - inline T fn (const vect<T,D>& a, const vect<T,D>& b) \ - CCTK_ATTRIBUTE_PURE; \ - template<typename T,int D> \ - inline T fn (const vect<T,D>& a, const vect<T,D>& b) \ - { \ - T r(init); \ - for (int d=0; d<D; ++d) r op (a[d] op2 b[d]); \ - return final(r); \ +#define DECLARE_REDUCTION_OPERATOR_2(fn,init,op,op2,final) \ + \ + template<typename T,int D> \ + inline T fn (const vect<T,D>& a, const vect<T,D>& b) \ + { \ + T r(init); \ + for (int d=0; d<D; ++d) r op (a[d] op2 b[d]); \ + return final(r); \ } |