96 #define TRACE(stuff) std::cout << FormDebugHead() << stuff << std::endl << std::flush;
99 #define MARK std::cout << FormDebugHead() << __FILE__ << " at line " << __LINE__ << std::endl << std::flush;
101 #define MARK_ON_PROCESS(proc) if (PetscTools::GetMyRank()==proc) std::cout << FormDebugHead() << __FILE__ << " at line " << __LINE__ << std::endl << std::flush;
104 #define PRINT_VARIABLE(var) std::cout << FormDebugHead() << #var " = " << var << std::endl << std::flush;
110 #define PRINT_2_VARIABLES(var1,var2) std::cout << FormDebugHead() << #var1 " = " << var1 << ", " \
111 #var2 " = " << var2 << std::endl << std::flush;
118 #define PRINT_3_VARIABLES(var1,var2,var3) std::cout << FormDebugHead() << #var1 " = " << var1 << ", " \
119 #var2 " = " << var2 << ", " #var3 " = " << var3 << std::endl << std::flush;
127 #define PRINT_4_VARIABLES(var1,var2,var3,var4) std::cout << FormDebugHead() << #var1 " = " << var1 << ", " \
128 #var2 " = " << var2 << ", " #var3 " = " << var3 << ", " \
129 #var4 " = " << var4 << std::endl << std::flush;
138 #define PRINT_5_VARIABLES(var1,var2,var3,var4,var5) std::cout << FormDebugHead() << #var1 " = " << var1 << ", " \
139 #var2 " = " << var2 << ", " #var3 " = " << var3 << ", " \
140 #var4 " = " << var4 << ", " #var5 " = " << var5 <<std::endl << std::flush;
144 #define QUIT_AFTER_N_VISITS(n) { static unsigned counter=0; if (++counter==(n)) {TRACE("User-forced quit."); assert(0);} }
148 #define HOW_MANY_TIMES_HERE(message) { \
149 static unsigned counter=1; \
150 std::cout << FormDebugHead() << "Num times here (" << message << "): " << counter++ << std::endl << std::flush; }
155 #define TRACE_FROM_NTH_VISIT(stuff,n) { \
156 static unsigned counter=0; \
157 if (++counter>=(n)) {TRACE(stuff<<" (visit "<<counter<<")");} }
161 #define PRINT_VECTOR(v) \
162 { std::cout << FormDebugHead() << #v " = {"; \
163 for (unsigned _i=0; _i<v.size(); _i++) { \
164 std::cout << (_i==0?"":",") << v[_i]; } \
165 std::cout << "}" << std::endl << std::flush; }
177 #define MARK_IN_ORDER PetscTools::BeginRoundRobin(); MARK; PetscTools::EndRoundRobin();
182 #define STACK PrintTheStack();
190 #define MARK_MEMORY MarkMemory();
196 #define UNMARK_MEMORY UnmarkMemory();
202 #define PRINT_MEMORY PrintMemory();
std::string FormDebugHead()