MOAB: Mesh Oriented datABase  (version 5.2.1)
moab_mpe.h
Go to the documentation of this file.
00001 #ifndef MOAB_MPE_H
00002 #define MOAB_MPE_H
00003 
00004 #include "moab/MOABConfig.h"
00005 #ifdef MOAB_HAVE_LIBMPE
00006 # include "moab_mpi.h"
00007 # include "mpe.h"
00008 #else
00009 
00010 /* Define dummy logging functions */
00011 
00012 /* mpe_misc.h */
00013 
00014 #define MPE_Seq_begin( A, B ) {if (A || B) {}}
00015   
00016 #define MPE_Seq_end( A, B ) {if (A || B) {}}
00017 
00018 #define MPE_DelTag( A, B, C, D ) ( {if (A || B || C || D) {}}, MPI_SUCCESS)
00019 #define MPE_GetTags( A, B, C, D ) (A = *C, *D = 0, if (B) {}, MPI_SUCCESS)
00020 #define MPE_ReturnTags( A, B, C ) ( {if (A || B || C) {}}, 0)
00021 #define MPE_TagsEnd() (MPI_SUCCESS)
00022 
00023 #define MPE_IO_Stdout_to_file( A, B ) {if (A || B) {}}
00024 
00025 #define MPE_GetHostName( A, B ) {if (A || B) {}}
00026 
00027 #define MPI_Start_debugger()
00028 
00029 /*
00030 #if (defined(__STDC__) || defined(__cplusplus))
00031 #define  MPE_Errors_to_dbx ( MPI_Comm *, int *, ... );
00032 #else
00033 void MPE_Errors_to_dbx ( MPI_Comm *, int *, char *, char *, int * );
00034 #endif
00035 void MPE_Errors_call_debugger ( char *, char *, char ** );
00036 void MPE_Errors_call_xdbx     ( char *, char * );
00037 void MPE_Errors_call_dbx_in_xterm ( char *, char * );
00038 void MPE_Signals_call_debugger ( void );
00039 
00040 int  MPE_Decomp1d ( int, int, int, int *, int * );
00041 
00042 void MPE_Comm_global_rank ( MPI_Comm, int, int * );
00043 */
00044 
00045 /* mpe_log.h */
00046 
00047 #define MPE_LOG_OK                0
00048 #define MPE_Log_OK                MPE_LOG_OK
00049   /* no problems */
00050 #define MPE_LOG_LOCKED_OUT        1
00051 #define MPE_Log_LOCKED_OUT        MPE_LOG_LOCKED_OUT
00052   /* logs are being worked on, cannot insert any new entries */
00053 #define MPE_LOG_NO_MEMORY         2
00054 #define MPE_Log_NO_MEMORY         MPE_LOG_NO_MEMORY
00055   /* could not allocate memory for logging data */
00056 #define MPE_LOG_FILE_PROB         3
00057 #define MPE_Log_FILE_PROB         MPE_LOG_FILE_PROB
00058   /* cound not open file for writing out the logged info */
00059 #define MPE_LOG_NOT_INITIALIZED   4
00060 #define MPE_Log_NOT_INITIALIZED   MPE_LOG_NOT_INITIALIZED
00061   /* logging not initialized */
00062 #define MPE_LOG_PACK_FAIL         5
00063 #define MPE_Log_PACK_FAIL         MPE_LOG_PACK_FAIL
00064 
00065 #define MPE_Init_log() (MPI_SUCCESS)
00066 #define MPE_Initialized_logging() 1
00067 
00068 #define MPE_Describe_state( A, B, C, D ) {if (A || B || C || D) {}}
00069 #define MPE_Describe_event( A, B, C ) {if (A || B || C) {}}
00070 #define MPE_Log_get_event_number()
00071 #define MPE_Log_send( A, B, C ) {if (A || B || C) {}}
00072 #define MPE_Log_receive( A, B, C ) {if (A || B || C) {}}
00073 #define MPE_Log_event( A, B, C ) {if (A || B || C) {}}
00074 #define MPE_Start_log()
00075 #define MPE_Stop_log()
00076 #define MPE_Finish_log( A ) {if (A) {}}
00077 
00078 #endif
00079 
00080 #ifdef __cplusplus
00081 
00082 namespace moab {
00083 
00084 class MPEState {
00085 private:
00086   int sid,eid;
00087   bool ok;
00088 public:
00089   MPEState( const char* name, const char* color = 0 )
00090     : sid(MPE_Log_get_event_number()),
00091       eid(MPE_Log_get_event_number()),
00092       ok(true)
00093   {
00094     MPE_Describe_state( sid, eid, name, color ? color : "yellow" );
00095   }
00096   
00097   MPEState( ) : ok(false) {}
00098   bool valid() const { return ok; }
00099   
00100   void start( int data = 0, const char* str = 0 ) {
00101     MPE_Log_event( sid, data, str );
00102   }
00103   void start( const char* str, int data = 0 ) {
00104     MPE_Log_event( sid, data, str ); 
00105   }
00106   void start( const char* str, const char* str2 ) {
00107     MPE_Log_event( sid, 0, (std::string(str).append(str2)).c_str() ); 
00108   }
00109   void end( int data = 0, const char* str = 0 ) {
00110     MPE_Log_event( eid, data, str );
00111   }
00112   void end( const char* str, int data = 0 ) {
00113     MPE_Log_event( eid, data, str ); 
00114   }
00115 };
00116 
00117 class MPEEvent {
00118 private:
00119   int id;
00120 public:
00121   MPEEvent( const char* name, const char* color = 0 )
00122     : id(MPE_Log_get_event_number())
00123   {
00124     MPE_Describe_event( id, name, color ? color : "red" );
00125   }
00126   void log( int data = 0, const char* str = 0 ) {
00127     MPE_Log_event( id, data, str );
00128   }
00129   void log( const char* str, int data = 0 ) {
00130     MPE_Log_event( id, data, str ); 
00131   }
00132 };
00133 
00134 } /* namespace moab */
00135 
00136 #endif /* __cplusplus */
00137 
00138 #endif /* MOAB_MPE_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines