79 | | <a name="l00035"></a><a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e">00035</a> Array<mat> <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>; |
80 | | <a name="l00037"></a>00037 <span class="keyword">public</span>: |
81 | | <a name="l00039"></a><a class="code" href="classbdm_1_1memlog.html#e761799874d28bbfc4edc121be8c0a86">00039</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 ) {} |
82 | | <a name="l00041"></a><a class="code" href="classbdm_1_1memlog.html#d3a8b007f3540523ff3f9910d9089391">00041</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#d3a8b007f3540523ff3f9910d9089391" title="Initialize storage.">init</a>() { |
83 | | <a name="l00042"></a>00042 <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(); |
84 | | <a name="l00043"></a>00043 <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>.set_size ( n ); |
85 | | <a name="l00044"></a>00044 <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)._dsize() );} |
86 | | <a name="l00045"></a>00045 ; |
| 79 | <a name="l00035"></a><a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e">00035</a> <a class="code" href="classitpp_1_1Array.html">Array<mat></a> <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>; |
| 80 | <a name="l00037"></a><a class="code" href="classbdm_1_1memlog.html#11fdf8ffca0f509ff637b0c3ac161c1f">00037</a> <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1memlog.html#11fdf8ffca0f509ff637b0c3ac161c1f" title="name of it file to save results">itfilename</a>; |
| 81 | <a name="l00038"></a>00038 <span class="keyword">public</span>: |
| 82 | <a name="l00040"></a><a class="code" href="classbdm_1_1memlog.html#611dda03b3050de2eaa448a59cee9c27">00040</a> <a class="code" href="classbdm_1_1memlog.html#611dda03b3050de2eaa448a59cee9c27" title="Default constructor.">memlog</a> ( <span class="keywordtype">int</span> maxlen0, <span class="keywordtype">string</span> itf=<span class="stringliteral">""</span> ) : <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 ),<a class="code" href="classbdm_1_1memlog.html#11fdf8ffca0f509ff637b0c3ac161c1f" title="name of it file to save results">itfilename</a>(itf) {} |
| 83 | <a name="l00042"></a><a class="code" href="classbdm_1_1memlog.html#d3a8b007f3540523ff3f9910d9089391">00042</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#d3a8b007f3540523ff3f9910d9089391" title="Initialize storage.">init</a>() { |
| 84 | <a name="l00043"></a>00043 <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>.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>(); |
| 85 | <a name="l00044"></a>00044 <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>.<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&lt;T&gt;.">set_size</a> ( n ); |
| 86 | <a name="l00045"></a>00045 <span class="keywordflow">for</span> ( i=0;i<n;i++ ) {<a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>(i).<a class="code" href="classitpp_1_1Array.html#dbf76c71f29014a4d53f254e83f3ff1c" title="Resizing an Array&lt;T&gt;.">set_size</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_1logger.html#c54566a4554089443a20b2a49ed1a61f" title="RVs of all logged variables.">entries</a>(i)._dsize() );} |
93 | | <a name="l00053"></a>00053 <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); |
94 | | <a name="l00054"></a>00054 }; |
95 | | <a name="l00055"></a>00055 |
96 | | <a name="l00064"></a><a class="code" href="classbdm_1_1dirfilelog.html">00064</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> { |
97 | | <a name="l00065"></a>00065 |
98 | | <a name="l00066"></a>00066 <span class="keyword">protected</span>: |
99 | | <a name="l00068"></a><a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5">00068</a> <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5" title="name of the directory">dirname</a>; |
100 | | <a name="l00070"></a><a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793">00070</a> Array<string> <a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793" title="Automatically generated.">scalarnames</a>; |
101 | | <a name="l00071"></a>00071 <span class="keyword">public</span>: |
102 | | <a name="l00075"></a><a class="code" href="classbdm_1_1dirfilelog.html#534cdc903068764f1f243ae8fc0316a3">00075</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 ) {} |
103 | | <a name="l00077"></a>00077 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#78a3bd8a83cbd6299e279544bc81493d" title="Initialize storage.">init</a>(); |
104 | | <a name="l00078"></a>00078 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#f79660645d09aa2d8bdd18923a721662" title="Shifts storage position for another time step.">step</a>(); |
105 | | <a name="l00079"></a>00079 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#521d7ba159f97a0182392df27953804f" title="Finalize storing information.">finalize</a>(); |
106 | | <a name="l00083"></a>00083 <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 ); |
107 | | <a name="l00084"></a>00084 }; |
108 | | <a name="l00085"></a>00085 |
109 | | <a name="l00086"></a>00086 }; |
110 | | <a name="l00087"></a>00087 <span class="preprocessor">#endif // LGR_H</span> |
| 93 | <a name="l00052"></a><a class="code" href="classbdm_1_1memlog.html#2b57dbd3dff49a98c6ce8fccccb170af">00052</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#2b57dbd3dff49a98c6ce8fccccb170af" title="log this double">logit</a> ( <span class="keywordtype">int</span> <span class="keywordtype">id</span>, <span class="keyword">const</span> <span class="keywordtype">double</span> &d ) { |
| 94 | <a name="l00053"></a>00053 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<span class="keywordtype">id</span><<a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>.<a class="code" href="classitpp_1_1Array.html#53629018f146084de506c33c69fa19a3" title="Returns the number of data elements in the array object.">length</a>(),<span class="stringliteral">"Logger was not initialized, run init()."</span>); |
| 95 | <a name="l00054"></a>00054 <a class="code" href="group__errorhandlingfunc.html#gb319550e696ee9d824d23c2a176bc3a6" title="Abort if t is not true and NDEBUG is not defined.">it_assert_debug</a>(<a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a>(<span class="keywordtype">id</span>).cols()==1,<span class="stringliteral">"Vector expected"</span>); |
| 96 | <a name="l00055"></a>00055 <span class="keywordflow">if</span>(<span class="keywordtype">id</span>>=0){ <a class="code" href="classbdm_1_1memlog.html#1fed143162f2de6ef1c1b6557964f24e" title="Storage.">vectors</a> ( <span class="keywordtype">id</span> ) ( <a class="code" href="classbdm_1_1memlog.html#70cec1d3549a82796ad7b6f0d07a4570" title="Currect record to be written.">ind</a> )=d;} |
| 97 | <a name="l00056"></a>00056 } |
| 98 | <a name="l00058"></a>00058 <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); |
| 99 | <a name="l00060"></a><a class="code" href="classbdm_1_1memlog.html#39e32f671414c71304e316976ccc37f3">00060</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1memlog.html#39e32f671414c71304e316976ccc37f3" title="Finalize storing information.">finalize</a>() {<span class="keywordflow">if</span> (<a class="code" href="classbdm_1_1memlog.html#11fdf8ffca0f509ff637b0c3ac161c1f" title="name of it file to save results">itfilename</a>.length()>0) <a class="code" href="classbdm_1_1memlog.html#6a74b7a3d889607391594279112aef1f" title="Save values into an itfile named after fname.">itsave</a>(<a class="code" href="classbdm_1_1memlog.html#11fdf8ffca0f509ff637b0c3ac161c1f" title="name of it file to save results">itfilename</a>.c_str());}; |
| 100 | <a name="l00061"></a>00061 |
| 101 | <a name="l00062"></a>00062 }; |
| 102 | <a name="l00063"></a>00063 |
| 103 | <a name="l00072"></a><a class="code" href="classbdm_1_1dirfilelog.html">00072</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> { |
| 104 | <a name="l00073"></a>00073 |
| 105 | <a name="l00074"></a>00074 <span class="keyword">protected</span>: |
| 106 | <a name="l00076"></a><a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5">00076</a> <span class="keywordtype">string</span> <a class="code" href="classbdm_1_1dirfilelog.html#985eb02770f01e25cdceff32ff53a9c5" title="name of the directory">dirname</a>; |
| 107 | <a name="l00078"></a><a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793">00078</a> <a class="code" href="classitpp_1_1Array.html">Array<string></a> <a class="code" href="classbdm_1_1dirfilelog.html#7805040fe1ffa2a048c33980bc995793" title="Automatically generated.">scalarnames</a>; |
| 108 | <a name="l00079"></a>00079 <span class="keyword">public</span>: |
| 109 | <a name="l00083"></a><a class="code" href="classbdm_1_1dirfilelog.html#534cdc903068764f1f243ae8fc0316a3">00083</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 ) {} |
| 110 | <a name="l00085"></a>00085 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#78a3bd8a83cbd6299e279544bc81493d" title="Initialize storage.">init</a>(); |
| 111 | <a name="l00086"></a>00086 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#f79660645d09aa2d8bdd18923a721662" title="Shifts storage position for another time step.">step</a>(); |
| 112 | <a name="l00087"></a>00087 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1dirfilelog.html#521d7ba159f97a0182392df27953804f" title="Finalize storing information.">finalize</a>(); |
| 113 | <a name="l00091"></a>00091 <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 ); |
| 114 | <a name="l00092"></a>00092 }; |
| 115 | <a name="l00093"></a>00093 |
| 116 | <a name="l00094"></a>00094 }; |
| 117 | <a name="l00095"></a>00095 <span class="preprocessor">#endif // LGR_H</span> |