aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/vect_helpers.hh
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2012-02-24 23:02:22 -0500
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:23:05 +0100
commit0f0235b7a2a02a93cfe757d977ed56c2469dc673 (patch)
treec9ebc615cbee510ddefa3d575e36ba4a01bbc40c /Carpet/CarpetLib/src/vect_helpers.hh
parent5f566b7daa4e0d1d14536600b31207a1bc4dfc64 (diff)
CarpetLib: Remove/correct ATTRIBUTE_CONST and ATTRIBUTE_PURE declarations
Diffstat (limited to 'Carpet/CarpetLib/src/vect_helpers.hh')
-rw-r--r--Carpet/CarpetLib/src/vect_helpers.hh194
1 files changed, 66 insertions, 128 deletions
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); \
}