-
-
Notifications
You must be signed in to change notification settings - Fork 85
/
Utilities.H
44 lines (35 loc) · 892 Bytes
/
Utilities.H
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef UTILITIES_H
#define UTILITIES_H
// Filter-out debug messages when not required
#ifdef ADAPTER_DEBUG_MODE
#define DEBUG(x) x
#else
#define DEBUG(x)
#endif
// Filter-out timing when not required
#ifdef ADAPTER_ENABLE_TIMINGS
#define TIMING_MODE(x) x
#else
#define TIMING_MODE(x)
#endif
// Shortcut for constructing clocks
#ifdef ADAPTER_ENABLE_TIMINGS
#define SETUP_TIMER() \
clockValue clock; \
clock.update()
#define REUSE_TIMER() clock.update()
#else
#define SETUP_TIMER()
#define REUSE_TIMER()
#endif
// Shortcut for adding time
#ifdef ADAPTER_ENABLE_TIMINGS
#define ACCUMULATE_TIMER(x) x += clock.elapsed()
#else
#define ACCUMULATE_TIMER(x)
#endif
// String added in the beginning of every printed message
#define INFO_STR_ADAPTER "---[preciceAdapter] "
#include "IOstreams.H"
void adapterInfo(const std::string message, const std::string level = "debug");
#endif