Index: mttroot/mtt/bin/trans/mtt_m2p ================================================================== --- mttroot/mtt/bin/trans/mtt_m2p +++ mttroot/mtt/bin/trans/mtt_m2p @@ -13,10 +13,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.45 2000/05/13 13:16:52 peterg +## Matrix initialisation for smxa +## ## Revision 1.44 2000/05/13 11:52:16 peterg ## A now matrix in smxa rep ## ## Revision 1.43 2000/05/11 19:35:16 peterg ## Major revisions for new paprameter passing versions @@ -261,14 +264,16 @@ echo " mttt : REAL;" echo " mttpar : ParameterVector);" ;; ode2odes) echo "PROGRAM $Sys_rep;" + echo "" echo "CONST" echo " MTT_MaxParameters = 100;" echo " MTT_Npar = $Npar;" echo " MTT_Nx = $Nx;" + echo "" echo "TYPE" echo " StateVector = ARRAY[1..$Nx] OF REAL;" echo " InputVector = ARRAY[1..$Nu] OF REAL;" echo " OutputVector = ARRAY[1..$Ny] OF REAL;" echo " ParameterVector = ARRAY[1..$Npar] OF REAL;" @@ -295,11 +300,12 @@ echo " mttnpar : INTEGER;" echo " AA : StateMatrix;" echo " MTTi,MTTj,it,iLast: INTEGER;" ##echo " mttSTEPFACTOR,mttWSTEPS,mttSTEPS,mttINPUT : INTEGER;" ## echo " mttMETHOD : IntegrationMethod;" - echo " open : StateVector;" + echo " open_switches : StateVector;" + echo " numparfile, statefile, simparfile : TEXT;" echo "" ;; switchopen) echo "PROCEDURE $Sys_rep(VAR open : StateVector; mttx : StateVector);" echo "VAR" @@ -324,11 +330,11 @@ mttfun_name=$name tab=' ' space="[ $tab]*" spaces="[ $tab][ $tab]*" non_space="[^ ]*" - args="[a-zA-Z0-9,.]*" + args='[a-zA-Z0-9,._"]*' # Body cat $Sys_rep.m |\ grep -v '^[ ]*function' |\ grep -v '^[ ]*endfunction' |\ @@ -382,20 +388,21 @@ else { if (doing_header==1){ if (rep=="ode2odes"){ printf("\n{%s $MTTPATH/trans/p/mtt_write.p}\n",inc) + printf("{%s $MTTPATH/trans/p/mtt_par_update.p}\n",inc) printf("{%s $MTTPATH/trans/p/sign.p}\n",inc) printf("{%s $MTTPATH/trans/p/mtt_euler.p}\n",inc) printf("{%s $MTTPATH/trans/p/mtt_solve.p}\n",inc) printf("{%s $MTTPATH/trans/p/mtt_implicit.p}\n",inc) # printf("{%s $MTTPATH/trans/p/zero_matrix.p}\n",inc) printf("{%s $MTTPATH/trans/p/zero_input.p}\n",inc) printf("{%s $MTTPATH/trans/p/zero_state.p}\n",inc) printf("{%s %s_simpar.p}\n",inc,Sys) printf("{%s %s_numpar.p}\n",inc,Sys) - printf("{%s $MTTPATH/trans/p/mtt_getargs.p}\n",inc) + # printf("{%s $MTTPATH/trans/p/mtt_getargs.p}\n",inc) printf("{%s %s_state.p}\n",inc,Sys) printf("{%s %s_input.p}\n",inc,Sys) if (Method=="euler") { printf("{%s %s_ode.p}\n",inc,Sys) printf("{%s %s_odeo.p}\n",inc,Sys) @@ -409,10 +416,12 @@ printf("{%s %s_switchopen.p}\n\n",inc,Sys) for (k=1;k<=j;k++) printf("%s\n", comment[k]) printf("\n") printf("\nBEGIN{%s}\n", Sys_rep) + printf(" open(statefile,\"%s_state.dat\");\n", Sys) + printf(" open(numparfile,\"%s_numpar.dat\");\n", Sys) } else{ for (k=1;k<=j;k++) printf("%s\n", comment[k]) printf("\n") printf("VAR \n"); @@ -498,14 +507,11 @@ sed 's/(\([0-9]*,MTT[ijk0-9]\))/\[\1\]/g' |\ sed 's/(\(MTT[ijk0-9],MTT[ijk0-9]\))/\[\1\]/g' |\ sed 's/(\(MTT[ijk0-9,]*\))/\[\1\]/g' |\ sed 's/switcha(mttAA,/switcha(/g' |\ sed 's/switch(MTTx,/switch(/g' |\ -sed 's/nargin<1/mttnpar<1/' |\ -sed 's/if nargin<2 THEN//' |\ -sed 's/nargin<3/mttnpar<1/' | \ -sed 's/if nargin<4/if mttnpar<1/' \ +sed 's/if nargin<[1-9] THEN//' \ >> $Filename # p2c doesn't like mixed case filenames! #if [ "$Filename" != "$filename" ]; then # echo Creating $filename