Overview
Comment:Done some more tidying up
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 0799d3a5dc7f674db82a2efd69fbd4f1d3f1d01192267965c0a8385d2be9fec9
User & Date: gawthrop@users.sourceforge.net on 1999-03-16 00:38:06
Other Links: branch diff | manifest | tags
Context
1999-03-28
21:29:40
Initial revision check-in: 09d6bbc48c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-03-16
00:38:06
Done some more tidying up check-in: 0799d3a5dc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-03-15
23:27:43
Modified generation of odes.dat2 data check-in: 85feb53ab5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_r2m from [29ff3bb11e] to [2a529a9b60].

12
13
14
15
16
17
18




19
20
21
22
23
24
25
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

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




## Revision 1.5  1998/08/13 16:25:07  peterg
## Removed some documentation form odeo.m
##
## Revision 1.4  1998/08/13 15:10:47  peterg
## Change temp var name to mtt_t1 etc
##
## Revision 1.3  1998/08/13 12:43:19  peterg







>
>
>
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (c) P.J.Gawthrop 1991, 1994, 1995, 1996, 1998

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.6  1999/03/15 07:29:25  peterg
## Fixed various obscure reduce bugs
## THIS NEEDS A MAJOR REWRITE!!!!
##
## Revision 1.5  1998/08/13 16:25:07  peterg
## Removed some documentation form odeo.m
##
## Revision 1.4  1998/08/13 15:10:47  peterg
## Change temp var name to mtt_t1 etc
##
## Revision 1.3  1998/08/13 12:43:19  peterg
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
codegenerator='PASCAL'
Lc='#';
Rc='#';
Lb='(';
Rb=')';

outfile=$1"_"$rep
echo $outfile
rm -fv $outfile.[123]
#Set up gentran
cat <<EOF >mtt_setreduce.r
% Set up the code generator
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG;







|
<







44
45
46
47
48
49
50
51

52
53
54
55
56
57
58
codegenerator='PASCAL'
Lc='#';
Rc='#';
Lb='(';
Rb=')';

outfile=$1"_"$rep


#Set up gentran
cat <<EOF >mtt_setreduce.r
% Set up the code generator
% Load the general translator package
LOAD GENTRAN;
GENTRANLANG!* := '$codegenerator;
ON GENTRANSEG;
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

#Remove the temporary files

if [ "$rep" = "ode" ]; then
  #echo Creating $1_odea.$ext
  outfileo=$outfile"o"
  echo Creating $outfileo.m
   rm ode odeo
  #rm -f $1_odea.$ext.1;

  #Header
  lang_header $1 $rep $ext 'mttx,mttu,t' mttdx > $1_ode.p
  lang_header $1 odeo $ext 'mttx,mttu,t' mtty > $1_odeo.p


  # Use reduce to accomplish the transformation
$SYMBOLIC  > mtt_r2m.log <<EOF
  %Set up the code generator
  in"mtt_setreduce.r";
      
  % The body of the ode function
    GENTRANOUT "ode";
    mtt_matrix := MTTdX$
    mtt_matrix_n := MTTNx$
    mtt_matrix_m := 1$
    lang_matrix();
    GENTRANSHUT "ode";
    
 
      % The body of the odeo function
     GENTRANOUT "odeo";
     mtt_matrix := MTTy$
     mtt_matrix_n := MTTNy$
     mtt_matrix_m := 1$
     lang_matrix(); 
     GENTRANSHUT "odeo";

END;;


EOF

     







|




|

>






|




|



|




|







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

#Remove the temporary files

if [ "$rep" = "ode" ]; then
  #echo Creating $1_odea.$ext
  outfileo=$outfile"o"
  echo Creating $outfileo.m

  #rm -f $1_odea.$ext.1;

  #Header
  lang_header $1 $rep $ext 'mttx,mttu,t' mttdx > $1_ode.p
  lang_header $1 odeo $ext 'mttx,mttu,t' mtty  > $1_odeo.p

rm -f mtt_ode mtt_odeo
  # Use reduce to accomplish the transformation
$SYMBOLIC  > mtt_r2m.log <<EOF
  %Set up the code generator
  in"mtt_setreduce.r";
      
  % The body of the ode function
    GENTRANOUT "mtt_ode";
    mtt_matrix := MTTdX$
    mtt_matrix_n := MTTNx$
    mtt_matrix_m := 1$
    lang_matrix();
    GENTRANSHUT "mtt_ode";
    
 
      % The body of the odeo function
     GENTRANOUT "mtt_odeo";
     mtt_matrix := MTTy$
     mtt_matrix_n := MTTNy$
     mtt_matrix_m := 1$
     lang_matrix(); 
     GENTRANSHUT "mtt_odeo";

