-
-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathUtilities.H
More file actions
47 lines (37 loc) · 1.01 KB
/
Utilities.H
File metadata and controls
47 lines (37 loc) · 1.01 KB
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
45
46
47
#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");
// Returns true if the match is found in the beginning of the string s, ignoring case
bool matchingStrings(std::string s, std::string match);
#endif