| 1 | gezelter | 2 | #ifndef __FORTRAN90 | 
| 2 |  |  | #ifndef __SIMERROR_H__ | 
| 3 |  |  | #define __SIMERROR_H__ | 
| 4 |  |  |  | 
| 5 |  |  | #define MAX_SIM_ERROR_MSG_LENGTH 2000 | 
| 6 |  |  |  | 
| 7 |  |  | #define OOPSE_ERROR   1 | 
| 8 |  |  | #define OOPSE_WARNING 2 | 
| 9 |  |  | #define OOPSE_INFO    3 | 
| 10 |  |  |  | 
| 11 |  |  | typedef struct{ | 
| 12 |  |  | char errMsg[MAX_SIM_ERROR_MSG_LENGTH]; | 
| 13 |  |  | int isFatal; | 
| 14 |  |  | int severity; | 
| 15 |  |  | #ifdef IS_MPI | 
| 16 |  |  | int isEventLoop; | 
| 17 |  |  | #endif // IS_MPI | 
| 18 |  |  | } errorStruct; | 
| 19 |  |  |  | 
| 20 |  |  | extern errorStruct painCave; | 
| 21 |  |  |  | 
| 22 |  |  | #ifdef IS_MPI | 
| 23 |  |  |  | 
| 24 |  |  | extern char checkPointMsg[MAX_SIM_ERROR_MSG_LENGTH]; | 
| 25 |  |  |  | 
| 26 |  |  | extern int worldRank; | 
| 27 |  |  | #endif | 
| 28 |  |  |  | 
| 29 |  |  | #ifdef __cplusplus | 
| 30 |  |  | extern "C" { | 
| 31 |  |  | #endif // __cplusplus | 
| 32 |  |  |  | 
| 33 |  |  | int simError( void ); // returns 1 if handled. 0 otherwise. | 
| 34 |  |  |  | 
| 35 |  |  | void initSimError( void ); // needed to be called from main before anything | 
| 36 |  |  | // goes wrong. | 
| 37 |  |  |  | 
| 38 |  |  | #ifdef IS_MPI | 
| 39 |  |  |  | 
| 40 |  |  | void MPIcheckPoint( void ); | 
| 41 |  |  |  | 
| 42 |  |  | #endif // IS_MPI | 
| 43 |  |  |  | 
| 44 |  |  | #ifdef __cplusplus | 
| 45 |  |  | } | 
| 46 |  |  | #endif //__cplusplus | 
| 47 |  |  |  | 
| 48 |  |  | #endif // __SIMERROR_H__ | 
| 49 |  |  |  | 
| 50 |  |  | #else // __FORTRAN90 | 
| 51 |  |  |  | 
| 52 |  |  | INTEGER, PARAMETER:: OOPSE_ERROR   = 1 | 
| 53 |  |  | INTEGER, PARAMETER:: OOPSE_WARNING = 2 | 
| 54 |  |  | INTEGER, PARAMETER:: OOPSE_INFO    = 3 | 
| 55 |  |  | INTEGER, PARAMETER:: MAX_SIM_ERROR_MSG_LENGTH = 2000 | 
| 56 |  |  |  | 
| 57 |  |  | type, public :: errorStruct | 
| 58 |  |  | PRIVATE | 
| 59 |  |  | SEQUENCE | 
| 60 |  |  | character(len = MAX_SIM_ERROR_MSG_LENGTH) :: errMsg | 
| 61 |  |  | logical :: isFatal | 
| 62 |  |  | integer :: severity | 
| 63 |  |  | #ifdef IS_MPI | 
| 64 |  |  | logical :: isEventLoop; | 
| 65 |  |  | #endif // IS_MPI | 
| 66 |  |  | end type errorStruct | 
| 67 |  |  |  | 
| 68 |  |  | type (errorStruct), public, save :: painCave | 
| 69 |  |  |  | 
| 70 |  |  | #endif // __FORTRAN90 |