50 | | <a name="l00057"></a><a class="code" href="classlogger.html#92c63a0a87392c62b9ed3c00faa9d5df">00057</a> <span class="keyword">virtual</span> <a class="code" href="classlogger.html#92c63a0a87392c62b9ed3c00faa9d5df" title="for future use">~logger</a>() {}; |
51 | | <a name="l00058"></a>00058 }; |
52 | | <a name="l00059"></a>00059 |
53 | | <a name="l00060"></a>00060 |
54 | | <a name="l00067"></a><a class="code" href="classmemlog.html">00067</a> <span class="keyword">class </span><a class="code" href="classmemlog.html" title="Logging into matrices in data format in memory.">memlog</a> : <span class="keyword">public</span> <a class="code" href="classlogger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> { |
55 | | <a name="l00068"></a>00068 |
56 | | <a name="l00069"></a>00069 <span class="keyword">protected</span>: |
57 | | <a name="l00071"></a><a class="code" href="classmemlog.html#4195f322897ededdac66c404b848ced3">00071</a> <span class="keywordtype">int</span> <a class="code" href="classmemlog.html#4195f322897ededdac66c404b848ced3" title="Maximum length of vectors stored in memory.">maxlen</a>; |
58 | | <a name="l00073"></a><a class="code" href="classmemlog.html#3410b4c002636508c43ddcba8d394520">00073</a> <span class="keywordtype">int</span> <a class="code" href="classmemlog.html#3410b4c002636508c43ddcba8d394520" title="Currect record to be written.">ind</a>; |
59 | | <a name="l00075"></a><a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91">00075</a> Array<mat> <a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91" title="Storage.">vectors</a>; |
60 | | <a name="l00077"></a>00077 <span class="keyword">public</span>: |
61 | | <a name="l00079"></a><a class="code" href="classmemlog.html#e056e819c5a65d4431bfe7955b1efe97">00079</a> <a class="code" href="classmemlog.html#e056e819c5a65d4431bfe7955b1efe97" title="Default constructor.">memlog</a> ( <span class="keywordtype">int</span> maxlen0 ) : <a class="code" href="classlogger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a>(),<a class="code" href="classmemlog.html#4195f322897ededdac66c404b848ced3" title="Maximum length of vectors stored in memory.">maxlen</a> ( maxlen0 ),<a class="code" href="classmemlog.html#3410b4c002636508c43ddcba8d394520" title="Currect record to be written.">ind</a> ( 0 ),<a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91" title="Storage.">vectors</a> ( 0 ) {} |
62 | | <a name="l00081"></a><a class="code" href="classmemlog.html#b081ef5acb4816e6b5fcb56c19cc7e47">00081</a> <span class="keywordtype">void</span> <a class="code" href="classmemlog.html#b081ef5acb4816e6b5fcb56c19cc7e47" title="Initialize storage.">init</a>() { |
63 | | <a name="l00082"></a>00082 <span class="keywordtype">int</span> i; <span class="keywordtype">int</span> n =<a class="code" href="classlogger.html#83eea0cf4fbca59474d015f751f128a7" title="RVs of all logged variables.">entries</a>.length(); |
64 | | <a name="l00083"></a>00083 <a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91" title="Storage.">vectors</a>.set_size ( n ); |
65 | | <a name="l00084"></a>00084 <span class="keywordflow">for</span> ( i=0;i<n;i++ ) {<a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91" title="Storage.">vectors</a>(i).set_size (<a class="code" href="classmemlog.html#4195f322897ededdac66c404b848ced3" title="Maximum length of vectors stored in memory.">maxlen</a>,<a class="code" href="classlogger.html#83eea0cf4fbca59474d015f751f128a7" title="RVs of all logged variables.">entries</a>(i).count() );} |
66 | | <a name="l00085"></a>00085 ; |
67 | | <a name="l00086"></a>00086 } |
68 | | <a name="l00087"></a><a class="code" href="classmemlog.html#c97961eda9cda9f0e63c703cf21e5804">00087</a> <span class="keywordtype">void</span> <a class="code" href="classmemlog.html#c97961eda9cda9f0e63c703cf21e5804" title="Shifts storage position for another time step.">step</a>() {<span class="keywordflow">if</span> ( <a class="code" href="classmemlog.html#3410b4c002636508c43ddcba8d394520" title="Currect record to be written.">ind</a><<a class="code" href="classmemlog.html#4195f322897ededdac66c404b848ced3" title="Maximum length of vectors stored in memory.">maxlen</a> ) <a class="code" href="classmemlog.html#3410b4c002636508c43ddcba8d394520" title="Currect record to be written.">ind</a>++; <span class="keywordflow">else</span> it_error ( <span class="stringliteral">"memlog::ind is too high;"</span> );} |
69 | | <a name="l00088"></a><a class="code" href="classmemlog.html#3974df074f1df270d56f13ade374c1be">00088</a> <span class="keywordtype">void</span> <a class="code" href="classmemlog.html#3974df074f1df270d56f13ade374c1be" title="log this vector">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v ) { |
70 | | <a name="l00089"></a>00089 it_assert_debug(<span class="keywordtype">id</span><<a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91" title="Storage.">vectors</a>.length(),<span class="stringliteral">"Logger was not initialized, run init()."</span>); |
71 | | <a name="l00090"></a>00090 <a class="code" href="classmemlog.html#f0f5bc7b83539ad102e8f65297852d91" title="Storage.">vectors</a> ( <span class="keywordtype">id</span> ).set_row ( <a class="code" href="classmemlog.html#3410b4c002636508c43ddcba8d394520" title="Currect record to be written.">ind</a>,v );} |
72 | | <a name="l00092"></a>00092 <span class="keywordtype">void</span> <a class="code" href="classmemlog.html#65571ebbb16577b5211adbb27baf769c" title="Save values into an itfile named after fname.">itsave</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* fname); |
73 | | <a name="l00093"></a>00093 }; |
74 | | <a name="l00094"></a>00094 |
75 | | <a name="l00103"></a><a class="code" href="classdirfilelog.html">00103</a> <span class="keyword">class </span><a class="code" href="classdirfilelog.html" title="Logging into dirfile with buffer in memory.">dirfilelog</a> : <span class="keyword">public</span> <a class="code" href="classmemlog.html" title="Logging into matrices in data format in memory.">memlog</a> { |
76 | | <a name="l00104"></a>00104 |
77 | | <a name="l00105"></a>00105 <span class="keyword">protected</span>: |
78 | | <a name="l00107"></a><a class="code" href="classdirfilelog.html#cba5ff1f74ed22910ed7d63aadf21771">00107</a> <span class="keywordtype">string</span> <a class="code" href="classdirfilelog.html#cba5ff1f74ed22910ed7d63aadf21771" title="name of the directory">dirname</a>; |
79 | | <a name="l00109"></a><a class="code" href="classdirfilelog.html#854b7e7cc4cb40542b4a3ea06d915772">00109</a> Array<string> <a class="code" href="classdirfilelog.html#854b7e7cc4cb40542b4a3ea06d915772" title="Automatically generated.">scalarnames</a>; |
80 | | <a name="l00110"></a>00110 <span class="keyword">public</span>: |
81 | | <a name="l00114"></a><a class="code" href="classdirfilelog.html#802eeb6fc4ebf11d97638fd5dc651c68">00114</a> <a class="code" href="classdirfilelog.html#802eeb6fc4ebf11d97638fd5dc651c68" title="Default constructor.">dirfilelog</a> ( std::string dirname0, <span class="keywordtype">int</span> maxlen0 ) : <a class="code" href="classmemlog.html" title="Logging into matrices in data format in memory.">memlog</a> ( maxlen0 ), <a class="code" href="classdirfilelog.html#cba5ff1f74ed22910ed7d63aadf21771" title="name of the directory">dirname</a> ( dirname0 ), <a class="code" href="classdirfilelog.html#854b7e7cc4cb40542b4a3ea06d915772" title="Automatically generated.">scalarnames</a> ( 0 ) {} |
82 | | <a name="l00116"></a>00116 <span class="keywordtype">void</span> <a class="code" href="classdirfilelog.html#afeaebe003110f9db1ac43edf8e53a92" title="Initialize storage.">init</a>(); |
83 | | <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classdirfilelog.html#f5fe9483a041591bfe6f3d6393b02aa7" title="Shifts storage position for another time step.">step</a>(); |
84 | | <a name="l00118"></a>00118 <span class="keywordtype">void</span> <a class="code" href="classdirfilelog.html#4d671baf6f88444d7fe25a5b8a80834a" title="Finalize storing information.">finalize</a>(); |
85 | | <a name="l00122"></a>00122 <span class="keywordtype">void</span> <a class="code" href="classdirfilelog.html#bd95cdb46af194245f88a7b4bf4c66c7" title="Write memory storage to disk.">write_buffers</a> ( <span class="keywordtype">int</span> Len ); |
86 | | <a name="l00123"></a>00123 }; |
87 | | <a name="l00124"></a>00124 |
88 | | <a name="l00125"></a>00125 |
89 | | <a name="l00126"></a>00126 <span class="preprocessor">#endif // LGR_H</span> |
| 50 | <a name="l00057"></a><a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc">00057</a> <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1logger.html#cd6291a73491f755dc7bc88d022eb2fc" title="Initialize the storage.">init</a>(){}; |
| 51 | <a name="l00058"></a>00058 |
| 52 | <a name="l00060"></a><a class="code" href="classbdm_1_1logger.html#f2ade56238a5d408e65a77c53f516448">00060</a> <span class="keyword">virtual</span> <a class="code" href="classbdm_1_1logger.html#f2ade56238a5d408e65a77c53f516448" title="for future use">~logger</a>() {}; |
| 53 | <a name="l00061"></a>00061 }; |
| 54 | <a name="l00062"></a>00062 |
| 55 | <a name="l00063"></a>00063 |
| 56 | <a name="l00070"></a><a class="code" href="classbdm_1_1memlog.html">00070</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1memlog.html" title="Logging into matrices in data format in memory.">memlog</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a> { |
| 57 | <a name="l00071"></a>00071 |
| 58 | <a name="l00072"></a>00072 <span class="keyword">protected</span>: |
| 59 | <a name="l00074"></a><a class="code" href="classbdm_1_1memlog.html#a690ebd91430b5973855c9b4c9cf1b1d">00074</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1memlog.html#a690ebd91430b5973855c9b4c9cf1b1d" title="Maximum length of vectors stored in memory.">maxlen</a>; |
| 60 | <a name="l00076"></a><a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570">00076</a> <span class="keywordtype">int</span> <a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570" title="Currect record to be written.">ind</a>; |
| 61 | <a name="l00078"></a><a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e">00078</a> Array<mat> <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>; |
| 62 | <a name="l00080"></a>00080 <span class="keyword">public</span>: |
| 63 | <a name="l00082"></a><a class="code" href="classbdm_1_1memlog.html#e761799874d28bbfc4edc121be8c0a86">00082</a> <a class="code" href="classbdm_1_1memlog.html#e761799874d28bbfc4edc121be8c0a86" title="Default constructor.">memlog</a> ( <span class="keywordtype">int</span> maxlen0 ) : <a class="code" href="classbdm_1_1logger.html" title="Class for storing results (and semi-results) of an experiment.">logger</a>(),<a class="code" href="classbdm_1_1memlog.html#a690ebd91430b5973855c9b4c9cf1b1d" title="Maximum length of vectors stored in memory.">maxlen</a> ( maxlen0 ),<a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570" title="Currect record to be written.">ind</a> ( 0 ),<a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a> ( 0 ) {} |
| 64 | <a name="l00084"></a><a class="code" href="classbdm_1_1memlog.html#d3a8b007f3540523ff3f9910d9089391">00084</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#d3a8b007f3540523ff3f9910d9089391" title="Initialize storage.">init</a>() { |
| 65 | <a name="l00085"></a>00085 <span class="keywordtype">int</span> i; <span class="keywordtype">int</span> n =<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>.length(); |
| 66 | <a name="l00086"></a>00086 <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>.set_size ( n ); |
| 67 | <a name="l00087"></a>00087 <span class="keywordflow">for</span> ( i=0;i<n;i++ ) {<a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>(i).set_size (<a class="code" href="classbdm_1_1memlog.html#a690ebd91430b5973855c9b4c9cf1b1d" title="Maximum length of vectors stored in memory.">maxlen</a>,<a class="code" href="classbdm_1_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>(i).count() );} |
| 68 | <a name="l00088"></a>00088 ; |
| 69 | <a name="l00089"></a>00089 } |
| 70 | <a name="l00090"></a><a class="code" href="classbdm_1_1memlog.html#69964f0472e53098528ee41507bdfc77">00090</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#69964f0472e53098528ee41507bdfc77" title="Shifts storage position for another time step.">step</a>() {<span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570" title="Currect record to be written.">ind</a><<a class="code" href="classbdm_1_1memlog.html#a690ebd91430b5973855c9b4c9cf1b1d" title="Maximum length of vectors stored in memory.">maxlen</a> ) <a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570" title="Currect record to be written.">ind</a>++; <span class="keywordflow">else</span> it_error ( <span class="stringliteral">"memlog::ind is too high;"</span> );} |
| 71 | <a name="l00091"></a><a class="code" href="classbdm_1_1memlog.html#364e58c5d7058776c2a9cfa7d58dad6d">00091</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#364e58c5d7058776c2a9cfa7d58dad6d" title="log this vector">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> vec &v ) { |
| 72 | <a name="l00092"></a>00092 it_assert_debug(<span class="keywordtype">id</span><<a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>.length(),<span class="stringliteral">"Logger was not initialized, run init()."</span>); |
| 73 | <a name="l00093"></a>00093 <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a> ( <span class="keywordtype">id</span> ).set_row ( <a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570" title="Currect record to be written.">ind</a>,v );} |
| 74 | <a name="l00095"></a>00095 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#6a74b7a3d889607391594279112aef1f" title="Save values into an itfile named after fname.">itsave</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* fname); |
| 75 | <a name="l00096"></a>00096 }; |
| 76 | <a name="l00097"></a>00097 |
| 77 | <a name="l00106"></a><a class="code" href="classbdm_1_1dirfilelog.html">00106</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1dirfilelog.html" title="Logging into dirfile with buffer in memory.">dirfilelog</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1memlog.html" title="Logging into matrices in data format in memory.">memlog</a> { |
| 78 | <a name="l00107"></a>00107 |
| 79 | <a name="l00108"></a>00108 <span class="keyword">protected</span>: |
| 80 | <a name="l00110"></a><a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5">00110</a> <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5" title="name of the directory">dirname</a>; |
| 81 | <a name="l00112"></a><a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793">00112</a> Array<string> <a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793" title="Automatically generated.">scalarnames</a>; |
| 82 | <a name="l00113"></a>00113 <span class="keyword">public</span>: |
| 83 | <a name="l00117"></a><a class="code" href="classbdm_1_1dirfilelog.html#534cdc903068764f1f243ae8fc0316a3">00117</a> <a class="code" href="classbdm_1_1dirfilelog.html#534cdc903068764f1f243ae8fc0316a3" title="Default constructor.">dirfilelog</a> ( std::string dirname0, <span class="keywordtype">int</span> maxlen0 ) : <a class="code" href="classbdm_1_1memlog.html" title="Logging into matrices in data format in memory.">memlog</a> ( maxlen0 ), <a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5" title="name of the directory">dirname</a> ( dirname0 ), <a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793" title="Automatically generated.">scalarnames</a> ( 0 ) {} |
| 84 | <a name="l00119"></a>00119 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#78a3bd8a83cbd6299e279544bc81493d" title="Initialize storage.">init</a>(); |
| 85 | <a name="l00120"></a>00120 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#f79660645d09aa2d8bdd18923a721662" title="Shifts storage position for another time step.">step</a>(); |
| 86 | <a name="l00121"></a>00121 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#521d7ba159f97a0182392df27953804f" title="Finalize storing information.">finalize</a>(); |
| 87 | <a name="l00125"></a>00125 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#f595c0df25f5fa5d8c27ea1e375d9c51" title="Write memory storage to disk.">write_buffers</a> ( <span class="keywordtype">int</span> Len ); |
| 88 | <a name="l00126"></a>00126 }; |
| 89 | <a name="l00127"></a>00127 |
| 90 | <a name="l00128"></a>00128 } |
| 91 | <a name="l00129"></a>00129 <span class="preprocessor">#endif // LGR_H</span> |