Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.78 2002/05/11 01:14:17 geraint +## Fix for [ 553218 ] simpar.oct and simpar.m different. +## Translation added between ColumnVector in base .cc and Octave_map in .oct. +## ## Revision 1.77 2002/05/08 16:03:32 geraint ## Added mex support for ode2odes: mtt sys ode2odes mexglx. ## This mex stuff seems to require octave2.1-headers. ## ## Revision 1.76 2002/05/08 14:14:55 geraint @@ -347,11 +351,11 @@ make_m() { #lang_header $1 ode2odes m 'x,par,simpar' '[Y,X,t]' > $filename mtt_header ${sys} ode2odes m > $filename cat <> $filename -global MTT_data; +global MTT_data if nargin<3 simpar = ${sys}_simpar(); [simpar.dt] = mtt_simpar_update; endif @@ -379,11 +383,11 @@ mttj = 0; for it = 1:ilast #Integration loop [u] = ${sys}_input(x,y,t,par); # Input [y] = ${sys}_$odeo(x,u,t,par); # Output if mttj==0 - mtt_write(t,x,y,$Nx,$Ny); # Write it out + mtt_write(t,x,y,$Nx,$Ny,simpar.first); # Write it out endif EOF if [ "$method" = "rk4" ]; then cat << EOF >> $filename @@ -936,10 +940,11 @@ inline void mtt_write (const double &t, ColumnVector &x, ColumnVector &y, + const double &first, const int &nrows, const bool dump_data = false, std::ostream &file = std::cout) { static Matrix data; @@ -964,18 +969,20 @@ register int col = 0; if (0 == row) data = Matrix (nrows, 1+ny+1+nx, 0.0); + if (t >= first) { data.elem (row, col) = t; for (register int i = 0; i < ny; i++) data.elem (row, ++col) = y.elem (i); data.elem (row, ++col) = t; for (register int i = 0; i < nx; i++) data.elem (row, ++col) = x.elem (i); row++; + }; static std::fstream fcputime ("MTT.cputime", std::ios::out | std::ios::trunc | std::ios::app); static clock_t cputime0 = clock(); static clock_t cputime1 = cputime0; clock_t cputime = clock(); @@ -1021,11 +1028,11 @@ static ColumnVector open_switches (MTTNX, 0.0); register double t = 0.0; const double ddt = dt / stepfactor; - const int ilast = static_cast (round ((last - first) / ddt)) + 1; + const int ilast = static_cast (round ( last / ddt)) + 1; const int nrows = static_cast (round ((last - first) / dt)) + 1; for (register int i = 0; i < MTTNY; i++) { y (i) = 0.0; @@ -1040,11 +1047,11 @@ { u = mtt_input (x, y, t, numpar); y = mtt_output (x, u, t, numpar); if (0 == j) { - mtt_write (t, x, y, nrows); + mtt_write (t, x, y, first, nrows); } EOF case "$method" in "rk4") cat << EOF >> $filename