Overview
Comment: | Now uses the preprocessor to declare sizes -- MTTNX etc |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
4c470c69f9abab3b75464213bd86c613 |
User & Date: | gawthrop@users.sourceforge.net on 1997-05-06 13:53:32 |
Other Links: | branch diff | manifest | tags |
Context
1997-05-06
| ||
13:54:21 |
Changed gcc arguments for the ode simulation -- all files now included in the _odes.c file check-in: 9684c7989e user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
13:53:32 | Now uses the preprocessor to declare sizes -- MTTNX etc check-in: 4c470c69f9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
1997-05-03
| ||
15:50:18 |
c functions not included in gcc arg list -- they are now included in the main prog. check-in: 1dd5724366 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/ode2odes_r2c from [217ccfe04f] to [1103182db7].
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Copyright (c) P.J.Gawthrop 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.4 1997/05/01 13:43:44 peterg # Changed double to float. # # Revision 1.3 1997/05/01 11:15:33 peterg # Back under RCS # # Revision 1.2 1997/03/20 14:36:56 peterg | > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | # Copyright (c) P.J.Gawthrop 1997. ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ # Revision 1.5 1997/05/01 13:50:11 peterg # Replaced float by double. # # Revision 1.4 1997/05/01 13:43:44 peterg # Changed double to float. # # Revision 1.3 1997/05/01 11:15:33 peterg # Back under RCS # # Revision 1.2 1997/03/20 14:36:56 peterg |
︙ | ︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | write "File $1_odes.c"$ write "Generated by MTT"$ write "*/"$ write " "$ %Program heading write "#include <stdio.h>"$ write "#include ""$1_odes.h"" "$ %External (global) variable list write "#include ""$1_sympar.h"" "$ write "/* Declare standard arrays */"$ | > > > > > > > > > > > > > | | | | | 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 | write "File $1_odes.c"$ write "Generated by MTT"$ write "*/"$ write " "$ %Program heading write "#define MTTNX ", MTTNx $ write "#define MTTNY ", MTTNy $ write "#define MTTNU ", MTTNu $ write "#define MTTNX1 ", MTTNx+1 $ write "#define MTTNY1 ", MTTNy+1 $ write "#define MTTNU1 ", MTTNu+1 $ write "#define MTTNX2 ", MTTNx+2 $ write "#define MTTNY2 ", MTTNy+2 $ write "#define MTTNU2 ", MTTNu+2 $ write "#include <stdio.h>"$ write "#include ""$1_odes.h"" "$ write "#include ""$1_ode.c"" "$ write "#include ""$1_input.c"" "$ write "#include ""$1_numpar.c"" "$ %External (global) variable list write "#include ""$1_sympar.h"" "$ write "/* Declare standard arrays */"$ write "double y[MTTNY1]; /* $1_ode output */"$ write "double dx[MTTNX1]; /* $1_ode state derivative */"$ write "double x[MTTNX1]; /* $1_ode state */"$ write "double u[MTTNU1]; /* $1_ode input */"$ write "/* Files */ "$ write " FILE *fopen(), *fps, *fpso;"$ write "main()"$ write " "$ |
︙ | ︙ | |||
115 116 117 118 119 120 121 | write "/* Set up user-defined constants */"$ write " $1_numpar();"$ %Initialise main (Euler) integration loop write "/* Initialise main (Euler) integration loop */"$ write " time = 0;"$ write " dt = DT/STEPFACTOR;"$ | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | write "/* Set up user-defined constants */"$ write " $1_numpar();"$ %Initialise main (Euler) integration loop write "/* Initialise main (Euler) integration loop */"$ write " time = 0;"$ write " dt = DT/STEPFACTOR;"$ write " for (i=1; i<=MTTNX; i++)"$ write " x[i] = 0.0;"$ %Set up system inputs write "/* Set up system inputs */"$ write " for (i=1; i<=", MTTNu, "; i++)"$ write " u[i] = 1.0;"$ |
︙ | ︙ | |||
143 144 145 146 147 148 149 | write " while (time<LAST)"$ write " {"$ %Write to output to file write "/* Write to output file */"$ write " fprintf(fpso, ""%5.4f "",time);"$ | | | | | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | write " while (time<LAST)"$ write " {"$ %Write to output to file write "/* Write to output file */"$ write " fprintf(fpso, ""%5.4f "",time);"$ write " for (i=1; i<=MTTNY; i++)"$ write " fprintf(fpso, ""%5.4f "", y[i]);"$ write " fprintf(fpso, ""\n"");"$ %Write to state to file write "/* Write to state file */"$ write " fprintf(fps, ""%5.4f "",time);"$ write " for (i=1; i<=MTTNX; i++)"$ write " fprintf(fps, ""%5.4f "", x[i]);"$ write " fprintf(fps, ""\n"");"$ % Inner integration loop write "/* Inner integration loop */"$ write " for (k=1; k<=STEPFACTOR; k++)"$ write " {"$ %Set up system inputs write " /* Set up system inputs */"$ write " $1_input(time);"$ write " for (i=1; i<=MTTNX; i++)"$ write " x[i] = x[i] + dx[i]*dt;"$ write " $1_ode();"$ write " time = time + dt;"$ write " }"$ write " }"$ %Write to files %Write to output to file write "/* Write to output file */"$ write " fprintf(fpso, ""%5.4f "",time);"$ write " for (i=1; i<=MTTNY; i++)"$ write " fprintf(fpso, ""%5.4f "", y[i]);"$ write " fprintf(fpso, ""\n"");"$ %Write to state to file write "/* Write to state file */"$ write " fprintf(fps, ""%5.4f "",time);"$ write " for (i=1; i<=MTTNX; i++)"$ write " fprintf(fps, ""%5.4f "", x[i]);"$ write " fprintf(fps, ""\n"");"$ write " fprintf(fps, ""];\n"");"$ write " fprintf(fpso, ""];\n"");"$ |
︙ | ︙ |