END;;


EOF

     
195
196
197
198
199
200
201
202
203
204


205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
##    for i = 1:nyz
##      printf("  mttui%i = mttui$Lb%i$Rb;\n",i,i);
##    end;
##    printf("\n");
##  end;
##EOF

sed 's/mtt_matrix/mttdx/' <ode  >> $1_ode.p
sed 's/mtt_matrix/mtty/'  <odeo >> $1_odeo.p



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

fi
  
if [ "$rep" = "sm" ]||[ "$rep" = "dm" ]; then

if [ "$rep" = "sm" ]; then
   #Header
  lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd] > $outfile.A
  Symbols='a b c d'    
fi

if [ "$rep" = "dm" ]; then
   #Header
  lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd,mtte] > $outfile.A
  Symbols='a b c d e'    
fi

for Symbol in $Symbols; do
  rm -f $outfile.1









|
|

>
>

|
|
|







|





|







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
##    for i = 1:nyz
##      printf("  mttui%i = mttui$Lb%i$Rb;\n",i,i);
##    end;
##    printf("\n");
##  end;
##EOF

sed 's/mtt_matrix/mttdx/' <mtt_ode  >> $1_ode.p
sed 's/mtt_matrix/mtty/'  <mtt_odeo >> $1_odeo.p

rm -f mtt_odeo mtt_ode

# Convert from Pascal syntax to Octave syntax 
 mtt_p2m<$1_odeo.p > $1_odeo.m 

#rm -f    $1_odeo.p

fi
  
if [ "$rep" = "sm" ]||[ "$rep" = "dm" ]; then

if [ "$rep" = "sm" ]; then
   #Header
  lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd] > $outfile.p
  Symbols='a b c d'    
fi

if [ "$rep" = "dm" ]; then
   #Header
  lang_header $1 $rep $ext '' [mtta,mttb,mttc,mttd,mtte] > $outfile.p
  Symbols='a b c d e'    
fi

for Symbol in $Symbols; do
  rm -f $outfile.1


265
266
267
268
269
270
271





272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288

289
290

291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
    e)
	N=$NN; M=$NN
	;;
    *)
  esac
    
fi





    $SYMBOLIC  << EOF >mtt_r2m.log

    %Set up the code generator
    in"mtt_setreduce.r";

    out "$outfile.2";
     write "mtt$Symbol = zeros(", $N, ",", $M, ");";
    shut "$outfile.2";

    GENTRANOUT "$outfile.1";
    mtt_matrix := MTT$Symbol;
    mtt_matrix_n := $N;
    mtt_matrix_m := $M;
    lang_matrix();
    GENTRANSHUT "$outfile.1";
EOF


echo "%$Symbol matrix#" > $outfile.$Symbol
cat "$outfile.2"  >> $outfile.$Symbol

sed "s/mtt_matrix/mtt$Symbol/" < $outfile.1 |\
grep -v '=0\.0;'  >> $outfile.$Symbol

done


fi 

# Convert from Pascal syntax to Octave syntax
cat $outfile.?  | mtt_p2m > $outfile

#rm -f $outfile.?  
  
  
  











>
>
>
>
>
|



|
|
|
|









>
|
|
>

|







|

|
|
|





271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
    e)
	N=$NN; M=$NN
	;;
    *)
  esac
    
fi

# Set up the matrices

    rm -f mtt_zero.m

 $SYMBOLIC  << EOF >mtt_r2m.log

    %Set up the code generator
    in"mtt_setreduce.r";
    
   OUT "mtt_zero.m";
     write  "mtt$Symbol = zeros(", $N, ",", $M , ");" ;
  SHUT  "mtt_zero.m";

    GENTRANOUT "$outfile.1";
    mtt_matrix := MTT$Symbol;
    mtt_matrix_n := $N;
    mtt_matrix_m := $M;
    lang_matrix();
    GENTRANSHUT "$outfile.1";
EOF


echo "%$Symbol matrix#" >> $outfile.p
cat mtt_zero.m >> $outfile.p

sed "s/mtt_matrix/mtt$Symbol/" < $outfile.1 |\
grep -v '=0\.0;'  >> $outfile.p

done


fi 

# Convert from Pascal syntax to Octave syntax
 mtt_p2m <$outfile.p > $outfile.m

rm -f $outfile.p  
rm -f mtt_zero.m
rm -f $outfile.1  
  





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