Differences From Artifact [ad9199f7e0]:

To Artifact [7b0000767e]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.2  1998/06/21 10:40:58  peterg
## Added fsolve error message.
##
## Revision 1.1  1998/05/23 16:17:14  peterg
## Initial revision
##
###############################################################

# Set up the language specific stuff
language=$2

case $language in
    m)
	ext='m';
	codegenerator='FORTRAN'
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;
    c)
	ext='c';







>
>
>














|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3  1998/07/19 16:22:29  peterg
## Changed header to inculde mttu
##
## Revision 1.2  1998/06/21 10:40:58  peterg
## Added fsolve error message.
##
## Revision 1.1  1998/05/23 16:17:14  peterg
## Initial revision
##
###############################################################

# Set up the language specific stuff
language=$2

case $language in
    m)
	ext='m';
	codegenerator='PASCAL'
	Lc='#';
	Rc='#';
	Lb='(';
	Rb=')';
	;;
    c)
	ext='c';
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87


88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131


# Remove the old log file
rm -f ode_r2lang.log

#Remove the temporary files
rm -f $1_ode.$ext.1
rm -f $1_odea.$ext.1;
rm -f $1_odeo.$ext.1;

# Use reduce to accomplish the transformation
$SYMBOLIC >ode_r2lang.log << EOF

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  ODE   file
in "$1_ode.r";


% Set up the code generator
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 40;



% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
in "$1_sympar.r";

% The body of the ode function
  GENTRANOUT "$1_ode.$ext.1";
  mtt_matrix := MTTdX$
  mtt_matrix_n := MTTNx$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTdX$
  lang_matrix(); 
  GENTRANSHUT "$1_ode.$ext.1";
  
% The algebraic equations (if any)
  GENTRANOUT "$1_odea.$ext.1";
  mtt_matrix := MTTYz$
  mtt_matrix_n := MTTNYz$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTYz$
  lang_matrix(); 
  GENTRANSHUT "$1_odea.$ext.1";


% Now do the y = g(x,t) function.
% The body of the odeo function
  GENTRANOUT "$1_odeo.$ext.1";
  mtt_matrix := MTTy$
  mtt_matrix_n := MTTNy$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTy$
  lang_matrix(); 
  GENTRANSHUT "$1_odeo.$ext.1";

EOF

# Create the ode.$ext function
lang_header $1 ode $ext 'mttx,mttu,t' mttdx > $1_ode.$ext








|
|


|













|
>
>















|
|








|










|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136


# Remove the old log file
rm -f ode_r2lang.log

#Remove the temporary files
rm -f $1_ode.$ext.1
rm -f $1_odea.$ext.1
rm -f $1_odeo.$ext.1

# Use reduce to accomplish the transformation
$SYMBOLIC  << EOF #>ode_r2lang.log

%Read the reduce definitions file
in "$1_def.r";

%Read the reduce  ODE   file
in "$1_ode.r";


% Set up the code generator
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG;
MAXEXPPRINTLEN!* := 80;
TEMPVARNUM!* := 1;
TEMPVARNAME!* := 'mtt_temp;

% Matrix output function
in"$MTTPATH/trans/lang_matrix.r";

%Set up the number of argument variables to zero in case the user has forgotten
MTTNVar := 0;

%Read the parameter file
in "$1_sympar.r";

% The body of the ode function
  GENTRANOUT "$1_ode.$ext.1";
  mtt_matrix := MTTdX$
  mtt_matrix_n := MTTNx$
  mtt_matrix_m := 1$
  mtt_matrix_name := 'MTTdX$
  lang_matrix()$ 
  GENTRANSHUT "$1_ode.$ext.1";
  
% The algebraic equations (if any)
  GENTRANOUT "$1_odea.$ext.1";
  mtt_matrix := MTTYz$
  mtt_matrix_n := MTTNYz$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTYz$
  lang_matrix()$ 
  GENTRANSHUT "$1_odea.$ext.1";


% Now do the y = g(x,t) function.
% The body of the odeo function
  GENTRANOUT "$1_odeo.$ext.1";
  mtt_matrix := MTTy$
  mtt_matrix_n := MTTNy$
  mtt_matrix_m := 1$
  mtt_matrix_name := MTTy$
  lang_matrix()$ 
  GENTRANSHUT "$1_odeo.$ext.1";

EOF

# Create the ode.$ext function
lang_header $1 ode $ext 'mttx,mttu,t' mttdx > $1_ode.$ext

226
227
228
229
230
231
232
233



234
235
236
237

cat <<EOF >> $1_odeo.$ext

% The output equations
EOF
sed 's/mtt_matrix/mtty/' $1_odeo.$ext.1 >> $1_odeo.$ext
















|
>
>
>




231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

cat <<EOF >> $1_odeo.$ext

% The output equations
EOF
sed 's/mtt_matrix/mtty/' $1_odeo.$ext.1 >> $1_odeo.$ext

# Convert from Pascal syntax to Octave syntax
mv $1_ode.m mtt_junk; mtt_p2m<mtt_junk > $1_ode.m
mv $1_odeo.m mtt_junk; mtt_p2m<mtt_junk > $1_odeo.m
mv $1_odea.m mtt_junk; mtt_p2m<mtt_junk > $1_odea.m





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