mFES - molecular Finite Element Solver
0.4
|
00001 // SALOME Utils : general SALOME's definitions and tools 00002 // 00003 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, 00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 00005 // 00006 // This library is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU Lesser General Public 00008 // License as published by the Free Software Foundation; either 00009 // version 2.1 of the License. 00010 // 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 // Lesser General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU Lesser General Public 00017 // License along with this library; if not, write to the Free Software 00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 // 00020 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 00021 // 00022 // 00023 // 00024 // File : utilities.h 00025 // Author : Antoine YESSAYAN, Paul RASCLE, EDF 00026 // Module : SALOME 00027 // $Header: /cvs/netgen/netgen/libsrc/occ/utilities.h,v 1.3 2008/03/31 14:20:28 wabro Exp $ 00028 00029 /* --- Definition macros file to print informations if _DEBUG_ is defined --- */ 00030 00031 #ifndef UTILITIES_H 00032 #define UTILITIES_H 00033 00034 #include <string> 00035 #include <iostream> 00036 #include <cstdlib> 00037 // #include "SALOME_Log.hxx" 00038 00039 /* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ 00040 00041 #define INFOS(msg) {SLog->putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);} 00042 #define PYSCRIPT(msg) {SLog->putMessage(*SLog<<"---PYSCRIPT--- "<<msg<<endl);} 00043 00044 /* --- To print date and time of compilation of current source --- */ 00045 00046 #if defined ( __GNUC__ ) 00047 #define COMPILER "g++" 00048 #elif defined ( __sun ) 00049 #define COMPILER "CC" 00050 #elif defined ( __KCC ) 00051 #define COMPILER "KCC" 00052 #elif defined ( __PGI ) 00053 #define COMPILER "pgCC" 00054 #elif defined ( __alpha ) 00055 #define COMPILER "cxx" 00056 #else 00057 #define COMPILER "undefined" 00058 #endif 00059 00060 #ifdef INFOS_COMPILATION 00061 #error INFOS_COMPILATION already defined 00062 #endif 00063 00064 #define INFOS_COMPILATION { \ 00065 SLog->putMessage(\ 00066 *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\ 00067 << "COMPILED with " << COMPILER \ 00068 << ", " << __DATE__ \ 00069 << " at " << __TIME__ <<endl); } 00070 00071 #ifdef _DEBUG_ 00072 00073 /* --- the following MACROS are useful at debug time --- */ 00074 00075 #define MYTRACE *SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " 00076 00077 #define MESSAGE(msg) {SLog->putMessage( MYTRACE <<msg<<endl<<ends); } 00078 #define SCRUTE(var) {SLog->putMessage( MYTRACE << #var << "=" << var <<endl<<ends); } 00079 00080 #define REPERE *SLog << " --------------" << endl 00081 #define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: " <<msg<<endl;REPERE;} 00082 #define END_OF(msg) {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;} 00083 00084 #define HERE {cout<<flush ;cerr<<"- Trace "<<__FILE__<<" ["<<__LINE__<<"] : "<<flush ;} 00085 00086 #define INTERRUPTION(code) {HERE;cerr<<"INTERRUPTION return code= "<<code<< endl;std::exit(code);} 00087 00088 #ifndef ASSERT 00089 #define ASSERT(condition) \ 00090 if (!(condition)){HERE;cerr<<"CONDITION "<<#condition<<" NOT VERIFIED"<<endl;INTERRUPTION(1);} 00091 #endif /* ASSERT */ 00092 00093 00094 #else /* ifdef _DEBUG_*/ 00095 00096 #define HERE 00097 #define SCRUTE(var) {} 00098 #define MESSAGE(msg) {} 00099 #define REPERE 00100 #define BEGIN_OF(msg) {} 00101 #define END_OF(msg) {} 00102 00103 #define INTERRUPTION(code) {} 00104 00105 #ifndef ASSERT 00106 #define ASSERT(condition) {} 00107 #endif /* ASSERT */ 00108 00109 00110 #endif /* ifdef _DEBUG_*/ 00111 00112 #ifndef M_PI 00113 #define M_PI 3.14159265358979323846 00114 #endif 00115 00116 00117 #endif /* ifndef UTILITIES_H */