Differences From Artifact [31e14f0322]:

To Artifact [afdc04838c]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$



## Revision 1.278  2000/11/07 16:39:21  peterg
## *** empty log message ***
##
## Revision 1.277  2000/10/17 09:54:07  peterg
## logic rep sorted out
##
## Revision 1.276  2000/10/15 09:30:31  peterg







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (C) 2000 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.279  2000/11/08 09:51:52  peterg
## Started incorporating Geraints CC/oct conversions
##
## Revision 1.278  2000/11/07 16:39:21  peterg
## *** empty log message ***
##
## Revision 1.277  2000/10/17 09:54:07  peterg
## logic rep sorted out
##
## Revision 1.276  2000/10/15 09:30:31  peterg
1061
1062
1063
1064
1065
1066
1067


1068
1069
1070
1071
1072
1073
1074
1075
                stdin=stdin;;
	-sub )  mtt_switches="$mtt_switches $1 $2";
                sub='-sub'; 
                subsystem="_"$2;
                shift;;
	-oct )
                mtt_switches="$mtt_switches $1";


                m='oct';;
	-opt )  mtt_switches="$mtt_switches $1";
                optimise='-optimise';;
	-partition ) mtt_switches="$mtt_switches $1";
                     partition='-partition';;
	-viewlevel )  mtt_switches="$mtt_switches $1 $2";
                      viewlevel=$2;
                      shift;;







>
>
|







1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
                stdin=stdin;;
	-sub )  mtt_switches="$mtt_switches $1 $2";
                sub='-sub'; 
                subsystem="_"$2;
                shift;;
	-oct )
                mtt_switches="$mtt_switches $1";
                using_oct=yes;
                m=oct
                ;;
	-opt )  mtt_switches="$mtt_switches $1";
                optimise='-optimise';;
	-partition ) mtt_switches="$mtt_switches $1";
                     partition='-partition';;
	-viewlevel )  mtt_switches="$mtt_switches $1 $2";
                      viewlevel=$2;
                      shift;;
1266
1267
1268
1269
1270
1271
1272









1273
1274
1275
1276
1277
1278
1279
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps
  rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps
  rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc
  rm -f *_rep.tex
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt *_ode2odes.out 
  rm -f *_*_write.r *_simpar.m *_simpar.p









  rm -fR *_rep MTT_work
  exit
fi

# Clean up named system
if [ "$2" = "Clean" ] && [ "$3" = "" ]; then
  echo 'Removing all generated files for system ' $1







>
>
>
>
>
>
>
>
>







1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
  rm -f *_odes.c *_odes.dat *_odes.gdat *_odes.m *_odes.ps
  rm -f *_odeso.dat *_odeso.gdat *_odeso.sdat *_odeso.m *_odeso.ps
  rm -f *_*.doc *_*.idx *_*.ind *_*.ilg *_*.dvi *_*.aux *_*.lof *_*.toc
  rm -f *_rep.tex
  rm -f  *_unique_raw_list *_raw_list
  rm -f mtt_error.txt mtt_info.txt *_ode2odes.out 
  rm -f *_*_write.r *_simpar.m *_simpar.p
  rm -f *_cseo.oct *_input.oct *_simpar.oct *_smxax.oct
  rm -f *_csex.oct *_numpar.oct *_smxa.oct *_state.oct 
  rm -f *_ode.oct *_odeo.oct
  rm -f *_cseo.cc *_input.cc *_simpar.cc *_smxax.cc
  rm -f *_csex.cc *_numpar.cc *_smxa.cc *_state.cc 
  rm -f *_ode.cc *_odeo.cc
  rm -f *_logic.m *_logic.cc *_logic.oct
  rm -f *_state.m *_state.cc *_state.oct
  rm -f *_ode2odes.* *.dat2
  rm -fR *_rep MTT_work
  exit
fi

