escript
Revision_
|
00001 00002 /***************************************************************************** 00003 * 00004 * Copyright (c) 2010-2014 by University of Queensland 00005 * http://www.uq.edu.au 00006 * 00007 * Primary Business: Queensland, Australia 00008 * Licensed under the Open Software License version 3.0 00009 * http://www.opensource.org/licenses/osl-3.0.php 00010 * 00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 00012 * Development 2012-2013 by School of Earth Sciences 00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp) 00014 * 00015 *****************************************************************************/ 00016 00017 00018 /************************************************************************************/ 00019 00020 /* Functions for C error handling (and timing)*/ 00021 00022 /************************************************************************************/ 00023 00024 00025 #ifndef INC_ESYS_ERROR 00026 #define INC_ESYS_ERROR 00027 00028 #include "system_dep.h" 00029 #include "types.h" 00030 00031 #ifdef _OPENMP 00032 #include <omp.h> 00033 #endif 00034 00035 #include <stdio.h> /* For FILENAME_MAX */ 00036 #define LenString_MAX FILENAME_MAX*2 00037 #define LenErrorMsg_MAX LenString_MAX 00038 00039 /************************************************************************************/ 00040 00041 typedef enum { 00042 NO_ERROR, 00043 WARNING, 00044 DIVERGED, 00045 VALUE_ERROR, 00046 TYPE_ERROR, 00047 MEMORY_ERROR, 00048 IO_ERROR, 00049 ZERO_DIVISION_ERROR, 00050 EOF_ERROR, 00051 FLOATING_POINT_ERROR, 00052 INDEX_ERROR, 00053 OS_ERROR, 00054 OVERFLOW_ERROR, 00055 SYSTEM_ERROR, 00056 ESYS_MPI_ERROR, 00057 NO_PROGRESS_ERROR 00058 } Esys_ErrorCodeType; 00059 00060 /* interfaces */ 00061 00062 00063 ESYSUTILS_DLL_API 00064 double Esys_timer(void); 00065 00066 ESYSUTILS_DLL_API 00067 bool Esys_checkPtr(void*); 00068 00069 ESYSUTILS_DLL_API 00070 void Esys_resetError(void); 00071 00072 ESYSUTILS_DLL_API 00073 void Esys_setError(Esys_ErrorCodeType err,__const char* msg); 00074 00075 ESYSUTILS_DLL_API 00076 bool Esys_noError(void); 00077 00078 ESYSUTILS_DLL_API 00079 Esys_ErrorCodeType Esys_getErrorType(void); 00080 00081 ESYSUTILS_DLL_API 00082 char* Esys_getErrorMessage(void); 00083 00084 #ifndef _OPENMP 00085 int serial_get_max_threads(void); 00086 int serial_get_thread_num(void); 00087 00088 /* Nasty hack to get 3.2 out */ 00089 #define omp_get_max_threads serial_get_max_threads 00090 #define omp_get_thread_num serial_get_thread_num 00091 #endif 00092 00093 00094 #endif /* #ifndef INC_ESYS_ERROR */