11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
+
+
+
|
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.18 2001/10/05 23:37:32 geraint
## Fixed assignment statement in ae.r when RHS=0.
##
## Revision 1.17 2001/07/27 23:29:10 geraint
## Optimises only when requested (-opt).
##
## Revision 1.16 2001/07/13 04:54:04 geraint
## Branch merge: numerical-algebraic-solution back to main.
##
## Revision 1.15.2.4 2001/06/26 00:55:48 geraint
|
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
+
+
+
+
-
+
+
+
+
|
solve=0; solve_msg=''
optimise=''; optimise_msg=''
while [ -n "`echo $1 | grep '^-'`" ]; do
case $1 in
-A )
solve=1
solve_msg=' with explicit solution of algebraic equations' ;;
-fixcc )
fixcc=`echo 'in "'$MTT_LIB'/reduce/fix_c.r";'`
fix_msg='fixing c and cc code';
;;
-optimise)
optimise='-optimise'
optimise_msg=' with optimisation' ;;
*)
echo "$1 is an invalid argument - ignoring" ;;
esac
shift
done
# Create the reduce output code
def2write_r $optimise $1 cse
def2write_r $optimise $1 csex # Version without E matrix
def2write_r $optimise $1 cseo
echo "Creating $1_cse.r $solve_msg $optimise_msg"
echo "Creating $1_cse.r $solve_msg $optimise_msg $fix_msg"
echo "Creating $1_csex.r $optimise_msg"
echo "Creating $1_cseo.r $optimise_msg"
# Remove the old log file
rm -f dae2cse_r.log
# Remove some files
rm -f $1_cse.r? $1_cseo.r?
# Use reduce to accomplish the transformation
$SYMBOLIC >dae2cse_r.log << EOF
%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";
OFF Echo;
OFF Nat;
ON NERO;
%Fix c code if required
$fixcc
in "$1_def.r";
MTTdxs := MTTdX; %Save the symbolic form of dX
in "$1_subs.r";
in "$1_dae.r";
|