source: issm/oecreview/Archive/14312-15392/ISSM-14913-14914.diff@ 15393

Last change on this file since 15393 was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 15.4 KB
RevLine 
[15393]1Index: ../trunk-jpl/src/c/include/macros.h
2===================================================================
3--- ../trunk-jpl/src/c/include/macros.h (revision 14913)
4+++ ../trunk-jpl/src/c/include/macros.h (revision 14914)
5@@ -1,70 +0,0 @@
6-/* \file macros.h
7- * \brief: global macros used in the whole code
8- */
9-
10-/*Header {{{*/
11-#ifndef _MACROS_H_
12-#define _MACROS_H_
13-
14-#include <iostream>
15-#include <sstream>
16-#include <iomanip>
17-#include "./typedefs.h"
18-
19-#ifdef HAVE_CONFIG_H
20- #include <config.h>
21-#else
22-#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
23-#endif
24-/*}}}*/
25-
26-/*Exceptions: */
27-/* _assert_ {{{*/
28-/*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/
29-#ifdef _ISSM_DEBUG_
30-#define _assert_(statement)\
31- if (!(statement)) _error_("Assertion \""<<#statement<<"\" failed, please report bug to "<<PACKAGE_BUGREPORT)
32-#else
33-#define _assert_(ignore)\
34- ((void) 0)
35-#endif
36-/*}}}*/
37-/* _error_ {{{*/
38-/*new Error exception macro*/
39-#ifdef _INTEL_WIN_
40-#define _error_(StreamArgs)\
41- do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
42- aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
43- throw ErrorException(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
44-#else
45-#define _error_(StreamArgs)\
46- do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
47- aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
48- throw ErrorException(__FILE__,__func__,__LINE__,aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
49-#endif
50-/*}}}*/
51-/* ExceptionTrapBegin/ExceptionTrapEnd {{{*/
52-
53-/*The following macros hide the error exception handling in a matlab module. Just put
54- * ExceptionTrapBegin(); and ExceptionTrapEnd(); at the beginning and end of a module, and c++ exceptions
55- * will be trapped. Really nifty!*/
56-
57-#define ExceptionTrapBegin(); \
58- try{
59-
60-#define ExceptionTrapEnd(); }\
61- catch(ErrorException &exception){\
62- exception.Report();\
63- return 0;\
64- }\
65- catch (exception& e) {\
66- _printf_(true,"Standard exception: %s\n",e.what());\
67- return 0;\
68- }\
69- catch(...){\
70- _printf_(true,"An unexpected error occurred");\
71- return 0;\
72- }
73-/*}}}*/
74-
75-#endif
76Index: ../trunk-jpl/src/c/include/include.h
77===================================================================
78--- ../trunk-jpl/src/c/include/include.h (revision 14913)
79+++ ../trunk-jpl/src/c/include/include.h (revision 14914)
80@@ -5,7 +5,6 @@
81 #ifndef _INCLUDEGLOBAL_H_
82 #define _INCLUDEGLOBAL_H_
83
84-#include "./macros.h"
85 #include "./typedefs.h"
86 #include "./types.h"
87
88Index: ../trunk-jpl/src/c/shared/Exceptions/exceptions.h
89===================================================================
90--- ../trunk-jpl/src/c/shared/Exceptions/exceptions.h (revision 14913)
91+++ ../trunk-jpl/src/c/shared/Exceptions/exceptions.h (revision 14914)
92@@ -6,16 +6,75 @@
93 * own exceptions
94 */
95
96-#ifndef MY_EXCEPTIONS_H_
97-#define MY_EXCEPTIONS_H_
98+#ifndef _MY_EXCEPTIONS_H_
99+#define _MY_EXCEPTIONS_H_
100
101 #include <exception>
102 #include <string>
103+#include <iostream>
104+#include <sstream>
105+#include <iomanip>
106+
107 using namespace std;
108
109-/*We derive our classes from the c++ exception class: */
110-class ErrorException: public exception {
111+#ifdef HAVE_CONFIG_H
112+ #include <config.h>
113+#else
114+#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
115+#endif
116
117+/*macros: */
118+/* _assert_ {{{*/
119+/*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/
120+#ifdef _ISSM_DEBUG_
121+#define _assert_(statement)\
122+ if (!(statement)) _error_("Assertion \""<<#statement<<"\" failed, please report bug to "<<PACKAGE_BUGREPORT)
123+#else
124+#define _assert_(ignore)\
125+ ((void) 0)
126+#endif
127+/*}}}*/
128+/* _error_ {{{*/
129+/*new Error exception macro*/
130+#ifdef _INTEL_WIN_
131+#define _error_(StreamArgs)\
132+ do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
133+ aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
134+ throw ErrorException(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
135+#else
136+#define _error_(StreamArgs)\
137+ do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
138+ aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
139+ throw ErrorException(__FILE__,__func__,__LINE__,aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
140+#endif
141+/*}}}*/
142+/* ExceptionTrapBegin/ExceptionTrapEnd {{{*/
143+
144+/*The following macros hide the error exception handling in a matlab module. Just put
145+ * ExceptionTrapBegin(); and ExceptionTrapEnd(); at the beginning and end of a module, and c++ exceptions
146+ * will be trapped. Really nifty!*/
147+
148+#define ExceptionTrapBegin(); \
149+ try{
150+
151+#define ExceptionTrapEnd(); }\
152+ catch(ErrorException &exception){\
153+ exception.Report();\
154+ return 0;\
155+ }\
156+ catch (exception& e) {\
157+ _printf_(true,"Standard exception: %s\n",e.what());\
158+ return 0;\
159+ }\
160+ catch(...){\
161+ _printf_(true,"An unexpected error occurred");\
162+ return 0;\
163+ }
164+/*}}}*/
165+
166+/*ISSM exception class: */
167+class ErrorException: public exception { /*{{{*/
168+
169 string what_str;
170 string function_name;
171 string file_name;
172@@ -31,6 +90,10 @@
173 const char* PythonReport() const;
174
175 };
176+/*}}}*/
177
178 char* exprintf(const char* format,...);
179+
180 #endif
181+
182+
183Index: ../trunk-jpl/src/c/shared/Numerics/Synchronize.sh
184===================================================================
185--- ../trunk-jpl/src/c/shared/Numerics/Synchronize.sh (revision 14913)
186+++ ../trunk-jpl/src/c/shared/Numerics/Synchronize.sh (revision 14914)
187@@ -26,7 +26,6 @@
188 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
189 #endif
190 #include "./Verbosity.h"
191-#include "../../include/macros.h"
192 #include "../Exceptions/exceptions.h"
193 /*}}}*/
194
195Index: ../trunk-jpl/src/c/shared/Numerics/Verbosity.cpp
196===================================================================
197--- ../trunk-jpl/src/c/shared/Numerics/Verbosity.cpp (revision 14913)
198+++ ../trunk-jpl/src/c/shared/Numerics/Verbosity.cpp (revision 14914)
199@@ -15,7 +15,6 @@
200 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
201 #endif
202 #include "./Verbosity.h"
203-#include "../../include/macros.h"
204 #include "../Exceptions/exceptions.h"
205 /*}}}*/
206
207Index: ../trunk-jpl/src/c/shared/Sorting/binary_search.cpp
208===================================================================
209--- ../trunk-jpl/src/c/shared/Sorting/binary_search.cpp (revision 14913)
210+++ ../trunk-jpl/src/c/shared/Sorting/binary_search.cpp (revision 14914)
211@@ -8,7 +8,6 @@
212 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
213 #endif
214
215-#include "../../include/macros.h"
216 #include "../Exceptions/exceptions.h"
217 #include <stdio.h>
218
219Index: ../trunk-jpl/src/c/shared/Elements/PrintArrays.cpp
220===================================================================
221--- ../trunk-jpl/src/c/shared/Elements/PrintArrays.cpp (revision 14913)
222+++ ../trunk-jpl/src/c/shared/Elements/PrintArrays.cpp (revision 14914)
223@@ -1,6 +1,5 @@
224
225 #include "./elements.h"
226-#include "../../include/macros.h"
227 using namespace std;
228
229 void printarray(IssmPDouble* array,int lines,int cols){
230Index: ../trunk-jpl/src/c/io/Comm/IssmComm.cpp
231===================================================================
232--- ../trunk-jpl/src/c/io/Comm/IssmComm.cpp (revision 14913)
233+++ ../trunk-jpl/src/c/io/Comm/IssmComm.cpp (revision 14914)
234@@ -10,7 +10,6 @@
235
236 #include "./IssmComm.h"
237 #include "../../include/types.h"
238-#include "../../include/macros.h"
239 #include "../../shared/Exceptions/exceptions.h"
240
241 void IssmComm::SetComm(COMM incomm){ /*{{{*/
242Index: ../trunk-jpl/src/c/toolkits/mumps/MpiDenseMumpsSolve.cpp
243===================================================================
244--- ../trunk-jpl/src/c/toolkits/mumps/MpiDenseMumpsSolve.cpp (revision 14913)
245+++ ../trunk-jpl/src/c/toolkits/mumps/MpiDenseMumpsSolve.cpp (revision 14914)
246@@ -10,7 +10,6 @@
247 #endif
248
249 #include "../../include/types.h"
250-#include "../../include/macros.h"
251 #include "../../shared/MemOps/MemOps.h"
252 #include "../../shared/Exceptions/exceptions.h"
253 #include "../../io/Comm/Comm.h"
254Index: ../trunk-jpl/src/c/toolkits/issm/IssmVec.h
255===================================================================
256--- ../trunk-jpl/src/c/toolkits/issm/IssmVec.h (revision 14913)
257+++ ../trunk-jpl/src/c/toolkits/issm/IssmVec.h (revision 14914)
258@@ -16,7 +16,6 @@
259 #include "../../EnumDefinitions/EnumDefinitions.h"
260 #include "../../shared/Exceptions/exceptions.h"
261 #include "../../shared/MemOps/MemOps.h"
262-#include "../../include/macros.h"
263 #include "./IssmToolkitUtils.h"
264 #include <math.h>
265 /*}}}*/
266Index: ../trunk-jpl/src/c/toolkits/issm/IssmDenseMat.h
267===================================================================
268--- ../trunk-jpl/src/c/toolkits/issm/IssmDenseMat.h (revision 14913)
269+++ ../trunk-jpl/src/c/toolkits/issm/IssmDenseMat.h (revision 14914)
270@@ -20,7 +20,6 @@
271 #include "../../shared/Exceptions/exceptions.h"
272 #include "../../shared/MemOps/MemOps.h"
273 #include "../../io/Print/Print.h"
274-#include "../../include/macros.h"
275 #include "../../toolkits/gsl/gslincludes.h"
276
277 #include <math.h>
278Index: ../trunk-jpl/src/c/toolkits/issm/IssmMat.h
279===================================================================
280--- ../trunk-jpl/src/c/toolkits/issm/IssmMat.h (revision 14913)
281+++ ../trunk-jpl/src/c/toolkits/issm/IssmMat.h (revision 14914)
282@@ -15,7 +15,6 @@
283
284 #include "../../shared/Exceptions/exceptions.h"
285 #include "../../shared/MemOps/MemOps.h"
286-#include "../../include/macros.h"
287 #include "../../classes/ToolkitOptions.h"
288 #include "../../io/Comm/Comm.h"
289 #include "../../EnumDefinitions/EnumDefinitions.h"
290Index: ../trunk-jpl/src/c/toolkits/issm/IssmToolkitUtils.cpp
291===================================================================
292--- ../trunk-jpl/src/c/toolkits/issm/IssmToolkitUtils.cpp (revision 14913)
293+++ ../trunk-jpl/src/c/toolkits/issm/IssmToolkitUtils.cpp (revision 14914)
294@@ -12,7 +12,6 @@
295
296 #include "../../shared/MemOps/MemOps.h"
297 #include "../../io/Comm/Comm.h"
298-#include "../../include/macros.h"
299 #include "../../classes/ToolkitOptions.h"
300 #include "../../EnumDefinitions/EnumDefinitions.h"
301 #include "../../shared/Exceptions/exceptions.h"
302Index: ../trunk-jpl/src/c/toolkits/issm/IssmAbsVec.h
303===================================================================
304--- ../trunk-jpl/src/c/toolkits/issm/IssmAbsVec.h (revision 14913)
305+++ ../trunk-jpl/src/c/toolkits/issm/IssmAbsVec.h (revision 14914)
306@@ -20,7 +20,6 @@
307
308 #include "../../shared/Exceptions/exceptions.h"
309 #include "../../shared/MemOps/MemOps.h"
310-#include "../../include/macros.h"
311 #include <math.h>
312
313 /*}}}*/
314Index: ../trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h
315===================================================================
316--- ../trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h (revision 14913)
317+++ ../trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h (revision 14914)
318@@ -19,7 +19,6 @@
319
320 #include "../../shared/Exceptions/exceptions.h"
321 #include "../../shared/MemOps/MemOps.h"
322-#include "../../include/macros.h"
323 #include "../../io/io.h"
324 #ifdef _HAVE_MPI_
325 #include "../mpi/mpiincludes.h"
326Index: ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h
327===================================================================
328--- ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h (revision 14913)
329+++ ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h (revision 14914)
330@@ -19,7 +19,6 @@
331
332 #include "../../shared/Exceptions/exceptions.h"
333 #include "../../shared/MemOps/MemOps.h"
334-#include "../../include/macros.h"
335 #include "../../Container/DataSet.h"
336 #include "../../io/Comm/Comm.h"
337 #include "../../classes/objects/Bucket.h"
338Index: ../trunk-jpl/src/c/toolkits/issm/IssmSeqVec.h
339===================================================================
340--- ../trunk-jpl/src/c/toolkits/issm/IssmSeqVec.h (revision 14913)
341+++ ../trunk-jpl/src/c/toolkits/issm/IssmSeqVec.h (revision 14914)
342@@ -19,7 +19,6 @@
343 #include "../../shared/Exceptions/exceptions.h"
344 #include "../../io/Print/Print.h"
345 #include "../../shared/MemOps/MemOps.h"
346-#include "../../include/macros.h"
347 #include <math.h>
348
349 /*}}}*/
350Index: ../trunk-jpl/src/c/toolkits/issm/IssmAbsMat.h
351===================================================================
352--- ../trunk-jpl/src/c/toolkits/issm/IssmAbsMat.h (revision 14913)
353+++ ../trunk-jpl/src/c/toolkits/issm/IssmAbsMat.h (revision 14914)
354@@ -20,7 +20,6 @@
355
356 #include "../../shared/Exceptions/exceptions.h"
357 #include "../../shared/MemOps/MemOps.h"
358-#include "../../include/macros.h"
359 #include "./IssmAbsVec.h"
360
361 /*}}}*/
362Index: ../trunk-jpl/src/c/Makefile.am
363===================================================================
364--- ../trunk-jpl/src/c/Makefile.am (revision 14913)
365+++ ../trunk-jpl/src/c/Makefile.am (revision 14914)
366@@ -20,7 +20,6 @@
367 #Core sources{{{
368 core_sources = ./issm.h\
369 ./issm-binding.h\
370- ./include/macros.h\
371 ./include/typedefs.h\
372 ./include/types.h\
373 ./include/include.h\
374Index: ../trunk-jpl/src/c/classes/DofIndexing.cpp
375===================================================================
376--- ../trunk-jpl/src/c/classes/DofIndexing.cpp (revision 14913)
377+++ ../trunk-jpl/src/c/classes/DofIndexing.cpp (revision 14914)
378@@ -14,7 +14,6 @@
379 #include "../include/types.h"
380 #include "../include/typedefs.h"
381 #include "../io/Print/Print.h"
382-#include "../include/macros.h"
383 #include "../shared/Exceptions/exceptions.h"
384 #include "../shared/MemOps/MemOps.h"
385 #include "../EnumDefinitions/EnumDefinitions.h"
386Index: ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp
387===================================================================
388--- ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp (revision 14913)
389+++ ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp (revision 14914)
390@@ -3,7 +3,6 @@
391 */
392
393 #include "./GaussTria.h"
394-#include "../../include/macros.h"
395 #include "../../io/Print/Print.h"
396 #include "../../shared/Exceptions/exceptions.h"
397 #include "../../shared/MemOps/MemOps.h"
398Index: ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp
399===================================================================
400--- ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp (revision 14913)
401+++ ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp (revision 14914)
402@@ -4,8 +4,8 @@
403
404 #include "./GaussPenta.h"
405 #include "./GaussTria.h"
406-#include "../../include/macros.h"
407 #include "../../io/Print/Print.h"
408+#include "../../include/typedefs.h"
409 #include "../../shared/Exceptions/exceptions.h"
410 #include "../../shared/MemOps/MemOps.h"
411 #include "../../shared/Numerics/GaussPoints.h"
412Index: ../trunk-jpl/src/c/classes/ToolkitOptions.cpp
413===================================================================
414--- ../trunk-jpl/src/c/classes/ToolkitOptions.cpp (revision 14913)
415+++ ../trunk-jpl/src/c/classes/ToolkitOptions.cpp (revision 14914)
416@@ -11,7 +11,6 @@
417 #include <string.h>
418 #include "./ToolkitOptions.h"
419 #include "../include/types.h"
420-#include "../include/macros.h"
421 #include "../shared/Exceptions/exceptions.h"
422 #include "../shared/MemOps/MemOps.h"
423
424Index: ../trunk-jpl/src/c/classes/objects/Bucket.h
425===================================================================
426--- ../trunk-jpl/src/c/classes/objects/Bucket.h (revision 14913)
427+++ ../trunk-jpl/src/c/classes/objects/Bucket.h (revision 14914)
428@@ -9,7 +9,6 @@
429 /*{{{*/
430 #include "./Object.h"
431 #include "../../shared/MemOps/MemOps.h"
432-#include "../../include/macros.h"
433 #include "../../Container/DataSet.h"
434 #include "../../toolkits/toolkitsenums.h"
435 /*}}}*/
436Index: ../trunk-jpl/src/c/classes/bamg/include.h
437===================================================================
438--- ../trunk-jpl/src/c/classes/bamg/include.h (revision 14913)
439+++ ../trunk-jpl/src/c/classes/bamg/include.h (revision 14914)
440@@ -5,7 +5,6 @@
441 #ifndef _INCLUDE2_H_
442 #define _INCLUDE2_H_
443
444-#include "../../include/macros.h"
445 #include "./macros.h"
446 #include "./typedefs.h"
447
Note: See TracBrowser for help on using the repository browser.