Chaste Release::3.1
|
#include <iostream>
#include <cassert>
#include <sstream>
#include <string>
#include "PetscTools.hpp"
Go to the source code of this file.
Defines | |
#define | TRACE(stuff) std::cout << FormDebugHead() << stuff << std::endl << std::flush; |
#define | MARK std::cout << FormDebugHead() << __FILE__ << " at line " <<__LINE__ << std::endl << std::flush; |
#define | PRINT_VARIABLE(var) std::cout << FormDebugHead() << #var " = " << var << std::endl << std::flush; |
#define | PRINT_2_VARIABLES(var1, var2) |
#define | PRINT_3_VARIABLES(var1, var2, var3) |
#define | PRINT_4_VARIABLES(var1, var2, var3, var4) |
#define | PRINT_5_VARIABLES(var1, var2, var3, var4, var5) |
#define | QUIT_AFTER_N_VISITS(n) { static unsigned counter=0; if (++counter==(n)) {TRACE("User-forced quit."); assert(0);} } |
#define | HOW_MANY_TIMES_HERE(message) |
#define | TRACE_FROM_NTH_VISIT(stuff, n) |
#define | PRINT_VECTOR(v) |
Functions | |
std::string | FormDebugHead () |
A bunch of useful macros for debugging. These all output information to stdout as lines starting "DEBUG: ". When running in parallel the process number is also displayed. Each line is flushed as soon as it is written.
Definition in file Debug.hpp.
#define HOW_MANY_TIMES_HERE | ( | message | ) |
{ \ static unsigned counter=1; \ std::cout << FormDebugHead() << "Num times here (" << message << "): " << counter++ << std::endl << std::flush; }
Print how many times this line has been reached, everytime it is reached.
message | message to include in brackets |
#define MARK std::cout << FormDebugHead() << __FILE__ << " at line " <<__LINE__ << std::endl << std::flush; |
#define PRINT_2_VARIABLES | ( | var1, | |
var2 | |||
) |
#define PRINT_3_VARIABLES | ( | var1, | |
var2, | |||
var3 | |||
) |
#define PRINT_4_VARIABLES | ( | var1, | |
var2, | |||
var3, | |||
var4 | |||
) |
#define PRINT_5_VARIABLES | ( | var1, | |
var2, | |||
var3, | |||
var4, | |||
var5 | |||
) |
std::cout << FormDebugHead() << #var1 " = " << var1 << ", " \ #var2 " = " << var2 << ", " #var3 " = " << var3 << ", " \ #var4 " = " << var4 << ", " #var5 " = " << var5 <<std::endl << std::flush;
Print the name and value of the given variables.
var1 | |
var2 | |
var3 | |
var4 | |
var5 |
#define PRINT_VARIABLE | ( | var | ) | std::cout << FormDebugHead() << #var " = " << var << std::endl << std::flush; |
#define PRINT_VECTOR | ( | v | ) |
#define QUIT_AFTER_N_VISITS | ( | n | ) | { static unsigned counter=0; if (++counter==(n)) {TRACE("User-forced quit."); assert(0);} } |
#define TRACE | ( | stuff | ) | std::cout << FormDebugHead() << stuff << std::endl << std::flush; |
#define TRACE_FROM_NTH_VISIT | ( | stuff, | |
n | |||
) |
std::string FormDebugHead | ( | ) |
Print a 'header' for a debug output line
Definition at line 38 of file Debug.cpp.
References PetscTools::GetMyRank(), and PetscTools::IsSequential().