Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 3106124b8d689ade72f0f9534e6817b954611e0ca187908ebb823052410a288e
User & Date: gawthrop@users.sourceforge.net on 1997-01-21 11:36:26
Other Links: branch diff | manifest | tags
Context
1997-01-21
13:16:40
Included transformations to language c for:
ode
params
numpar
check-in: b188abb216 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:36:26
Initial revision check-in: 3106124b8d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:59:20
Changed typo: symbolic --> numeric check-in: 03f1e4b18c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/sympar2numpar_r2c version [e999be1dc4].

















































































































1
2
3
4
5
6
7
8
9
10
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: sympar2numpar_r2m
# Creates the deafault numerical parameters file for the system

# Copyright (c) P.J.Gawthrop 1996

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

# Inform user
echo Creating $1_numpar.c

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

# Use reduce to accomplish the transformation
reduce >sympar2numpar_r2c.log 2>mtt_error.txt << EOF

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

%Read the symbolic parameters file
IN "$1_sympar.r";

OUT "$1_numpar1.c";

IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
      THEN 
      BEGIN
      % Do nowt
      END
      ELSE  
      BEGIN
        write "extern float ", MTTVar(i,1)$
      END;
END; 


IF MTTNvar>0 THEN
BEGIN
  FOR i := 1:MTTNvar DO
    IF numberp(MTTVar(i,1)) 
    THEN 
    BEGIN
     write "/* Variable ", i, " has already been set to ",   MTTVar(i,1), "*/";
    END
    ELSE
    BEGIN
      write MTTVar(i,1), "  = 1;	/* Default value */";
    END;
END;


SHUT "$1_numpar1.c";

EOF

matlab_tidy $1_numpar1.c

#Create the numpar file complete with headers.
echo "/*" > $1_numpar.c
echo "%% Numerical parameter file ($1_numpar.c)" >> $1_numpar.c
echo "%% Generated by MTT at `date`" >> $1_numpar.c
echo "*/" >> $1_numpar.c

echo "void $1_ode()"  >> $1_numpar.c
echo "{" >> $1_numpar.c

cat $1_numpar1.c >> $1_numpar.c

echo "/*" >> $1_numpar.c
echo '%% Input the user-defined parameters'  >> $1_numpar.c
echo "*/" >> $1_numpar.c

echo "$1_params;"   >> $1_numpar.c
echo "};" >> $1_numpar.c

rm $1_numpar1.c

# Now invoke the standard error handling.
mtt_error_r sympar2numpar_r2c.log




















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