aboutsummaryrefslogtreecommitdiff
path: root/Carpet/CarpetLib/src/vect_helpers.hh
diff options
context:
space:
mode:
Diffstat (limited to 'Carpet/CarpetLib/src/vect_helpers.hh')
-rw-r--r--Carpet/CarpetLib/src/vect_helpers.hh184
1 files changed, 110 insertions, 74 deletions
diff --git a/Carpet/CarpetLib/src/vect_helpers.hh b/Carpet/CarpetLib/src/vect_helpers.hh
index afcce6e7e..471ae02ba 100644
--- a/Carpet/CarpetLib/src/vect_helpers.hh
+++ b/Carpet/CarpetLib/src/vect_helpers.hh
@@ -7,7 +7,8 @@
#define DECLARE_MEMBER_OPERATOR_0(fn,op) \
\
- vect fn () const PURE { \
+ vect fn () const CCTK_ATTRIBUTE_PURE \
+ { \
vect r; \
for (int d=0; d<D; ++d) r[d]=op elt[d]; \
return r; \
@@ -20,7 +21,8 @@
#define DECLARE_MEMBER_OPERATOR_0_RET(fn,op,R) \
\
- vect<R,D> fn () const PURE { \
+ vect<R,D> fn () const CCTK_ATTRIBUTE_PURE \
+ { \
vect<R,D> r; \
for (int d=0; d<D; ++d) r[d]=op elt[d]; \
return r; \
@@ -33,12 +35,14 @@
#define DECLARE_MEMBER_OPERATOR_1_REF(fn,op) \
\
- vect& fn (const T& x) { \
+ vect& fn (const T& x) \
+ { \
for (int d=0; d<D; ++d) elt[d] op x; \
return *this; \
} \
\
- vect& fn (const vect& a) { \
+ vect& fn (const vect& a) \
+ { \
for (int d=0; d<D; ++d) elt[d] op a[d]; \
return *this; \
}
@@ -47,25 +51,26 @@
// 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) 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) 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) 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; \
}
@@ -81,36 +86,45 @@
#define DECLARE_FUNCTION_2_RET(fn,R) \
\
template<typename T,int D> \
- inline vect<R,D> fn (const vect<T,D>& a, const vect<T,D>& b) PURE; \
+ 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) { \
+ 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]); \
return r; \
} \
\
template<typename T,int D> \
- inline vect<R,D> fn (const T& a, const vect<T,D>& b) PURE; \
+ 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) { \
+ 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]); \
return r; \
} \
\
template<typename T,int D> \
- inline vect<R,D> fn (const vect<T,D>& a, const T& b) PURE; \
+ 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) { \
+ 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); \
return r; \
} \
\
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) PURE; \
+ 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) \
+ 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]); \
@@ -118,7 +132,8 @@
} \
\
template<typename T,int D,int E> \
- inline vect<vect<R,D>,E> fn (const T& a, const vect<vect<T,D>,E>& b) PURE; \
+ 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) \
{ \
@@ -128,7 +143,8 @@
} \
\
template<typename T,int D,int E> \
- inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, const T& b) PURE; \
+ 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) \
{ \
@@ -150,25 +166,28 @@
#define DECLARE_OPERATOR_1_RET(fn,op,R) \
\
template<typename T,int D> \
- inline vect<R,D> fn (const vect<T,D>& a) PURE; \
+ 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) { \
+ 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) PURE; \
+ inline vect<R,D> fn (const T& a) CCTK_ATTRIBUTE_PURE; \
template<typename T,int D> \
- inline vect<R,D> fn (const T& a) { \
+ 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) PURE; \
+ 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) \
{ \
@@ -178,7 +197,7 @@
} \
\
template<typename T,int D,int E> \
- inline vect<vect<R,D>,E> fn (const T& a) PURE; \
+ 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) \
{ \
@@ -194,36 +213,45 @@
#define DECLARE_OPERATOR_2_RET(fn,op,R) \
\
template<typename T,int D> \
- inline vect<R,D> fn (const vect<T,D>& a, const vect<T,D>& b) PURE; \
+ 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) { \
+ 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]; \
return r; \
} \
\
template<typename T,int D> \
- inline vect<R,D> fn (const T& a, const vect<T,D>& b) PURE; \
+ 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) { \
+ 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]; \
return r; \
} \
\
template<typename T,int D> \
- inline vect<R,D> fn (const vect<T,D>& a, const T& b) PURE; \
+ 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) { \
+ 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; \
return r; \
} \
\
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) PURE; \
+ 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) \
+ 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]; \
@@ -231,7 +259,8 @@
} \
\
template<typename T,int D,int E> \
- inline vect<vect<R,D>,E> fn (const T& a, const vect<vect<T,D>,E>& b) PURE; \
+ 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) \
{ \
@@ -241,14 +270,15 @@
} \
\
template<typename T,int D,int E> \
- inline vect<vect<R,D>,E> fn (const vect<vect<T,D>,E>& a, const T& b) PURE; \
+ 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; \
return r; \
- }
+ }
@@ -264,18 +294,20 @@
#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) PURE; \
+ 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) { \
+ inline vect<R,D> fn (const vect<U,D>& a) \
+ { \
vect<R,D> r; \
for (int d=0; d<D; ++d) r[d]=fn(a[d]); \
return r; \
} \
\
template<int D> \
- inline R fn (const vect<T,D>& a) PURE; \
+ inline R fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \
template<int D> \
- inline R fn (const vect<T,D>& a) { \
+ inline R fn (const vect<T,D>& a) \
+ { \
R r(init); \
for (int d=0; d<D; ++d) r op a[d]; \
return final(r); \
@@ -285,15 +317,16 @@
// 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) 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) 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); \
}
@@ -303,9 +336,10 @@
#define DECLARE_REDUCTION_FUNCTION_1(fn,init,op,final) \
\
template<typename T,int D> \
- inline T fn (const vect<T,D>& a) PURE; \
+ inline T fn (const vect<T,D>& a) CCTK_ATTRIBUTE_PURE; \
template<typename T,int D> \
- inline T fn (const vect<T,D>& a) { \
+ inline T fn (const vect<T,D>& a) \
+ { \
T r(init); \
for (int d=0; d<D; ++d) op(r,a[d]); \
return final(r); \
@@ -315,15 +349,17 @@
// 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) 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) \
+ 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); \
}