Changeset 6301
- Timestamp:
- 10/14/10 15:02:54 (14 years ago)
- Location:
- issm/trunk/src/c/shared/Numerics
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/shared/Numerics/Verbosity.cpp
r6273 r6301 1 1 2 /*include*/ 3 /*{{{1*/ 4 #ifdef HAVE_CONFIG_H 5 #include "config.h" 6 #else 7 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!" 8 #endif 2 9 #include "./Verbosity.h" 10 #include "../../include/macros.h" 11 #include "../Exceptions/exceptions.h" 12 #ifdef _SERIAL_ 13 #include <mex.h> 14 #endif 15 /*}}}*/ 3 16 4 /* Element macros*/5 #define MODULE 1 /*2^0 -> 000000001*/6 #define CONVER 2 /*2^1 -> 000000010*/7 #define PROCES 4 /*2^2 -> 000000100*/8 #define SOLVER 8 /*2^3 -> 000001000*/17 /*Verbosityt levels*/ 18 bool VerbModule (void){return (GetVerbosityLevel() & 1 );}/* 2^0 -> 000000001*/ 19 bool VerbConverge (void){return (GetVerbosityLevel() & 2 );}/* 2^1 -> 000000010*/ 20 bool VerbModProc (void){return (GetVerbosityLevel() & 4 );}/* 2^2 -> 000000100*/ 21 bool VerbSolver (void){return (GetVerbosityLevel() & 8 );}/* 2^3 -> 000001000*/ 9 22 10 bool IsModuleVerbosity(int level){ 11 if(level & MODULE) return true; 12 else return false; 13 } 14 bool IsConvergenceVerbosity(int level){ 15 if(level & CONVER) return true; 16 else return false; 17 } 18 bool IsModelProcessorVerbosity(int level){ 19 if(level & PROCES) return true; 20 else return false; 21 } 22 bool IsSolverVerbosity(int level){ 23 if(level & SOLVER) return true; 24 else return false; 25 } 23 /*Verbosity Setup*/ 24 static int verbositylevel=-1; 25 /*FUNCTION SetVerbosityLevel {{{1*/ 26 void SetVerbosityLevel(int level){ 27 28 if(level<0) ISSMERROR("vebosity level should be a positive integer (user provided %i)",level); 29 30 #ifdef _SERIAL_ 31 32 mxArray* output=NULL; 33 mxArray* input=NULL; 34 input=mxCreateDoubleScalar((double)level); 35 36 mexCallMATLAB(0,&output,1,&input,"SetVerbosityLevel"); 37 #else 38 39 verbositylevel = level; 40 41 #endif 42 43 }/*}}}*/ 44 /*FUNCTION GetVerbosityLevel {{{1*/ 45 int GetVerbosityLevel(void){ 46 47 #ifdef _SERIAL_ 48 49 mxArray* output=NULL; 50 mxArray* input=NULL; 51 double level; 52 53 mexCallMATLAB(1,&output,0,&input,"GetVerbosityLevel"); 54 level=mxGetScalar(output); 55 56 verbositylevel = (int)level; 57 58 #else 59 60 ISSMASSERT(verbositylevel>=0); 61 return verbositylevel; 62 63 #endif 64 }/*}}}*/ -
issm/trunk/src/c/shared/Numerics/Verbosity.h
r6273 r6301 6 6 #define _VERBOSITY_H_ 7 7 8 bool IsModuleVerbosity(int level); 9 bool IsConvergenceVerbosity(int level); 10 bool IsModelProcessorVerbosity(int level); 11 bool IsSolverVerbosity(int level); 8 void SetVerbosityLevel(int level); 9 int GetVerbosityLevel(void); 10 11 bool VerbModule(void); 12 bool VerbConvergence(void); 13 bool VerbModelProcessor(void); 14 bool VerbSolver(void); 12 15 13 16 #endif
Note:
See TracChangeset
for help on using the changeset viewer.