Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.309.2.2 2001/06/05 03:20:39 geraint +## added -ae option to select algebraic equation solution method. +## ## Revision 1.309.2.1 2001/05/04 04:07:24 geraint ## Numerical solution of algebraic equations. ## sys_ae.cc written for unsolved inputs. ## Solution of equations using hybrd from MINPACK (as used by Octave fsolve). ## @@ -2601,14 +2604,14 @@ $1_ode2odes.o: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o echo Creating $1_ode2odes.o ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DSTANDALONE -$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct +$1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common.oct $1_ode2odes_${integration_method}.oct $1_ode2odes_${algebraic_solver}.o touch $1_ode2odes.m echo Creating $1_ode2odes.oct - $MKOCTFILE $1_ode2odes.cc + $MKOCTFILE $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc $1_ode2odes.cc: $1_def.r $1_sympars.txt\ $1_ode2odes_common.m $1_ode2odes_common.cc\ $1_ode2odes_${integration_method}.m $1_ode2odes_${integration_method}.cc mtt_Solver.cc mtt_${algebraic_solver}.cc mtt_${algebraic_solver}.hh touch $1_ode2odes.m Index: mttroot/mtt/bin/trans/make_ode2odes ================================================================== --- mttroot/mtt/bin/trans/make_ode2odes +++ mttroot/mtt/bin/trans/make_ode2odes @@ -7,10 +7,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.57.2.4 2001/07/02 00:34:56 geraint +## gcc-3.0 compatibility. +## ## Revision 1.57.2.3 2001/06/25 23:28:29 geraint ## Generic mtt_rate and mtt_output - allows method independent calls. ## ## Revision 1.57.2.2 2001/06/05 03:20:40 geraint ## added -ae option to select algebraic equation solution method. @@ -375,16 +378,16 @@ #endif #include "${sys}_def.h" #include "${sys}_sympar.h" +#include "mtt_${algebraic_solver}.hh" + #ifdef STANDALONE #include #include -#include "mtt_${algebraic_solver}.hh" - extern ColumnVector F${sys}_ae ( ColumnVector &x, ColumnVector &u, const double &t, ColumnVector &par); @@ -461,42 +464,58 @@ cat <> $filename void set_signal_handlers (void); #endif // STANDALONE + +ColumnVector +mtt_ae (ColumnVector &x, + ColumnVector &u, + const double &t, + ColumnVector &par) +{ +#ifdef STANDALONE + return F${sys}_ae(x,u,t,par); +#else + static octave_value_list args, f; + args (0) = octave_value (x); + args (1) = octave_value (u); + args (2) = octave_value (t); + args (3) = octave_value (par); + f = feval ("${sys}_ae", args, 1); + return f(0).${vector_value} (); +#endif +} inline ColumnVector mtt_input (ColumnVector &x, ColumnVector &y, const double &t, ColumnVector &par) { -#ifdef STANDALONE + static ${algebraic_solver} ae(mtt_ae,MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ); static ColumnVector u (MTTNU); - static ColumnVector ui (MTTNYZ); - static ColumnVector U (MTTNU+MTTNYZ); - - static ${algebraic_solver} ae(F${sys}_ae,MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ); +#ifdef STANDALONE u = F${sys}_input (x, y, t, par); +#else + static octave_value_list args, f; + args (0) = octave_value (x); + args (1) = octave_value (y); + args (2) = octave_value (t); + args (3) = octave_value (par); + f = feval ("${sys}_input", args, 1); + u = f(0).${vector_value} (); +#endif if (MTTNYZ == 0) { return u; } else { return ae.solve(x,u,t,par); } -#else - static octave_value_list args, f; - args (0) = octave_value (x); - args (1) = octave_value (y); - args (2) = octave_value (t); - args (3) = octave_value (par); - f = feval ("${sys}_input", args, 1); - return f(0).${vector_value} (); -#endif } inline ColumnVector mtt_logic (ColumnVector &x, ColumnVector &u, @@ -707,11 +726,11 @@ if (dump_data) { if (row > 0) { Matrix written_data = data.extract (0, 0, row-1, data.cols ()-1); - $save_ascii_data_function (file, written_data, "MTT_data"); + $save_ascii_data_function (file, written_data, "mtt_data"); } return; } const int nx = x.length (), ny = y.length (); @@ -730,11 +749,11 @@ row++; if (nrows == row) { #ifdef STANDALONE - $save_ascii_data_function (file, data, "MTT_data"); + $save_ascii_data_function (file, data, "mtt_data"); // std::cout << data << std::endl; #else // ! STANDALONE set_global_value ("MTT_data", data); #endif row = 0;