COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
Namespaces | Macros | Functions
debug.hpp File Reference
#include <iostream>
#include <boost/thread/thread.hpp>
#include "common/BasicExceptions.hpp"

Go to the source code of this file.

Namespaces

 cf3
 Top-level namespace for coolfluid.
 
 cf3::common
 Most basic kernel library.
 
 cf3::common::PE
 Classes offering a MPI interface for COOLFluiD.
 

Macros

#define PERank   "["<<::cf3::common::PE::Comm::instance().rank() << "] "
 
#define PEProcessSortedExecute(irank, expression)
 
#define PECheckPoint(msec, msg)
 
#define PECheckArrivePoint(msec, msg)
 
#define PEDebugVector(v, length)
 
#define PEDebugVectorMember(v, length, member)
 

Functions

void wait_for_debugger (const int rank)
 

Detailed Description

Author
Tamas Banyai

This header defines additional debug support functions/macros/classes.

Definition in file debug.hpp.

Macro Definition Documentation

#define PECheckArrivePoint (   msec,
  msg 
)
Value:
{ \
std::cout << std::flush; \
std::cout << "["<<::cf3::common::PE::Comm::instance().rank() << "] " << msg << "\n"; \
std::cout << std::flush; \
boost::this_thread::sleep(boost::posix_time::milliseconds(msec)); \
}
Uint rank() const
Return rank, additionally, if is_init==0.
Definition: Comm.cpp:135
void barrier()
overload the barrier function
Definition: Comm.cpp:118
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44

Definition at line 93 of file debug.hpp.

#define PECheckPoint (   msec,
  msg 
)
Value:
{ \
std::cout << std::flush; \
boost::this_thread::sleep(boost::posix_time::milliseconds(msec)); \
std::cout << std::flush; \
std::cout << "["<<::cf3::common::PE::Comm::instance().rank() << ":" << __FILE__ << ":" << __LINE__ << "] " << msg << "\n"; \
std::cout << std::flush; \
); \
std::cout << std::flush; \
boost::this_thread::sleep(boost::posix_time::milliseconds(msec)); \
}
Uint rank() const
Return rank, additionally, if is_init==0.
Definition: Comm.cpp:135
void barrier()
overload the barrier function
Definition: Comm.cpp:118
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44
#define PEProcessSortedExecute(irank, expression)
Definition: debug.hpp:43

Macro for a checkpoint, all possible effort is made to have a non-aliased, rank ordered message output.

Parameters
msecmilliseconds to wait, called before and after so overall delay is 2*msec
msgmessage to print on stdout

Definition at line 75 of file debug.hpp.

#define PEDebugVector (   v,
  length 
)
Value:
{ \
std::cout << ::cf3::common::PE::Comm::instance().rank() << "/" << ::cf3::common::PE::Comm::instance().size() << ": " << #v << " " << length << " ( " << std::flush; \
for(int _tmp_i_=0; _tmp_i_<length; _tmp_i_++) std::cout << v[_tmp_i_] << " "; \
std::cout << " )\n" << std::flush; \
}
Uint rank() const
Return rank, additionally, if is_init==0.
Definition: Comm.cpp:135
Uint size() const
Return the number of processes, or 1 if is_init==0.
Definition: Comm.cpp:145
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44

Macro for printing a vector

Definition at line 107 of file debug.hpp.

#define PEDebugVectorMember (   v,
  length,
  member 
)
Value:
{ \
std::cout << ::cf3::common::PE::Comm::instance().rank() << "/" << ::cf3::common::PE::Comm::instance().size() << ": " << #v#member << " " << length << " ( " << std::flush; \
for(int _tmp_i_=0; _tmp_i_<length; _tmp_i_++) std::cout << v[_tmp_i_]member << " "; \
std::cout << " )\n" << std::flush; \
}
Uint rank() const
Return rank, additionally, if is_init==0.
Definition: Comm.cpp:135
Uint size() const
Return the number of processes, or 1 if is_init==0.
Definition: Comm.cpp:145
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44

Macro for printing a member of a struct/class inside a vector. You have to put . or -> for the member, or can even call a function like ->size().

Definition at line 119 of file debug.hpp.

#define PEProcessSortedExecute (   irank,
  expression 
)
Value:
{ \
if (irank<0){ \
int _process_sorted_execute_i_; \
int _process_sorted_execute_n_=(int)(::cf3::common::PE::Comm::instance().size()); \
int _process_sorted_execute_r_=(int)(::cf3::common::PE::Comm::instance().rank()); \
std::cout << std::flush; \
for(_process_sorted_execute_i_=0; _process_sorted_execute_i_<_process_sorted_execute_n_; _process_sorted_execute_i_++){ \
if(_process_sorted_execute_i_ == _process_sorted_execute_r_){ \
expression; \
std::cout << std::flush; \
} \
} \
std::cout << std::flush; \
} else if (irank==(int)(::cf3::common::PE::Comm::instance().rank())){ \
expression; \
} \
}
Uint rank() const
Return rank, additionally, if is_init==0.
Definition: Comm.cpp:135
void barrier()
overload the barrier function
Definition: Comm.cpp:118
Uint size() const
Return the number of processes, or 1 if is_init==0.
Definition: Comm.cpp:145
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44

Macro for executing something ensured that the execution order is 0..nproc-1.

Parameters
irankrank of the process where the command is executed (-1 for all processes)
expressionstuff to execute

Definition at line 43 of file debug.hpp.

#define PERank   "["<<::cf3::common::PE::Comm::instance().rank() << "] "

Definition at line 36 of file debug.hpp.

Send comments to:
COOLFluiD Web Admin