Index: mttroot/mtt/bin/mtt ================================================================== --- mttroot/mtt/bin/mtt +++ mttroot/mtt/bin/mtt @@ -15,10 +15,13 @@ ############################################################### ## Version control history ############################################################### ## $Header$ ## $Log$ +## Revision 1.343 2002/05/10 14:07:16 geraint +## Preserve .cc files. +## ## Revision 1.342 2002/05/10 13:24:58 geraint ## Added initial support for building Simulink S-functions. ## Rates do not update properly yet. ## Inertial switches do not work yet. ## Implicit integration not supported yet. @@ -2136,16 +2139,17 @@ %.dvi: %.tex # MTT implicit rules ## .oct files $1_%.oct: $1_%.cc $1_def.h $1_sympar.h $1_cr.h - echo Creating $1_\$*.oct; $MKOCTFILE -DCODEGENTARGET=OCTAVEDLD $1_\$*.cc + echo Creating $1_\$*.oct; $MKOCTFILE ${MTT_CXXINCS} -DCODEGENTARGET=OCTAVEDLD $1_\$*.cc .PRECIOUS: mtt_%.oct +.PRECIOUS: $1_%.oct mtt_%.oct: mtt_%.cc echo Compiling \$< - ${MKOCTFILE} -DCODEGENTARGET=OCTAVEDLD $define_octave_dev \$< + ${MKOCTFILE} ${MTT_CXXINCS} -DCODEGENTARGET=OCTAVEDLD $define_octave_dev \$< ## .mex files $1_%.mexglx: $1_%.cc $1_def.h $1_sympar.h $1_cr.h mtt_kpathsea.cc mtt_matlab_octave.cc mtt_matlab_octave.hh echo Creating $1_\$*.mexglx ${MTT_CXX} -shared -o $1_\$*.mexglx $1_\$*.cc \ @@ -2808,11 +2812,11 @@ ${MTT_CXX} ${MTT_CXXFLAGS} ${MTT_CXXINCS} -c $1_ode2odes.cc -DCODEGENTARGET=STANDALONE $1_ode2odes.oct: $1_ode2odes.cc $1_ode2odes_common_oct.stamp $1_ode2odes_${integration_method}_oct.stamp $1_ode2odes_${algebraic_solver}.o touch $1_ode2odes.m echo Creating $1_ode2odes.oct - $MKOCTFILE -DCODEGENTARGET=OCTAVEDLD $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc mtt_AlgebraicSolver.cc + $MKOCTFILE ${MTT_CXXINCS} -DCODEGENTARGET=OCTAVEDLD $1_ode2odes.cc mtt_${algebraic_solver}.cc mtt_Solver.cc mtt_AlgebraicSolver.cc $1_ode2odes.mexglx: $1_ode2odes.cc $1_ode2odes_common.o $1_ode2odes_${integration_method}.o $1_ode2odes_${algebraic_solver}.o touch $1_ode2odes.m echo Creating $1_ode2odes.mexglx ${MTT_CXX} -DCODEGENTARGET=MATLABMEX -o $1_ode2odes.mexglx $1_ode2odes.cc \ 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.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 ## Tidied up ode2odes code - reduced interweaving of STANDALONE/OCTAVEDLD sections ## ## Revision 1.75 2002/05/07 13:48:42 geraint ## Improved clarity of code generated for -cc and -oct (except ode2odes). @@ -1000,12 +1004,12 @@ void ${sys}_ode2odes (ColumnVector &state0, ColumnVector &numpar, ColumnVector &simpar) { static double first, dt, last, stepfactor; first = simpar (0); - dt = simpar (1); - last = simpar (2); + last = simpar (1); + dt = simpar (2); stepfactor = simpar (3); static ColumnVector dx (MTTNX, 0.0); static ColumnVector x (MTTNX, 0.0); static ColumnVector u (MTTNU, 0.0); @@ -1155,10 +1159,12 @@ ${sys}_ode2odes (state0, numpar, simpar); return 0; } #elif (CODEGENTARGET == OCTAVEDLD) +#include + DEFUN_DLD (${sys}_ode2odes, args, , "Octave ode2odes representation of system with $method integration method\nUsage: mtt_data = ${sys}_ode2odes (state0, numpar, simpar)\n") { static octave_value_list retval; @@ -1168,11 +1174,11 @@ int nargin = args.length (); switch (nargin) { case 3: - simpar = args(2).${vector_value} (); + simpar = mtt_simpar (args(2).map_value ()); numpar = args(1).${vector_value} (); state0 = args(0).${vector_value} (); break; case 2: simpar = mtt_simpar (); 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.48 2002/05/08 14:51:03 geraint +## Moved matlab/octave data type conversion functions to a separate file. +## ## Revision 1.47 2002/05/07 23:50:34 geraint ## Preliminary support for Matlab dynamically linked shared objects: ## invoke with: mtt -cc sys rep mexglx ## ode2odes support is not yet included. ## @@ -322,11 +325,13 @@ ;; simpar) states=no; inputs=no; parameters=no; - output='mttsimpar' + output='mttsimpar' + oct_rep_include="#include " + oct_return_type="mtt_simpar" ;; sm) states=no; inputs=no; parameters=yes; @@ -864,21 +869,23 @@ { func=${1:-""} args=${2:-""} cat < +#include + +static ColumnVector +mtt_simpar (Octave_map simpar) +{ + static ColumnVector retval (8); + + retval (0) = simpar ["first" ].double_value (); + retval (1) = simpar ["last" ].double_value (); + retval (2) = simpar ["dt" ].double_value (); + retval (3) = simpar ["stepfactor"].double_value (); + retval (4) = simpar ["wmin" ].double_value (); + retval (5) = simpar ["wmax" ].double_value (); + retval (6) = simpar ["wsteps" ].double_value (); + retval (7) = simpar ["input" ].double_value (); + + return retval; +} + +static Octave_map +mtt_simpar (ColumnVector simpar) +{ + static Octave_map retval; + + retval ["first" ] = simpar (0); + retval ["last" ] = simpar (1); + retval ["dt" ] = simpar (2); + retval ["stepfactor"] = simpar (3); + retval ["wmin" ] = simpar (4); + retval ["wmax" ] = simpar (5); + retval ["wsteps" ] = simpar (6); + retval ["input" ] = simpar (7); + + return retval; +}