47 #define FMAX(a,b) ((FABS(a)) > (FABS(b)) ? (FABS(a)) : (FABS(b)))
51 #define MAX(a,b) ((a) > (b) ? (a) : (b))
55 #define MIN(a,b) ((a)<(b)?(a):(b))
59 #define ABS(x) (((x)<0)?(-(x)):(x))
63 #define FABS(a) ((a) < 0 ? -(a) : a)
67 #define _MATLAB_ZERO_ 1e-100
77 #define ASSERT_DH(ptr) \
80 sprintf(msgBuf_dh, "%s is NULL", ptr); \
81 SET_V_ERROR(msgBuf_dh); \
87 #define CHECK_MPI_V_ERROR(errCode) \
91 MPI_Error_string(errCode, msgBuf_dh, &len); \
92 setError_dh(msgBuf_dh, __FUNC__, __FILE__, __LINE__); \
97 #define CHECK_MPI_ERROR(errCode) \
101 MPI_Error_string(errCode, msgBuf_dh, &len); \
102 setError_dh(msgBuf_dh, __FUNC__, __FILE__, __LINE__); \
108 #define CHECK_MPI_V_ERROR(errCode) \
111 setError_dh("MPI error!", __FUNC__, __FILE__, __LINE__); \
112 printErrorMsg(stderr); \
113 MPI_Abort(comm_dh, -1); \
117 #define CHECK_MPI_ERROR(errCode) \
120 setError_dh("MPI error!", __FUNC__, __FILE__, __LINE__); \
121 printErrorMsg(stderr); \
122 MPI_Abort(comm_dh, -1); \
126 #define SET_V_ERROR(msg) \
127 { setError_dh(msg, __FUNC__, __FILE__, __LINE__); \
128 printErrorMsg(stderr); \
129 MPI_Abort(comm_dh, -1); \
132 #define SET_ERROR(retval, msg) \
133 { setError_dh(msg, __FUNC__, __FILE__, __LINE__); \
134 printErrorMsg(stderr); \
135 MPI_Abort(comm_dh, -1); \
138 #define CHECK_V_ERROR \
140 setError_dh("", __FUNC__, __FILE__, __LINE__); \
141 printErrorMsg(stderr); \
142 MPI_Abort(comm_dh, -1); \
145 #define CHECK_ERROR(retval) \
147 setError_dh("", __FUNC__, __FILE__, __LINE__); \
148 printErrorMsg(stderr); \
149 MPI_Abort(comm_dh, -1); \
156 #define SET_INFO(msg) setInfo_dh(msg, __FUNC__, __FILE__, __LINE__);
163 #define START_FUNC_DH \
164 dh_StartFunc(__FUNC__, __FILE__, __LINE__, 1); \
167 #define END_FUNC_DH \
169 dh_EndFunc(__FUNC__, 1);
171 #define END_FUNC_VAL(a) \
172 dh_EndFunc(__FUNC__, 1); \
176 #define START_FUNC_DH_2
177 #define END_FUNC_DH_2
178 #define END_FUNC_VAL_2(a) return a ;
181 #define START_FUNC_DH \
182 dh_StartFunc(__FUNC__, __FILE__, __LINE__, 1); \
183 if (logFuncsToStderr || logFuncsToFile)\
184 Error_dhStartFunc(__FUNC__, __FILE__, __LINE__); \
187 #define END_FUNC_DH \
188 dh_EndFunc(__FUNC__, 1); \
189 if (logFuncsToStderr || logFuncsToFile) \
190 Error_dhEndFunc(__FUNC__); \
194 #define START_FUNC_DH_2 \
195 dh_StartFunc(__FUNC__, __FILE__, __LINE__, 2); \
196 if (logFuncsToStderr || logFuncsToFile)\
197 Error_dhStartFunc(__FUNC__, __FILE__, __LINE__); \
200 #define END_FUNC_DH_2 \
201 dh_EndFunc(__FUNC__, 2); \
202 if (logFuncsToStderr || logFuncsToFile) \
203 Error_dhEndFunc(__FUNC__); \
208 #define END_FUNC_VAL(retval) \
209 dh_EndFunc(__FUNC__, 1); \
210 if (logFuncsToStderr || logFuncsToFile) \
211 Error_dhEndFunc(__FUNC__); \
215 #define END_FUNC_VAL_2(retval) \
216 dh_EndFunc(__FUNC__, 2); \
217 if (logFuncsToStderr || logFuncsToFile) \
218 Error_dhEndFunc(__FUNC__); \