49 #define CEPS_IO_DECIMAL_PRECISION 8
55 #define CEPS_WARNING "WARNING"
60 #define CEPS_ERROR "FATAL ERROR"
65 #define CEPS_COLORED_WARNING "\033[1m\033[34mWARNING\033[0m"
70 #define CEPS_COLORED_ERROR "\033[1m\033[31mFATAL_ERROR\033[0m"
75 #define CEPS_SEPARATOR_LENGTH 77
80 #define CEPS_STRING_SEPARATOR std::string (CEPS_SEPARATOR_LENGTH, '-')
85 #define CEPS_SEPARATOR CEPS_SAYS (CEPS_STRING_SEPARATOR)
91 #define CEPS_SAYS_IN_PROGRESS(message) \
94 if (ceps::isDebug ()) \
96 ceps::debugLog () << "\r · " << message << std::flush; \
98 if (ceps::isVerbose ()) \
100 std::cout << "\r · " << message << std::flush; \
108 #define CEPS_SAYS(message) \
111 if (ceps::isDebug ()) \
113 ceps::debugLog () << " · " << message << std::endl; \
115 if (ceps::isVerbose ()) \
117 std::cout << " · " << message << std::endl; \
124 #define CEPS_SAYS_IN_GREEN(message) \
127 if (ceps::isDebug ()) \
129 ceps::debugLog () << " · " << message << std::endl; \
131 if (ceps::isVerbose ()) \
133 std::cout << " · \033[1m\033[32;1m" << message << "\033[0m"<< std::endl; \
142 #define CEPS_SAYS_NOENDL(message) \
145 if (ceps::isDebug ()) \
147 ceps::debugLog () << " · " << message; \
149 if (ceps::isVerbose ()) \
151 std::cout << " · " << message; \
153 std::flush(std::cout); \
160 #define CEPS_SAYS_INLINE(message) \
163 if (ceps::isDebug ()) \
165 ceps::debugLog () << message << std::endl; \
167 if (ceps::isVerbose ()) \
169 std::cout << message << std::endl; \
177 #define CEPS_SAYS_IF(condition, message) \
182 CEPS_SAYS (message); \
186 #ifdef CEPS_DEBUG_ENABLED
191 #define CEPS_WARNS(message) \
194 if (ceps::isWarnings()) \
196 std::ostringstream oss; \
198 CepsException ___e(oss.str(),true); \
199 std::cerr << ___e.errorMessage(true) << std::endl; \
200 ceps::debugLog() << ___e.errorMessage(false) << std::endl; \
209 #define CEPS_WARNS_IF(condition, message) \
212 if ((condition) && ceps::isWarnings ()) \
214 std::ostringstream oss; \
216 CepsException ___e(oss.str(),true); \
217 std::cerr << ___e.errorMessage(true) << std::endl; \
218 ceps::debugLog() << ___e.errorMessage(false) << std::endl; \
226 #define CEPS_WARNS(message) \
229 if (ceps::isWarnings()) \
231 std::ostringstream oss; \
233 CepsException ___e(oss.str(),true); \
234 std::cerr << ___e.errorMessage(true) << std::endl; \
243 #define CEPS_WARNS_IF(condition, message) \
246 if ((condition) && ceps::isWarnings()) \
248 std::ostringstream oss; \
250 CepsException ___e(oss.str(),true); \
251 std::cerr << ___e.errorMessage(true) << std::endl; \
264 #define CEPS_ABORT(message) \
266 std::ostringstream oss; \
268 throw CepsException(oss.str()); \
275 #define CEPS_ABORT_IF(condition,message)\
279 std::ostringstream oss; \
281 throw CepsException(oss.str()); \
289 #define CEPS_CHECK_IS_NAN(value, message) \
291 std::isnan(value) or ! std::isfinite(value), "Value is NaN or infinity.\n · " << message \
308 #define CEPS_DVAL_1(_0, ...) "\"" << #_0 << "\" : " << _0
313 #define CEPS_DVAL_2(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_1(__VA_ARGS__)
318 #define CEPS_DVAL_3(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_2(__VA_ARGS__)
323 #define CEPS_DVAL_4(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_3(__VA_ARGS__)
328 #define CEPS_DVAL_5(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_4(__VA_ARGS__)
333 #define CEPS_DVAL_6(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_5(__VA_ARGS__)
338 #define CEPS_DVAL_7(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_6(__VA_ARGS__)
343 #define CEPS_DVAL_8(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_7(__VA_ARGS__)
348 #define CEPS_DVAL_9(_0, ...) CEPS_DVAL_1 (_0) << ", " << CEPS_DVAL_8(__VA_ARGS__)
353 #define VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N
358 #define VA_NARGS(...) VA_NARGS_IMPL(_, ##__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)
365 #define CEPS_CONCAT_2(x, y) x##y
370 #define CEPS_CONCAT(x, y) CEPS_CONCAT_2(x, y)
375 #define CEPS_DVAL_CALL(N, ...) CEPS_CONCAT(CEPS_DVAL_, N) (__VA_ARGS__)
381 #define CEPS_DISPLAY_VAL(...) CEPS_DVAL_CALL(VA_NARGS (__VA_ARGS__), __VA_ARGS__)
387 #define DISP(...) std::cout << CEPS_DISPLAY_VAL(__VA_ARGS__) << std::endl
395 #define DISPR(...) std::cout << "proc" << ceps::getRank() << " " << CEPS_DISPLAY_VAL(__VA_ARGS__) << std::endl
402 #define SEQDISP(...) \
403 ceps::beginSequential();\
404 DISPR(__VA_ARGS__); \
405 std::flush(std::cout); \
406 ceps::endSequential();
408 #define CEPS_UNIMPLEMENTED static_assert (true, "unimplemented function")
410 #define CEPS_UNUSED(X) (void) X