# Clean up named system
if [ "$2" = "Clean" ] && [ "$3" = "" ]; then
  echo 'Removing all generated files for system ' $1
1291
1292
1293
1294
1295
1296
1297









1298
1299
1300
1301
1302
1303
1304
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps
  rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps
  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out 
  rm -f $1_*_write.r $1_simpar.m $1_simpar.p









  rm -fR $1_rep MTT_work
  exit
fi

if [ "$2" = "rep" ]; then
     documenttype=article
      # See if we are making a book -- ie representation rep on a directory







>
>
>
>
>
>
>
>
>







1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
  rm -f $1_odes.c $1_odes.dat $1_odes.gdat $1_odes.sdat $1_odes.m $1_odes.ps
  rm -f $1_odeso.dat $1_odeso.gdat $1_odeso.m $1_odeso.ps
  rm -f $1_*.doc $1_*.idx $1_*.ind $1_*.ilg $1_*.dvi $1_*.aux $1_*.lof $1_*.toc
  rm -f $1_rep.tex
  rm -f $1_unique_raw_list $1_raw_list
  rm -f mtt_error.txt mtt_info.txt $1_ode2odes.out 
  rm -f $1_*_write.r $1_simpar.m $1_simpar.p
  rm -f $1_cseo.oct $1_input.oct $1_simpar.oct $1_smxax.oct
  rm -f $1_csex.oct $1_numpar.oct $1_smxa.oct $1_state.oct 
  rm -f $1_ode.oct $1_odeo.oct
  rm -f $1_cseo.cc $1_input.cc $1_simpar.cc $1_smxax.cc
  rm -f $1_csex.cc $1_numpar.cc $1_smxa.cc $1_state.cc 
  rm -f $1_ode.cc $1_odeo.cc
  rm -f $1_logic.m $1_logic.cc $1_logic.oct 
  rm -f $1_state.m $1_state.cc $1_state.oct
  rm -f $1_ode2odes.* $1.dat2
  rm -fR $1_rep MTT_work
  exit
fi

if [ "$2" = "rep" ]; then
     documenttype=article
      # See if we are making a book -- ie representation rep on a directory
1708
1709
1710
1711
1712
1713
1714

1715
1716

1717
1718
1719
1720

1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
$MAKE -S $verbose  -f  -  $target << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# MTT implicit rules
## .oct files

%.oct:  %.cc $1_def.h $1_sympar.h
	echo Creating $1_$2.oct; mkoctfile  $< 


## .cc files
#%.cc:  %.p
#	mtt_p2cc  $< 

%.cc:  %.m
	mtt_m2cc.sh  $1 $2 cat 

#Suffix rules
## .m files
##.SUFFIXES : .r .m
##.r.m:   $1_$2.r $1.def $1.sympar
##	mtt_r2m  $1 $2 


# Generates code to write reduce code
$1_ode_write.r: $1_def.m
	def2write_r  $1 $2

ifeq ("$sensitivity","sensitivity")
ifeq ("$level","0")







>


>


<
<
>


|
<
<
<
<
<
<







1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743


1744
1745
1746
1747






1748
1749
1750
1751
1752
1753
1754
$MAKE -S $verbose  -f  -  $target << EOF

# Cancel implicit rules I don't want
%.dvi: %.tex

# MTT implicit rules
## .oct files
ifneq ($2,ode2odes)
%.oct:  %.cc $1_def.h $1_sympar.h
	echo Creating $1_$2.oct; mkoctfile  $< 
endif

## .cc files


ifneq ($2,ode2odes)
%.cc:  %.m
	mtt_m2cc.sh  $1 $2 cat 
endif







# Generates code to write reduce code
$1_ode_write.r: $1_def.m
	def2write_r  $1 $2

