| 1 | /*
|
|---|
| 2 | * \file Verbosity.cpp:
|
|---|
| 3 | * \brief: Manage verbosity levels
|
|---|
| 4 | *
|
|---|
| 5 | * WARNING: DO NOT MODIFY THIS FILE
|
|---|
| 6 | * this file has been automatically generated by Synchronize.sh
|
|---|
| 7 | * Please read README for more information
|
|---|
| 8 | */
|
|---|
| 9 |
|
|---|
| 10 | /*include*/
|
|---|
| 11 | /*{{{*/
|
|---|
| 12 | #ifdef HAVE_CONFIG_H
|
|---|
| 13 | #include <config.h>
|
|---|
| 14 | #else
|
|---|
| 15 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
|---|
| 16 | #endif
|
|---|
| 17 | #include "./Verbosity.h"
|
|---|
| 18 | #include "../../include/macros.h"
|
|---|
| 19 | #include "../Exceptions/exceptions.h"
|
|---|
| 20 | #ifdef _SERIAL_
|
|---|
| 21 | #include <mex.h>
|
|---|
| 22 | #endif
|
|---|
| 23 | /*}}}*/
|
|---|
| 24 |
|
|---|
| 25 | /*Verbosityt levels*/
|
|---|
| 26 | bool VerboseMProcessor(void){return (GetVerbosityLevel() & 1);} /* 2^0*/
|
|---|
| 27 | bool VerboseModule(void){return (GetVerbosityLevel() & 2);} /* 2^1*/
|
|---|
| 28 | bool VerboseSolution(void){return (GetVerbosityLevel() & 4);} /* 2^2*/
|
|---|
| 29 | bool VerboseSolver(void){return (GetVerbosityLevel() & 8);} /* 2^3*/
|
|---|
| 30 | bool VerboseConvergence(void){return (GetVerbosityLevel() & 16);} /* 2^4*/
|
|---|
| 31 | bool VerboseControl(void){return (GetVerbosityLevel() & 32);} /* 2^5*/
|
|---|
| 32 | bool VerboseQmu(void){return (GetVerbosityLevel() & 64);} /* 2^6*/
|
|---|
| 33 |
|
|---|
| 34 | /*Verbosity Setup*/
|
|---|
| 35 | static int verbositylevel=-1;
|
|---|
| 36 | /*FUNCTION SetVerbosityLevel {{{*/
|
|---|
| 37 | void SetVerbosityLevel(int level){
|
|---|
| 38 |
|
|---|
| 39 | if(level<0) _error_("vebosity level should be a positive integer (user provided %i)",level);
|
|---|
| 40 |
|
|---|
| 41 | #ifdef _SERIAL_
|
|---|
| 42 |
|
|---|
| 43 | mxArray* output=NULL;
|
|---|
| 44 | mxArray* input=NULL;
|
|---|
| 45 | input=mxCreateDoubleScalar((double)level);
|
|---|
| 46 |
|
|---|
| 47 | mexCallMATLAB(0,&output,1,&input,"SetVerbosityLevel");
|
|---|
| 48 | #else
|
|---|
| 49 |
|
|---|
| 50 | verbositylevel = level;
|
|---|
| 51 |
|
|---|
| 52 | #endif
|
|---|
| 53 | }/*}}}*/
|
|---|
| 54 | /*FUNCTION GetVerbosityLevel {{{*/
|
|---|
| 55 | int GetVerbosityLevel(void){
|
|---|
| 56 | #ifdef _SERIAL_
|
|---|
| 57 |
|
|---|
| 58 | mxArray* output=NULL;
|
|---|
| 59 | mxArray* input=NULL;
|
|---|
| 60 | double level;
|
|---|
| 61 |
|
|---|
| 62 | mexCallMATLAB(1,&output,0,&input,"GetVerbosityLevel");
|
|---|
| 63 | level=mxGetScalar(output);
|
|---|
| 64 |
|
|---|
| 65 | verbositylevel = (int)level;
|
|---|
| 66 |
|
|---|
| 67 | #else
|
|---|
| 68 |
|
|---|
| 69 | _assert_(verbositylevel>=0);
|
|---|
| 70 | return verbositylevel;
|
|---|
| 71 |
|
|---|
| 72 | #endif
|
|---|
| 73 | }/*}}}*/
|
|---|