Differences From Artifact [2a9d7b1d9e]:
- Executable file mttroot/mtt/bin/trans/make_ode2odes — part of check-in [8a9a232544] at 2002-08-07 14:27:14 on branch origin/master — Changes to make "-i dassl" work again. (user: geraint@users.sourceforge.net, size: 35571) [annotate] [blame] [check-ins using] [more...]
To Artifact [2efe87b571]:
- Executable file
mttroot/mtt/bin/trans/make_ode2odes
— part of check-in
[773822c9b4]
at
2003-04-17 20:57:29
on branch origin/master
— Added -sort option to allow direct generation of ode2odes.m using sese.m
instead of ode/csex."mtt -sort rc odeso view" works without Reduce installed!!! (user: geraint@users.sourceforge.net, size: 36050) [annotate] [blame] [check-ins using] [more...]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.82 2002/07/24 14:00:12 geraint
## Corrected arguments passed to mtt_write when dumping data (sigint).
##
## Revision 1.81 2002/07/11 13:00:23 geraint
## Declared more function arguments to be "const" - improves compiler optimisation.
##
## Revision 1.80 2002/05/22 09:35:49 geraint
| > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.83 2002/08/07 14:27:14 geraint
## Changes to make "-i dassl" work again.
##
## Revision 1.82 2002/07/24 14:00:12 geraint
## Corrected arguments passed to mtt_write when dumping data (sigint).
##
## Revision 1.81 2002/07/11 13:00:23 geraint
## Declared more function arguments to be "const" - improves compiler optimisation.
##
## Revision 1.80 2002/05/22 09:35:49 geraint
|
| ︙ | ︙ | |||
351 352 353 354 355 356 357 358 359 360 361 362 363 364 |
algorithm="mtt_implicit(x,dx,AA,AAx,ddt,$Nx,open_switches)"
;;
"dassl")
ode=ode
odeo=odeo
algorithm="mtt_dassl(x,u,t,par,dx,ddt,MTTNX,MTTNYZ,open_switches)"
;;
"euler" | "rk4" | *)
ode=ode
odeo=odeo
algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)"
;;
esac
| > > > | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
algorithm="mtt_implicit(x,dx,AA,AAx,ddt,$Nx,open_switches)"
;;
"dassl")
ode=ode
odeo=odeo
algorithm="mtt_dassl(x,u,t,par,dx,ddt,MTTNX,MTTNYZ,open_switches)"
;;
"sorted_euler")
algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)"
;;
"euler" | "rk4" | *)
ode=ode
odeo=odeo
algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)"
;;
esac
|
| ︙ | ︙ | |||
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
for MTTi=1:$Ny
y(MTTi) = 0;
endfor;
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,simpar.first); # Write it out
endif
EOF
if [ "$method" = "rk4" ]; then
cat << EOF >> $filename
[k1] = ddt * ${sys}_${ode}(x,u,t,par);
[k2] = ddt * ${sys}_${ode}(x+k1/2,u,t+ddt/2,par);
[k3] = ddt * ${sys}_${ode}(x+k2/2,u,t+ddt/2,par);
[k4] = ddt * ${sys}_${ode}(x+k3,u,t+ddt,par);
[dx] = [k1 + 2.0 * [k2 + k3] + k4] / (6.0 * ddt);
EOF
else
cat << EOF >> $filename
[dx] = ${sys}_$ode(x,u,t,par); # State derivative
EOF
fi
if [ "$method" = "implicit" ]; then
| > > > > > > > > > > > > > > > | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
for MTTi=1:$Ny
y(MTTi) = 0;
endfor;
mttj = 0;
for it = 1:ilast #Integration loop
[u] = ${sys}_input(x,y,t,par); # Input
EOF
if [ "$method" = "sorted_euler" ]; then
cat <<EOF >> $filename
[dx,y] = ${sys}_sese(x,u,t,par); # Output
EOF
else
cat <<EOF >> $filename
[y] = ${sys}_$odeo(x,u,t,par); # Output
EOF
fi
cat <<EOF >> $filename
if mttj==0
mtt_write(t,x,y,$Nx,$Ny,simpar.first); # Write it out
endif
EOF
if [ "$method" = "rk4" ]; then
cat << EOF >> $filename
[k1] = ddt * ${sys}_${ode}(x,u,t,par);
[k2] = ddt * ${sys}_${ode}(x+k1/2,u,t+ddt/2,par);
[k3] = ddt * ${sys}_${ode}(x+k2/2,u,t+ddt/2,par);
[k4] = ddt * ${sys}_${ode}(x+k3,u,t+ddt,par);
[dx] = [k1 + 2.0 * [k2 + k3] + k4] / (6.0 * ddt);
EOF
elif [ "$method" = "sorted_euler" ]; then
cat <<EOF >> $filename
[dx,y] = ${sys}_sese(x,u,t,par); # State derivative and Output
EOF
else
cat << EOF >> $filename
[dx] = ${sys}_$ode(x,u,t,par); # State derivative
EOF
fi
if [ "$method" = "implicit" ]; then
|
| ︙ | ︙ |