27 #ifndef SCHNEK_GRIDCHECK_H_ 28 #define SCHNEK_GRIDCHECK_H_ 32 #include "../util/logger.hpp" 33 #include "../macros.hpp" 42 SCHNEK_INLINE
static const IndexType &check(
54 SCHNEK_INLINE
static const IndexType &check(
68 static bool errorFlag;
70 static IndexType offending;
72 static const IndexType check(
78 static bool getErrorFlag()
83 static int getErrorInfo()
88 static IndexType getOffending()
101 template<
size_t rank>
108 for (
int i=0; i<rank; ++i)
110 assert(pos[i]>=low[i]);
111 assert(pos[i]<=high[i]);
117 template<
size_t rank>
120 template<
size_t rank>
123 template<
size_t rank>
126 template<
size_t rank>
134 for (
size_t i=0; i<rank; ++i)
136 if (pos_copy[i]<low[i]) {
137 SCHNEK_TRACE_ERR(1,
"schnek::GridDebugCheck index out of range (dim="<<i<<
"): index=" <<pos_copy[i]<<
" lo="<<low[i])
139 GridDebugCheck<rank>::errorFlag =
true;
140 GridDebugCheck<rank>::errorInfo = -i;
141 GridDebugCheck<rank>::offending = pos;
143 if (pos_copy[i] > high[i])
145 SCHNEK_TRACE_ERR(1,
"schnek::GridDebugCheck index out of range (dim="<<i<<
"): index=" <<pos_copy[i]<<
" hi="<<high[i])
146 pos_copy[i] = high[i];
147 GridDebugCheck<rank>::errorFlag =
true;
148 GridDebugCheck<rank>::errorInfo = i;
149 GridDebugCheck<rank>::offending = pos;
157 #endif // SCHNEK_GRIDCHECK_H_ Definition: gridcheck.hpp:64
Definition: gridcheck.hpp:51
Definition: gridcheck.hpp:39
#define SCHNEK_TRACE_ERR(i, x)
Definition: logger.hpp:72