Overview
Comment:Uses sys_sae instead of sys_ae if sorted equations are being used.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 2094598ac5729157a3a917dd6213f388f3c59effdba5274628c5e6a029ce42ca
User & Date: geraint@users.sourceforge.net on 2004-08-29 13:15:28
Other Links: branch diff | manifest | tags
Context
2004-08-29
13:17:30
Added rules to use sae (sorted algebraic equations) instead
of ae if sorted equations are being used.

Converted temporary variable names to lowercase in sorted
sympar.h to match code output from mtt_r2m. check-in: a9bb0711f0 user: geraint@users.sourceforge.net tags: origin/master, trunk

13:15:28
Uses sys_sae instead of sys_ae if sorted equations are being used. check-in: 2094598ac5 user: geraint@users.sourceforge.net tags: origin/master, trunk
13:14:29
Added rule to make header for sae (sorted algebraic equations). check-in: 65bc3f5c5c user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/make_ode2odes from [89612cc630] to [674a5c4a87].

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.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











>
>
>







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
case "$method" in
    "implicit")
	ode=csex
	odeo=cseo
	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")		# 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

		ode=sesx
		odeo=sesy
		;;
	    "seqn")		# shouldn't be here unless mtt has changed
		ode=sese
		odeo=sese
		;;







>
>
>
>
>
>
>
>
>
>
>
|
|
>
>








>







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
		;;
	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
#include "${sys}_sympar.h"

#include "mtt_${algebraic_solver}.hh"

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

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

extern ColumnVector ${sys}_input (
	const ColumnVector &x,







|







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} (
	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
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);
#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);
    return f(0).${vector_value} ();
#endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))
}

inline ColumnVector
mtt_input (const ColumnVector &x,
	   const ColumnVector &y,







|






|







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);
#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);
    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

    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);
#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} ();
#endif // ((CODEGENTARGET == STANDALONE) || (CODEGENTARGET == MATLABMEX))

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







|



|







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);
#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} ();
#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 ]