| [6304] | 1 | %VERBOSE class definition | 
|---|
|  | 2 | % | 
|---|
| [6583] | 3 | %   Available verbosity levels: | 
|---|
|  | 4 | %      mprocessor  : model processing | 
|---|
|  | 5 | %      module      : modules | 
|---|
|  | 6 | %      solution    : solution sequence | 
|---|
|  | 7 | %      solver      : solver info (extensive) | 
|---|
|  | 8 | %      convergence : convergence criteria | 
|---|
|  | 9 | %      control     : control method | 
|---|
|  | 10 | %      qmu         : sensitivity analysis | 
|---|
| [13435] | 11 | %      autodiff    : AD analysis | 
|---|
| [19559] | 12 | %      smb         : smb analysis | 
|---|
| [6583] | 13 | % | 
|---|
| [6304] | 14 | %   Usage: | 
|---|
|  | 15 | %      verbose=verbose(); | 
|---|
|  | 16 | %      verbose=verbose(3); | 
|---|
| [15427] | 17 | %      verbose=verbose('all'); | 
|---|
| [6304] | 18 | %      verbose=verbose('001100'); | 
|---|
|  | 19 | %      verbose=verbose('module',true,'solver',false); | 
|---|
|  | 20 |  | 
|---|
| [6315] | 21 | %WARNING: some parts of this file are Synchronized with src/c/shared/Numerics/Verbosity.h | 
|---|
|  | 22 | %         Do not modify these sections. See src/c/shared/Numerics/README for more info | 
|---|
|  | 23 |  | 
|---|
| [6304] | 24 | classdef verbose | 
|---|
| [6315] | 25 | properties (SetAccess=public) | 
|---|
| [12365] | 26 | % {{{ | 
|---|
| [6315] | 27 | %BEGINFIELDS | 
|---|
| [13435] | 28 | mprocessor=false; | 
|---|
|  | 29 | module=false; | 
|---|
|  | 30 | solution=false; | 
|---|
|  | 31 | solver=false; | 
|---|
|  | 32 | convergence=false; | 
|---|
|  | 33 | control=false; | 
|---|
|  | 34 | qmu=false; | 
|---|
|  | 35 | autodiff=false; | 
|---|
| [19559] | 36 | smb=false; | 
|---|
| [6315] | 37 | %ENDFIELDS | 
|---|
|  | 38 | % }}} | 
|---|
|  | 39 | end | 
|---|
|  | 40 | %}}} | 
|---|
|  | 41 | methods | 
|---|
| [12365] | 42 | function verbose=verbose(varargin) % {{{ | 
|---|
| [6304] | 43 |  | 
|---|
| [11867] | 44 | switch(nargin), | 
|---|
|  | 45 | case 0, | 
|---|
| [14558] | 46 | verbose.solution=true; | 
|---|
|  | 47 | verbose.qmu=true; | 
|---|
|  | 48 | verbose.control=true; | 
|---|
| [11867] | 49 | case 1, | 
|---|
|  | 50 | binary=varargin{1}; | 
|---|
| [12938] | 51 | if     ischar(binary), | 
|---|
| [11867] | 52 | if strcmpi(binary,'all'), | 
|---|
|  | 53 | binary=2^11-1; %all ones | 
|---|
|  | 54 | verbose=BinaryToVerbose(verbose,binary); | 
|---|
|  | 55 | verbose.solver=false; %Do not use by default | 
|---|
|  | 56 | else | 
|---|
|  | 57 | binary=bin2dec(binary); | 
|---|
|  | 58 | verbose=BinaryToVerbose(verbose,binary); | 
|---|
|  | 59 | end | 
|---|
| [12938] | 60 | elseif isnumeric(binary), | 
|---|
|  | 61 | verbose=BinaryToVerbose(verbose,binary); | 
|---|
| [11867] | 62 | end | 
|---|
|  | 63 | otherwise, | 
|---|
|  | 64 | %Use options to initialize object | 
|---|
|  | 65 | verbose=AssignObjectFields(pairoptions(varargin{:}),verbose); | 
|---|
| [6304] | 66 |  | 
|---|
| [11867] | 67 | %Cast to logicals | 
|---|
|  | 68 | listproperties=properties('verbose'); | 
|---|
|  | 69 | for i=1:numel(listproperties), | 
|---|
|  | 70 | fieldname=listproperties{i}; | 
|---|
|  | 71 | fieldvalue=verbose.(fieldname); | 
|---|
|  | 72 | if (islogical(fieldvalue) | isnumeric(fieldvalue)) & numel(fieldvalue)==1, | 
|---|
| [7872] | 73 | verbose.(fieldname)=logical(fieldvalue); | 
|---|
|  | 74 | else | 
|---|
|  | 75 | error('verbose supported field values are logicals only (true or false)'); | 
|---|
|  | 76 | end | 
|---|
| [6315] | 77 | end | 
|---|
|  | 78 | end | 
|---|
|  | 79 | end | 
|---|
|  | 80 | %}}} | 
|---|
| [12365] | 81 | function binary=VerboseToBinary(verbose) % {{{ | 
|---|
| [6304] | 82 |  | 
|---|
| [6315] | 83 | %BEGINVERB2BIN | 
|---|
|  | 84 | binary=0; | 
|---|
| [6323] | 85 | if (verbose.mprocessor), binary=bitor(binary,1); end | 
|---|
|  | 86 | if (verbose.module), binary=bitor(binary,2); end | 
|---|
|  | 87 | if (verbose.solution), binary=bitor(binary,4); end | 
|---|
| [6315] | 88 | if (verbose.solver), binary=bitor(binary,8); end | 
|---|
| [6323] | 89 | if (verbose.convergence), binary=bitor(binary,16); end | 
|---|
|  | 90 | if (verbose.control), binary=bitor(binary,32); end | 
|---|
|  | 91 | if (verbose.qmu), binary=bitor(binary,64); end | 
|---|
| [13435] | 92 | if (verbose.autodiff), binary=bitor(binary,128); end | 
|---|
| [19559] | 93 | if (verbose.smb), binary=bitor(binary,256); end | 
|---|
| [6315] | 94 | %ENDVERB2BIN | 
|---|
| [6304] | 95 |  | 
|---|
| [6315] | 96 | end | 
|---|
|  | 97 | %}}} | 
|---|
| [12365] | 98 | function verbose=BinaryToVerbose(verbose,binary) % {{{ | 
|---|
| [6304] | 99 |  | 
|---|
| [6315] | 100 | %BEGINBIN2VERB | 
|---|
| [13435] | 101 | if bitand(binary,1), verbose.mprocessor=true; else verbose.mprocessor=false; end | 
|---|
|  | 102 | if bitand(binary,2), verbose.module=true; else verbose.module=false; end | 
|---|
|  | 103 | if bitand(binary,4), verbose.solution=true; else verbose.solution=false; end | 
|---|
|  | 104 | if bitand(binary,8), verbose.solver=true; else verbose.solver=false; end | 
|---|
|  | 105 | if bitand(binary,16), verbose.convergence=true; else verbose.convergence=false; end | 
|---|
|  | 106 | if bitand(binary,32), verbose.control=true; else verbose.control=false; end | 
|---|
|  | 107 | if bitand(binary,64), verbose.qmu=true; else verbose.qmu=false; end | 
|---|
|  | 108 | if bitand(binary,128), verbose.autodiff=true; else verbose.autodiff=false; end | 
|---|
| [19559] | 109 | if bitand(binary,256), verbose.smb=true; else verbose.smb=false; end | 
|---|
| [6315] | 110 | %ENDBIN2VERB | 
|---|
| [6304] | 111 |  | 
|---|
| [6315] | 112 | end | 
|---|
|  | 113 | %}}} | 
|---|
| [19040] | 114 | function md = checkconsistency(self,md,solution,analyses) % {{{ | 
|---|
| [9739] | 115 |  | 
|---|
|  | 116 | end % }}} | 
|---|
| [12365] | 117 | function disp(verbose) % {{{ | 
|---|
| [13646] | 118 |  | 
|---|
| [6315] | 119 | %BEGINDISP | 
|---|
|  | 120 | disp(sprintf('class ''%s''  = ',class(verbose))); | 
|---|
| [6324] | 121 | disp(sprintf('   %15s : %s','mprocessor',mat2str(verbose.mprocessor))); | 
|---|
|  | 122 | disp(sprintf('   %15s : %s','module',mat2str(verbose.module))); | 
|---|
|  | 123 | disp(sprintf('   %15s : %s','solution',mat2str(verbose.solution))); | 
|---|
|  | 124 | disp(sprintf('   %15s : %s','solver',mat2str(verbose.solver))); | 
|---|
|  | 125 | disp(sprintf('   %15s : %s','convergence',mat2str(verbose.convergence))); | 
|---|
|  | 126 | disp(sprintf('   %15s : %s','control',mat2str(verbose.control))); | 
|---|
|  | 127 | disp(sprintf('   %15s : %s','qmu',mat2str(verbose.qmu))); | 
|---|
| [13435] | 128 | disp(sprintf('   %15s : %s','autodiff',mat2str(verbose.autodiff))); | 
|---|
| [19559] | 129 | disp(sprintf('   %15s : %s','smb',mat2str(verbose.smb))); | 
|---|
| [6315] | 130 | %ENDDISP | 
|---|
| [6304] | 131 |  | 
|---|
| [6315] | 132 | end | 
|---|
|  | 133 | %}}} | 
|---|
| [19040] | 134 | function marshall(self,md,fid) % {{{ | 
|---|
|  | 135 | WriteData(fid,'data',VerboseToBinary(self),'enum',VerboseEnum(),'format','Integer'); | 
|---|
| [10969] | 136 | end % }}} | 
|---|
| [19879] | 137 | function savemodeljs(self,fid,modelname) % {{{ | 
|---|
|  | 138 |  | 
|---|
|  | 139 | writejsdouble(fid,[modelname '.verbose.mprocessor'],self.mprocessor); | 
|---|
|  | 140 | writejsdouble(fid,[modelname '.verbose.module'],self.module); | 
|---|
|  | 141 | writejsdouble(fid,[modelname '.verbose.solution'],self.solution); | 
|---|
|  | 142 | writejsdouble(fid,[modelname '.verbose.solver'],self.solver); | 
|---|
|  | 143 | writejsdouble(fid,[modelname '.verbose.convergence'],self.convergence); | 
|---|
|  | 144 | writejsdouble(fid,[modelname '.verbose.control'],self.control); | 
|---|
|  | 145 | writejsdouble(fid,[modelname '.verbose.qmu'],self.qmu); | 
|---|
|  | 146 | writejsdouble(fid,[modelname '.verbose.autodiff'],self.autodiff); | 
|---|
|  | 147 | writejsdouble(fid,[modelname '.verbose.smb'],self.smb); | 
|---|
|  | 148 |  | 
|---|
|  | 149 | end % }}} | 
|---|
| [6304] | 150 | end | 
|---|
|  | 151 | end | 
|---|