TTK
Loading...
Searching...
No Matches
Debug.cpp
Go to the documentation of this file.
1#include <Debug.h>
2
5
9
10using namespace std;
11using namespace ttk;
12
14
15 setDebugMsgPrefix("Debug");
16
18
19 // avoid warnings
20 if(goodbyeMsg_)
21 goodbyeMsg_ = true;
22}
23
25 if((lastObject_) && (ttk::goodbyeMsg_)) {
26
29
30 ttk::goodbyeMsg_ = false;
31 }
32}
33
34int Debug::welcomeMsg(ostream &stream) {
35
36#ifdef TTK_ENABLE_MPI
37 if(MPIrank_ != 0) {
38 ttk::welcomeMsg_ = false;
39 }
40#endif // TTK_ENABLE_MPI
41
42 const int priorityAsInt = (int)debug::Priority::PERFORMANCE;
43
44 if((ttk::welcomeMsg_) && (debugLevel_ > priorityAsInt)) {
45 ttk::welcomeMsg_ = false;
46
47 const string currentPrefix = debugMsgPrefix_;
48 debugMsgPrefix_ = "[Common] ";
49
50#include <welcomeLogo.inl>
51#include <welcomeMsg.inl>
52
53#ifndef NDEBUG
55 printMsg(debug::output::YELLOW + "TTK has been built in debug mode!",
57 printMsg(debug::output::YELLOW + "DEVELOPERS ONLY!",
60 debug::output::YELLOW + "Expect important performance degradation.",
63#endif
64#ifndef TTK_ENABLE_OPENMP
67 debug::output::YELLOW + "TTK has *NOT* been built in parallel mode!",
69 printMsg(debug::output::YELLOW + "DEVELOPERS ONLY!",
72 debug::output::YELLOW + "Expect important performance degradation.",
75
77 debug::output::YELLOW + "To enable the parallel mode, rebuild TTK with:",
79 printMsg(debug::output::YELLOW + " -DTTK_ENABLE_OPENMP=ON",
82#endif
83#ifndef TTK_ENABLE_KAMIKAZE
86 debug::output::YELLOW + "TTK has *NOT* been built in performance mode!",
88 printMsg(debug::output::YELLOW + "DEVELOPERS ONLY!",
91 debug::output::YELLOW + "Expect important performance degradation.",
94
96 + "To enable the performance mode, rebuild TTK with:",
98 printMsg(debug::output::YELLOW + " -DTTK_ENABLE_KAMIKAZE=ON",
101#endif
102#ifndef TTK_ENABLE_DOUBLE_TEMPLATING
105 + "TTK has *NOT* been built in double-templating mode!",
107 printMsg(debug::output::YELLOW + "DEVELOPERS ONLY!",
109 printMsg(
110 debug::output::YELLOW + "Expect unsupported types for bivariate data.",
113
115 + "To enable the double-templating mode, rebuild TTK with:",
117 printMsg(debug::output::YELLOW + " -DTTK_ENABLE_DOUBLE_TEMPLATING=ON",
120#endif
121#ifdef TTK_REDUCE_TEMPLATE_INSTANTIATIONS
123 printMsg(
124 debug::output::YELLOW + "TTK has *NOT* been built with all VTK types!",
126 printMsg(debug::output::YELLOW + "DEVELOPERS ONLY!",
128 printMsg(debug::output::YELLOW + "Expect unsupported scalar field types!",
131
132 printMsg(
133 debug::output::YELLOW + "To support all VTK types, rebuild TTK with:",
135 printMsg(
136 debug::output::YELLOW + " -DTTK_REDUCE_TEMPLATE_INSTANTIATIONS=OFF",
139#endif // TTK_REDUCE_TEMPLATE_INSTANTIATIONS
140
141 debugMsgPrefix_ = currentPrefix;
142 }
143
144 return 0;
145}
146
147int Debug::setDebugLevel(const int &debugLevel) {
148 debugLevel_ = debugLevel;
149
150 welcomeMsg(cout);
151
152 return 0;
153}
154
155int Debug::setWrapper(const Wrapper *wrapper) {
156
157 BaseClass::setWrapper(wrapper);
158
159 setDebugLevel(reinterpret_cast<Debug *>(wrapper_)->debugLevel_);
160
161 return 0;
162}
#define COMMON_EXPORTS
Definition BaseClass.h:31
virtual int setWrapper(const Wrapper *wrapper)
Definition BaseClass.cpp:36
Wrapper * wrapper_
Definition BaseClass.h:96
Minimalist debugging class.
Definition Debug.h:88
int debugLevel_
Definition Debug.h:379
int welcomeMsg(std::ostream &stream)
Definition Debug.cpp:34
static COMMON_EXPORTS debug::LineMode lastLineMode
Definition Debug.h:381
int setWrapper(const Wrapper *wrapper) override
Definition Debug.cpp:155
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364
virtual int setDebugLevel(const int &debugLevel)
Definition Debug.cpp:147
~Debug() override
Definition Debug.cpp:24
std::string debugMsgPrefix_
Definition Debug.h:383
Wrapper class to wrap ttk code.
Definition Wrapper.h:14
const std::string YELLOW
Definition Debug.h:77
The Topology ToolKit.
COMMON_EXPORTS int MPIrank_
Definition BaseClass.cpp:9
COMMON_EXPORTS bool goodbyeMsg_
Definition Debug.cpp:7
COMMON_EXPORTS bool welcomeMsg_
Definition Debug.cpp:6
COMMON_EXPORTS int globalDebugLevel_
Definition Debug.cpp:8
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)