ifeq ("$sensitivity","sensitivity")
ifeq ("$level","0")
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
	echo 'WMIN        = -1;         # Minimum frequency = 10^WMIN'; \
	echo 'WMAX        = 2;          # Maximum frequency = 10^WMAX'; \
	echo 'WSTEPS      = 100;        # Number of frequency steps'; \
	echo 'INPUT       = 1;          # Index of the input'; \
	)> $1_simpar.txt

#SUMMARY simpar	simulation information (m)
$1_simpar.m: $1_simpar.txt
	mtt_txt2m $1 simpar


#SUMMARY numpar	numerical parameter declaration -- default (txt) 
$1_numpar.txt : FORCE
	mtt -q $1 sympar txt
	mtt -q $1 def r







|







1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
	echo 'WMIN        = -1;         # Minimum frequency = 10^WMIN'; \
	echo 'WMAX        = 2;          # Maximum frequency = 10^WMAX'; \
	echo 'WSTEPS      = 100;        # Number of frequency steps'; \
	echo 'INPUT       = 1;          # Index of the input'; \
	)> $1_simpar.txt

#SUMMARY simpar	simulation information (m)
$1_simpar.m: $1_simpar.txt $1_def.r $1_sympar.txt
	mtt_txt2m $1 simpar


#SUMMARY numpar	numerical parameter declaration -- default (txt) 
$1_numpar.txt : FORCE
	mtt -q $1 sympar txt
	mtt -q $1 def r
1988
1989
1990
1991
1992
1993
1994

1995
1996
1997
1998
1999
2000
2001
	mtt_update $1 input update
else
	mtt_update $1 input
endif

#SUMMARY logic	Dynamic switch logic (txt)
$1_logic.txt : FORCE

	mtt -q $1 struc txt
	mtt -q $1 sympar txt
ifeq ($target,$1_logic.txt)
	mtt_update $1 logic update
else
	mtt_update $1 logic
endif







>







2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
	mtt_update $1 input update
else
	mtt_update $1 input
endif

#SUMMARY logic	Dynamic switch logic (txt)
$1_logic.txt : FORCE
	mtt -q $1 def r
	mtt -q $1 struc txt
	mtt -q $1 sympar txt
ifeq ($target,$1_logic.txt)
	mtt_update $1 logic update
else
	mtt_update $1 logic
endif
2304
2305
2306
2307
2308
2309
2310
2311

2312
2313










2314





2315

2316
2317
2318
2319








2320







2321
2322
2323
2324
2325
2326
2327
#$1_ode.c: $1_def.r $1_ode.r $1_sympar.r $1_sympar.c
#	ode_r2c $1 
$1_ode.tex: $1_ode.r  $1_sympar.r $1_simp.r
	ode_r2tex $1; latex_tidy $1_ode.tex

# The main simulation programme
ifeq ($integration_method,implicit)
$1_ode2odes.m : $1_def.r $1_sympars.txt $1_smxa.$m $1_smxax.$m\

		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_csex.$m $1_cseo.$m  $1_logic.m










	make_ode2odes $1 $integration_method





endif

ifeq ($integration_method,euler)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_ode.$m $1_odeo.$m  $1_logic.m








	make_ode2odes $1 $integration_method







endif


#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 







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

>



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







2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
#$1_ode.c: $1_def.r $1_ode.r $1_sympar.r $1_sympar.c
#	ode_r2c $1 
$1_ode.tex: $1_ode.r  $1_sympar.r $1_simp.r
	ode_r2tex $1; latex_tidy $1_ode.tex

# The main simulation programme
ifeq ($integration_method,implicit)
$1_ode2odes.m : $1_def.r $1_sympars.txt \
                $1_smxa.m $1_smxax.m\
                $1_simpar.m $1_numpar.m $1_state.m $1_input.m \
                $1_csex.m $1_cseo.m  $1_logic.m
