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.80 2002/05/22 09:35:49 geraint +## Added insertor variable to stop sh-mode font-lock from getting hopelessly confused by embedded C++. +## ## Revision 1.79 2002/05/20 13:42:31 gawthrop ## Uses simpar.first for first printed output ## ## Revision 1.78 2002/05/11 01:14:17 geraint ## Fix for [ 553218 ] simpar.oct and simpar.m different. @@ -478,47 +481,47 @@ #include #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) extern ColumnVector ${sys}_ae ( - ColumnVector &x, - ColumnVector &u, + const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par); + const ColumnVector &par); extern ColumnVector ${sys}_input ( - ColumnVector &x, - ColumnVector &y, + const ColumnVector &x, + const ColumnVector &y, const double &t, - ColumnVector &par); + const ColumnVector &par); extern ColumnVector ${sys}_logic ( - ColumnVector &x, - ColumnVector &u, + const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par); + const ColumnVector &par); extern ColumnVector ${sys}_numpar ( void); extern ColumnVector ${sys}_simpar ( void); extern ColumnVector ${sys}_state ( - ColumnVector &par); + const ColumnVector &par); extern ColumnVector ${sys}_${ode} ( - ColumnVector &x, - ColumnVector &u, + const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par); + const ColumnVector &par); extern ColumnVector ${sys}_${odeo} ( - ColumnVector &x, - ColumnVector &u, + const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par); + const ColumnVector &par); EOF case "$method" in "implicit") cat <> $filename @@ -530,20 +533,20 @@ const double &ddt, const int &nx, const ColumnVector &open_switches); extern Matrix ${sys}_smxa ( - ColumnVector &x, - ColumnVector &u, + const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par); + const ColumnVector &par); extern ColumnVector ${sys}_smxax ( - ColumnVector &x, - ColumnVector &u, + const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par); + const ColumnVector &par); EOF ;; "dassl") cat <> $filename @@ -575,14 +578,14 @@ cat <> $filename #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) ColumnVector -mtt_ae (ColumnVector &x, - ColumnVector &u, +mtt_ae (const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par) + const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_ae(x,u,t,par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -594,14 +597,14 @@ return f(0).${vector_value} (); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } inline ColumnVector -mtt_input (ColumnVector &x, - ColumnVector &y, +mtt_input (const ColumnVector &x, + const ColumnVector &y, const double &t, - ColumnVector &par) + const ColumnVector &par) { static MTT::${algebraic_solver} ae(MTTNPAR,MTTNU,MTTNX,MTTNY,MTTNYZ); static ColumnVector u (MTTNU); #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) @@ -624,14 +627,14 @@ return ae.solve(x,u,t,par); } } inline ColumnVector -mtt_logic (ColumnVector &x, - ColumnVector &u, +mtt_logic (const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par) + const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_logic (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -667,11 +670,11 @@ return f(0).${vector_value} (); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } inline ColumnVector -mtt_state (ColumnVector &par) +mtt_state (const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_state (par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -680,14 +683,14 @@ return f(0).${vector_value} (); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } inline ColumnVector -mtt_rate (ColumnVector &x, - ColumnVector &u, +mtt_rate (const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par) + const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_${ode} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -699,14 +702,14 @@ return f(0).${vector_value} (); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } inline ColumnVector -mtt_output (ColumnVector &x, - ColumnVector &u, - const double &t, - ColumnVector &par) +mtt_output (const ColumnVector &x, + const ColumnVector &u, + const double &t, + const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_${odeo} (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -747,14 +750,14 @@ return f(0).${vector_value} (); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } inline Matrix -mtt_smxa (ColumnVector &x, - ColumnVector &u, +mtt_smxa (const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par) + const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_smxa (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -766,14 +769,14 @@ return f(0).matrix_value (); #endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) } inline ColumnVector -mtt_smxax (ColumnVector &x, - ColumnVector &u, +mtt_smxax (const ColumnVector &x, + const ColumnVector &u, const double &t, - ColumnVector &par) + const ColumnVector &par) { #if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX)) return ${sys}_smxax (x, u, t, par); #elif (CODEGENTARGET == OCTAVEDLD) static octave_value_list args, f; @@ -943,12 +946,12 @@ esac cat <> $filename inline void mtt_write (const double &t, - ColumnVector &x, - ColumnVector &y, + const ColumnVector &x, + const ColumnVector &y, const double &first, const int &nrows, const bool dump_data = false, std::ostream &file = std::cout) { @@ -1012,11 +1015,13 @@ fcputime.close(); } } void -${sys}_ode2odes (ColumnVector &state0, ColumnVector &numpar, ColumnVector &simpar) +${sys}_ode2odes (const ColumnVector &state0, + const ColumnVector &numpar, + const ColumnVector &simpar) { static double first, dt, last, stepfactor; first = simpar (0); last = simpar (1); dt = simpar (2); Index: mttroot/mtt/bin/trans/mtt_header ================================================================== --- mttroot/mtt/bin/trans/mtt_header +++ mttroot/mtt/bin/trans/mtt_header @@ -10,10 +10,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.53 2002/06/10 23:22:16 geraint +## Fixed problem with Matlab fsolve failing because of "user function returned Inf or Nan" (fsolve.m, line 245). +## ## Revision 1.52 2002/05/27 14:52:15 geraint ## Parameters in sfun reps are now declared using sympar.h at the top of the ## sfun*.c file instead of in individual functions. This causes the optimisation ## variables (mtt_tmp*) to be declared correctly without causing conflicts in the ## scope of parameter declarations. @@ -732,11 +735,11 @@ mtty) arg_type="ColumnVector" arg_init="(MTTNY,0.0)" ;; mttt) - arg_type="const double" + arg_type="double" arg_init="" ;; nil) arg_type="void *" arg_init="(0x0)" @@ -830,11 +833,11 @@ else comma="" fi w=`get_field ${args} ${i}` get_arg_specific_stuff ${w} - printf "\t${arg_type}\t&${w}${comma}\n" + printf "\tconst ${arg_type}\t&${w}${comma}\n" done fi get_arg_specific_stuff ${output} cat <