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

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

NEW: adding Archive/14312-15392 for oecreview

File size: 15.4 KB
  • ../trunk-jpl/src/c/include/macros.h

     
    1 /* \file macros.h
    2  * \brief: global macros used in the whole code
    3  */
    4 
    5 /*Header {{{*/
    6 #ifndef _MACROS_H_
    7 #define _MACROS_H_
    8 
    9 #include <iostream>
    10 #include <sstream>
    11 #include <iomanip>
    12 #include "./typedefs.h"
    13 
    14 #ifdef HAVE_CONFIG_H
    15         #include <config.h>
    16 #else
    17 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    18 #endif
    19 /*}}}*/
    20 
    21 /*Exceptions: */
    22 /* _assert_ {{{*/
    23 /*Assertion macro: do nothing if macro _ISSM_DEBUG_ undefined*/
    24 #ifdef _ISSM_DEBUG_
    25 #define _assert_(statement)\
    26   if (!(statement)) _error_("Assertion \""<<#statement<<"\" failed, please report bug to "<<PACKAGE_BUGREPORT)
    27 #else
    28 #define _assert_(ignore)\
    29   ((void) 0)
    30 #endif
    31 /*}}}*/
    32 /* _error_ {{{*/
    33 /*new Error exception macro*/
    34 #ifdef _INTEL_WIN_
    35 #define _error_(StreamArgs)\
    36    do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
    37    aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
    38    throw ErrorException(aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
    39 #else
    40 #define _error_(StreamArgs)\
    41         do{std::ostringstream aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy; \
    42    aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy << StreamArgs << std::ends; \
    43    throw ErrorException(__FILE__,__func__,__LINE__,aLoNgAnDwEiRdLoCaLnAmeFoRtHiSmAcRoOnLy.str());}while(0)
    44 #endif
    45 /*}}}*/
    46 /* ExceptionTrapBegin/ExceptionTrapEnd {{{*/
    47 
    48 /*The following macros hide the error exception handling in a matlab module. Just put
    49  * ExceptionTrapBegin(); and ExceptionTrapEnd(); at the beginning and end of a module, and c++ exceptions
    50  * will be trapped. Really nifty!*/
    51 
    52 #define ExceptionTrapBegin(); \
    53         try{
    54 
    55 #define ExceptionTrapEnd(); }\
    56         catch(ErrorException &exception){\
    57                 exception.Report();\
    58                 return 0;\
    59         }\
    60         catch (exception& e) {\
    61                 _printf_(true,"Standard exception: %s\n",e.what());\
    62                 return 0;\
    63         }\
    64         catch(...){\
    65                 _printf_(true,"An unexpected error occurred");\
    66                 return 0;\
    67         }
    68 /*}}}*/
    69 
    70 #endif
  • ../trunk-jpl/src/c/include/include.h

     
    55#ifndef _INCLUDEGLOBAL_H_
    66#define  _INCLUDEGLOBAL_H_
    77
    8 #include "./macros.h"
    98#include "./typedefs.h"
    109#include "./types.h"
    1110
  • ../trunk-jpl/src/c/shared/Exceptions/exceptions.h

     
    66 * own exceptions
    77 */
    88
    9 #ifndef MY_EXCEPTIONS_H_
    10 #define MY_EXCEPTIONS_H_
     9#ifndef _MY_EXCEPTIONS_H_
     10#define _MY_EXCEPTIONS_H_
    1111
    1212#include <exception>
    1313#include <string>
     14#include <iostream>
     15#include <sstream>
     16#include <iomanip>
     17
    1418using namespace std;
    1519
    16 /*We derive our classes from the c++ exception class: */
    17 class ErrorException: public exception {
     20#ifdef HAVE_CONFIG_H
     21        #include <config.h>
     22#else
     23#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
     24#endif
    1825
     26/*macros: */
     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/*ISSM exception class: */
     76class ErrorException: public exception { /*{{{*/
     77
    1978        string   what_str;
    2079        string   function_name;
    2180        string   file_name;
     
    3190        const char* PythonReport() const;
    3291
    3392};
     93/*}}}*/
    3494
    3595char* exprintf(const char* format,...);
     96
    3697#endif
     98
     99
  • ../trunk-jpl/src/c/shared/Numerics/Synchronize.sh

     
    2626#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    2727#endif
    2828#include "./Verbosity.h"
    29 #include "../../include/macros.h"
    3029#include "../Exceptions/exceptions.h"
    3130/*}}}*/
    3231
  • ../trunk-jpl/src/c/shared/Numerics/Verbosity.cpp

     
    1515#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    1616#endif
    1717#include "./Verbosity.h"
    18 #include "../../include/macros.h"
    1918#include "../Exceptions/exceptions.h"
    2019/*}}}*/
    2120
  • ../trunk-jpl/src/c/shared/Sorting/binary_search.cpp

     
    88#error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
    99#endif
    1010
    11 #include "../../include/macros.h"
    1211#include "../Exceptions/exceptions.h"
    1312#include <stdio.h>
    1413
  • ../trunk-jpl/src/c/shared/Elements/PrintArrays.cpp

     
    11
    22#include "./elements.h"
    3 #include "../../include/macros.h"
    43using namespace std;
    54
    65void printarray(IssmPDouble* array,int lines,int cols){
  • ../trunk-jpl/src/c/io/Comm/IssmComm.cpp

     
    1010
    1111#include "./IssmComm.h"
    1212#include "../../include/types.h"
    13 #include "../../include/macros.h"
    1413#include "../../shared/Exceptions/exceptions.h"
    1514
    1615void IssmComm::SetComm(COMM incomm){ /*{{{*/
  • ../trunk-jpl/src/c/toolkits/mumps/MpiDenseMumpsSolve.cpp

     
    1010#endif
    1111
    1212#include "../../include/types.h"
    13 #include "../../include/macros.h"
    1413#include "../../shared/MemOps/MemOps.h"
    1514#include "../../shared/Exceptions/exceptions.h"
    1615#include "../../io/Comm/Comm.h"
  • ../trunk-jpl/src/c/toolkits/issm/IssmVec.h

     
    1616#include "../../EnumDefinitions/EnumDefinitions.h"
    1717#include "../../shared/Exceptions/exceptions.h"
    1818#include "../../shared/MemOps/MemOps.h"
    19 #include "../../include/macros.h"
    2019#include "./IssmToolkitUtils.h"
    2120#include <math.h>
    2221/*}}}*/
  • ../trunk-jpl/src/c/toolkits/issm/IssmDenseMat.h

     
    2020#include "../../shared/Exceptions/exceptions.h"
    2121#include "../../shared/MemOps/MemOps.h"
    2222#include "../../io/Print/Print.h"
    23 #include "../../include/macros.h"
    2423#include "../../toolkits/gsl/gslincludes.h"
    2524
    2625#include <math.h>
  • ../trunk-jpl/src/c/toolkits/issm/IssmMat.h

     
    1515
    1616#include "../../shared/Exceptions/exceptions.h"
    1717#include "../../shared/MemOps/MemOps.h"
    18 #include "../../include/macros.h"
    1918#include "../../classes/ToolkitOptions.h"
    2019#include "../../io/Comm/Comm.h"
    2120#include "../../EnumDefinitions/EnumDefinitions.h"
  • ../trunk-jpl/src/c/toolkits/issm/IssmToolkitUtils.cpp

     
    1212
    1313#include "../../shared/MemOps/MemOps.h"
    1414#include "../../io/Comm/Comm.h"
    15 #include "../../include/macros.h"
    1615#include "../../classes/ToolkitOptions.h"
    1716#include "../../EnumDefinitions/EnumDefinitions.h"
    1817#include "../../shared/Exceptions/exceptions.h"
  • ../trunk-jpl/src/c/toolkits/issm/IssmAbsVec.h

     
    2020
    2121#include "../../shared/Exceptions/exceptions.h"
    2222#include "../../shared/MemOps/MemOps.h"
    23 #include "../../include/macros.h"
    2423#include <math.h>
    2524
    2625/*}}}*/
  • ../trunk-jpl/src/c/toolkits/issm/IssmMpiVec.h

     
    1919
    2020#include "../../shared/Exceptions/exceptions.h"
    2121#include "../../shared/MemOps/MemOps.h"
    22 #include "../../include/macros.h"
    2322#include "../../io/io.h"
    2423#ifdef _HAVE_MPI_
    2524#include "../mpi/mpiincludes.h"
  • ../trunk-jpl/src/c/toolkits/issm/IssmMpiDenseMat.h

     
    1919
    2020#include "../../shared/Exceptions/exceptions.h"
    2121#include "../../shared/MemOps/MemOps.h"
    22 #include "../../include/macros.h"
    2322#include "../../Container/DataSet.h"
    2423#include "../../io/Comm/Comm.h"
    2524#include "../../classes/objects/Bucket.h"
  • ../trunk-jpl/src/c/toolkits/issm/IssmSeqVec.h

     
    1919#include "../../shared/Exceptions/exceptions.h"
    2020#include "../../io/Print/Print.h"
    2121#include "../../shared/MemOps/MemOps.h"
    22 #include "../../include/macros.h"
    2322#include <math.h>
    2423
    2524/*}}}*/
  • ../trunk-jpl/src/c/toolkits/issm/IssmAbsMat.h

     
    2020
    2121#include "../../shared/Exceptions/exceptions.h"
    2222#include "../../shared/MemOps/MemOps.h"
    23 #include "../../include/macros.h"
    2423#include "./IssmAbsVec.h"
    2524
    2625/*}}}*/
  • ../trunk-jpl/src/c/Makefile.am

     
    2020#Core sources{{{
    2121core_sources = ./issm.h\
    2222                                        ./issm-binding.h\
    23                                         ./include/macros.h\
    2423                                        ./include/typedefs.h\
    2524                                        ./include/types.h\
    2625                                        ./include/include.h\
  • ../trunk-jpl/src/c/classes/DofIndexing.cpp

     
    1414#include "../include/types.h"
    1515#include "../include/typedefs.h"
    1616#include "../io/Print/Print.h"
    17 #include "../include/macros.h"
    1817#include "../shared/Exceptions/exceptions.h"
    1918#include "../shared/MemOps/MemOps.h"
    2019#include "../EnumDefinitions/EnumDefinitions.h"
  • ../trunk-jpl/src/c/classes/gauss/GaussTria.cpp

     
    33 */
    44
    55#include "./GaussTria.h"
    6 #include "../../include/macros.h"
    76#include "../../io/Print/Print.h"
    87#include "../../shared/Exceptions/exceptions.h"
    98#include "../../shared/MemOps/MemOps.h"
  • ../trunk-jpl/src/c/classes/gauss/GaussPenta.cpp

     
    44
    55#include "./GaussPenta.h"
    66#include "./GaussTria.h"
    7 #include "../../include/macros.h"
    87#include "../../io/Print/Print.h"
     8#include "../../include/typedefs.h"
    99#include "../../shared/Exceptions/exceptions.h"
    1010#include "../../shared/MemOps/MemOps.h"
    1111#include "../../shared/Numerics/GaussPoints.h"
  • ../trunk-jpl/src/c/classes/ToolkitOptions.cpp

     
    1111#include <string.h>
    1212#include "./ToolkitOptions.h"
    1313#include "../include/types.h"
    14 #include "../include/macros.h"
    1514#include "../shared/Exceptions/exceptions.h"
    1615#include "../shared/MemOps/MemOps.h"
    1716
  • ../trunk-jpl/src/c/classes/objects/Bucket.h

     
    99/*{{{*/
    1010#include "./Object.h"
    1111#include "../../shared/MemOps/MemOps.h"
    12 #include "../../include/macros.h"
    1312#include "../../Container/DataSet.h"
    1413#include "../../toolkits/toolkitsenums.h"
    1514/*}}}*/
  • ../trunk-jpl/src/c/classes/bamg/include.h

     
    55#ifndef _INCLUDE2_H_
    66#define  _INCLUDE2_H_
    77
    8 #include "../../include/macros.h"
    98#include "./macros.h"
    109#include "./typedefs.h"
    1110
Note: See TracBrowser for help on using the repository browser.