ifeq ($using_oct,yes)
	mtt $mtt_switches -q -u $1 smxa oct
	mtt $mtt_switches -q -u $1 smxax oct
	mtt $mtt_switches -q -u $1 simpar oct
	mtt $mtt_switches -q -u $1 numpar oct
	mtt $mtt_switches -q -u $1 state oct
	mtt $mtt_switches -q -u $1 input oct
	mtt $mtt_switches -q -u $1 csex oct
	mtt $mtt_switches -q -u $1 cseo oct
	mtt $mtt_switches -q -u $1 logic oct
	make_ode2odes $1 cc $integration_method
	echo Creating $1_ode2odes.oct
	mkoctfile $1_ode2odes.cc
	touch $1_ode2odes.m # Create a dummy which wont' be used
else
	make_ode2odes $1 m $integration_method
endif
endif
ifeq ($integration_method,euler)
$1_ode2odes.m : $1_def.r $1_sympars.txt\
		$1_simpar.m $1_numpar.m $1_state.m $1_input.m \
		$1_ode.m $1_odeo.m  $1_logic.m
ifeq ($using_oct,yes)
	mtt $mtt_switches -q -u $1 simpar oct
	mtt $mtt_switches -q -u $1 numpar oct
	mtt $mtt_switches -q -u $1 state oct
	mtt $mtt_switches -q -u $1 input oct
	mtt $mtt_switches -q -u $1 ode oct
	mtt $mtt_switches -q -u $1 odeo oct
	mtt $mtt_switches -q -u $1 logic oct
	make_ode2odes $1 cc $integration_method
	echo Creating $1_ode2odes.oct
	mkoctfile $1_ode2odes.cc
	touch $1_ode2odes.m # Create a dummy which wont' be used
else
	make_ode2odes $1 m $integration_method
endif

endif


#Conversion of m to p to c
#SUMMARY ode	ordinary differential equations (c)
#SUMMARY ode	ordinary differential equations (p)
#SUMMARY state	state declaration (c) 
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387

$1_ode2odes.c: $1_ode2odes.p 
	mtt_p2c $info_switch $1 ode2odes

#SUMMARY sim Octave simulation function (m)

ifeq ($computation,octave)
$1_sim.m: $1_def.r $1_sympar.txt $1_cse.$m $1_cseo.$m $1_smxa.$m $1_smxax.$m $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
endif

ifeq ($computation,c)
$1_sim.m: $1_def.r $1_sympar.txt $1_ode2odes.out $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
endif







|







2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438

$1_ode2odes.c: $1_ode2odes.p 
	mtt_p2c $info_switch $1 ode2odes

#SUMMARY sim Octave simulation function (m)

ifeq ($computation,octave)
$1_sim.m: $1_def.r $1_sympar.txt $1_cse.m $1_cseo.m $1_smxa.m $1_smxax.m $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
endif

ifeq ($computation,c)
$1_sim.m: $1_def.r $1_sympar.txt $1_ode2odes.out $1_numpar.m $1_state.m
	mtt_make_sim $1 $integration_method $computation 
endif
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
	m2dat $1_sro
1_odes.c: $1_ode.c $1_def.r $1_sympar.r
	ode2odes_r2c $1 
$1_sms.c: $1_sm.c $1_def.r $1_sympar.r
	sm2sms_r2c $1

ifeq ($computation,octave)
$1_odes.dat2: $1_ode2odes.m $1_ode.m $1_odeo.m $1_numpar.m $1_logic.m  \
	     $1_def.m $1_input.m $1_state.m $1_simpar.m
	time octave_ode2odes $1
endif

ifeq ($computation,c)
$1_ode2odes.out: $1_ode2odes.c
	echo Creating $1_odes.out
	$CC $1_ode2odes.c -lp2c -lm -o $1_ode2odes.out







|
<







2712
2713
2714
2715
2716
2717
2718
2719

2720
2721
2722
2723
2724
2725
2726
	m2dat $1_sro
1_odes.c: $1_ode.c $1_def.r $1_sympar.r
	ode2odes_r2c $1 
