Differences From Artifact [89612cc630]:

To Artifact [674a5c4a87]:


1
2
3
4
5
6
7
8
9
10
11



12
13
14
15
16
17
18
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.87  2004/08/29 01:46:56  geraint
## Added rules to create ode2odes for sorted system: sesx and sesy.
##
## Revision 1.86  2004/08/29 00:19:49  geraint
## Defaults to noAlgebraicSolver.
##
## Revision 1.85  2003/06/25 12:46:06  gawthrop
## Input only changed one per print interval
## No effect if stepfactor=1
## Fixes bug when _input.m is compiled using -stdin option
371
372
373
374
375
376
377











378
379




380
381
382
383
384
385
386
387

388
389
390
391
392
393
394
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391


392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411







+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+








+







case "$method" in
    "implicit")
	ode=csex
	odeo=cseo
	algorithm="mtt_implicit(x,dx,AA,AAx,ddt,$Nx,open_switches)"
	;;
    "dassl")
	case "$sorted_equations" in
	    "make")		# used by sese generated by make
		ae=sae
		ode=sesx
		odeo=sesy
		;;
	    "seqn")		# shouldn't be here unless mtt has changed
		ode=sese
		odeo=sese
		;;
	    "no" | *)	
	ode=ode
	odeo=odeo
		ode=ode
		odeo=odeo
		;;
	esac
	algorithm="mtt_dassl(x,u,t,par,dx,ddt,MTTNX,MTTNYZ,open_switches)"
	;;
    "sorted_euler")		# used by sese generated from seqn
	algorithm="mtt_euler(x,dx,ddt,$Nx,open_switches)"
	;;
    "euler" | "rk4" | *)
	case "$sorted_equations" in
	    "make")		# used by sese generated by make
		ae=sae
		ode=sesx
		odeo=sesy
		;;
	    "seqn")		# shouldn't be here unless mtt has changed
		ode=sese
		odeo=sese
		;;
542
543
544
545
546
547
548
549

550
551
552
553
554
555
556
559
560
561
562
563
564
565

566
567
568
569
570
571
572
573







-
+







#include "${sys}_sympar.h"

#include "mtt_${algebraic_solver}.hh"

#include <fstream>
#if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))

extern ColumnVector ${sys}_ae (
extern ColumnVector ${sys}_${ae} (
	const ColumnVector &x,
	const ColumnVector &u,
	const double &t,
	const ColumnVector &par);

extern ColumnVector ${sys}_input (
	const ColumnVector &x,
646
647
648
649
650
651
652
653

654
655
656
657
658
659
660

661
662
663
664
665
666
667
663
664
665
666
667
668
669

670
671
672
673
674
675
676

677
678
679
680
681
682
683
684







-
+






-
+







ColumnVector
mtt_ae (const ColumnVector &x,
	const ColumnVector &u,
	const double &t,
	const ColumnVector &par)
{
#if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))
    return ${sys}_ae(x,u,t,par);
    return ${sys}_${ae}(x,u,t,par);
#elif (CODEGENTARGET == OCTAVEDLD)
    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);
    f = feval ("${sys}_${ae}", args, 1);
    return f(0).${vector_value} ();
#endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))
}

inline ColumnVector
mtt_input (const ColumnVector &x,
	   const ColumnVector &y,
938
939
940
941
942
943
944
945

946
947
948
949

950
951
952
953
954
955
956
955
956
957
958
959
960
961

962
963
964
965

966
967
968
969
970
971
972
973







-
+



-
+








    U.insert (u,0);
    if (MTTNYZ > 0)
      U.insert (ui,MTTNU);

#if ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))
    dx = ${sys}_${ode} (x,U,t,par);
    yz = ${sys}_ae (x,U,t,par);
    yz = ${sys}_${ae} (x,U,t,par);
#elif (CODEGENTARGET == OCTAVEDLD)
    new_args(1) = octave_value (U);
    dx = feval ("${sys}_${ode}", new_args, 1)(0).${vector_value} ();
    yz = feval ("${sys}_ae", new_args, 1)(0).${vector_value} ();
    yz = feval ("${sys}_${ae}", new_args, 1)(0).${vector_value} ();
#endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))

    for (register int i = 0; i < MTTNX; i++)
      residual (i) = dx(i) - DX(i);
    
    if (MTTNYZ > 0)
      {

MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]