$1_sms.c: $1_sm.c $1_def.r $1_sympar.r
	sm2sms_r2c $1

ifeq ($computation,octave)
$1_odes.dat2: $1_ode2odes.m

	time octave_ode2odes $1
endif

ifeq ($computation,c)
$1_ode2odes.out: $1_ode2odes.c
	echo Creating $1_odes.out
	$CC $1_ode2odes.c -lp2c -lm -o $1_ode2odes.out
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707

$1_odes.dat2: $1_sim.exe 
	echo Creating $1_odes.dat2 using cc version $ARGS
	    time ./$1_sim.exe $ARGS >$1_odes.dat2
endif


$1_odeso.m: $1_odes.m
	touch $1_odeso.m
$1_smso.m: $1_sms.m
	touch $1_smso.m
$1_daes.m: $1_dae.m $1_numpar.m  $1_def.m $1_input.m $1_simpar.m
	dae2daes_m $1 '$ARGS'
$1_daeso.m: $1_daes.m
	touch $1_daeso.m


#Conversion of data files from dat to sdat format
$1_odeso.sdat: $1_odeso.dat $1_struc.txt
	odeso_dat2sdat $1

$1_odes.sdat: $1_odes.dat $1_struc.txt







|
|
|
|
|
|
|
|







2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757

$1_odes.dat2: $1_sim.exe 
	echo Creating $1_odes.dat2 using cc version $ARGS
	    time ./$1_sim.exe $ARGS >$1_odes.dat2
endif


#$1_odeso.m: $1_odes.m
#	touch $1_odeso.m
#$1_smso.m: $1_sms.m
#	touch $1_smso.m
#$1_daes.m: $1_dae.m $1_numpar.m  $1_def.m $1_input.m $1_simpar.m
#	dae2daes_m $1 '$ARGS'
#$1_daeso.m: $1_daes.m
#	touch $1_daeso.m


#Conversion of data files from dat to sdat format
$1_odeso.sdat: $1_odeso.dat $1_struc.txt
	odeso_dat2sdat $1

$1_odes.sdat: $1_odes.dat $1_struc.txt
2827
2828
2829
2830
2831
2832
2833

2834
2835

2836
2837
2838
2839
2840
2841
2842
	gdat2fig $1_$2
endif
else
$1_$2.ps: $1_$2.gdat
	gdat2ps $1_$2  '$ARGS'
endif
$1_$2.ps: $1_$2.fig

	fig2dev -Leps $1_$2.fig> $1_$2.ps
$1_$2.pdf: $1_$2.fig

	fig2dev -Lpdf $1_$2.fig> $1_$2.pdf

endif

ifeq ($REPTYPE,tex)
#Create PostScript version of dvi file
$1_$2.ps: $1_$2.dvi







>


>







2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
	gdat2fig $1_$2
endif
else
$1_$2.ps: $1_$2.gdat
	gdat2ps $1_$2  '$ARGS'
endif
$1_$2.ps: $1_$2.fig
	echo Creating $1_$2.ps
	fig2dev -Leps $1_$2.fig> $1_$2.ps
$1_$2.pdf: $1_$2.fig
	echo Creating $1_$2.pdf
	fig2dev -Lpdf $1_$2.fig> $1_$2.pdf

endif

ifeq ($REPTYPE,tex)
#Create PostScript version of dvi file
$1_$2.ps: $1_$2.dvi
2947
2948
2949
2950
2951
2952
2953
2954
2955
    echo Finishing mtt  $mtt_switches  $1 $2 $3 $4 at level $level
fi

if [ "$make_status" != "0" ]; then
    echo Exiting MTT with error $make_status
    exit 1
fi









<
<
2999
3000
3001
3002
3003
3004
3005


    echo Finishing mtt  $mtt_switches  $1 $2 $3 $4 at level $level
fi

if [ "$make_status" != "0" ]; then
    echo Exiting MTT with error $make_status
    exit 1
fi



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