Comment: | Fixed some problems with generation of C++ code.
Representations such as ode now appear to have multiple outputs (mttdx,mtty) listed in mtt_header, so the write_cc_header parses the string and only returns the first one. Vector sizes mttnu, mttnx, etc. now appear in the code of sys_ode.m etc., so they are declared as static int in sys_def.h. The following now works properly on Ubuntu 12: mtt -cc -i euler -o rc gnuplot view |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8e2a1aea1b56fd19061cdb95f4ce35a3 |
User & Date: | geraint@users.sourceforge.net on 2014-07-13 13:53:52 |
Other Links: | branch diff | manifest | tags |
2014-07-14
| ||
06:37:07 | Avoid continuation \ issues. check-in: 7267367629 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
2014-07-13
| ||
13:53:52 |
Fixed some problems with generation of C++ code.
Representations such as ode now appear to have multiple outputs (mttdx,mtty) listed in mtt_header, so the write_cc_header parses the string and only returns the first one. Vector sizes mttnu, mttnx, etc. now appear in the code of sys_ode.m etc., so they are declared as static int in sys_def.h. The following now works properly on Ubuntu 12: mtt -cc -i euler -o rc gnuplot view check-in: 8e2a1aea1b user: geraint@users.sourceforge.net tags: origin/master, trunk | |
2014-07-12
| ||
22:30:45 | Declare size of vectors (mttnu,mttnx,etc) which now appear in ode code check-in: f282a62064 user: geraint@users.sourceforge.net tags: origin/master, trunk | |
Modified mttroot/mtt/bin/trans/mtt_header from [af77a75d17] to [342dc555fd].
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + + + | # Copyright (C) 2000 by Peter J. Gawthrop ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.67 2005/11/16 00:43:15 geraint ## rtxi ## ## Revision 1.66 2005/02/17 18:54:23 geraint ## Fixed a bash-sim: replaced let with $(( )) ## ## Revision 1.65 2004/08/29 13:14:29 geraint ## Added rule to make header for sae (sorted algebraic equations). ## ## Revision 1.64 2004/08/29 01:48:46 geraint |
︙ | |||
262 263 264 265 266 267 268 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | - + | ## Make parameter listing representation dependent ## ## Revision 1.3 2000/10/11 08:59:15 peterg ## Added csex rep ## ## Revision 1.2 2000/10/11 08:01:42 peterg ## Added noglobal fudge |
︙ | |||
382 383 384 385 386 387 388 | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - + - + | output='mttpar' zeromatrices='par' ;; ode) states=yes; inputs=yes; parameters=yes; |
︙ | |||
912 913 914 915 916 917 918 | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | + - + + + | done echo ${ans} } write_cc_header () { first_output=`get_field ${output:-""} 1` |
︙ | |||
949 950 951 952 953 954 955 | 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | - - - + + + + + + + + + + + + + + + + - + | comma="" fi w=`get_field ${args} ${i}` get_arg_specific_stuff ${w} printf "\tconst ${arg_type}\t&${w}${comma}\n" done fi |
︙ | |||
1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 | + - + | esac done } write_oct() { first_output=`get_field ${output:-""} 1` func=${1:-"<insert function name>"} args=${2:-""} cat <<EOF #if (CODEGENTARGET == OCTAVEDLD) $oct_rep_include DEFUN_DLD (${system}_${rep}, args, , |
︙ |
Modified mttroot/mtt/cc/def_m2h.sh from [1106fa706f] to [e00c7a936e].
︙ | |||
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | + + + - + + + | get_array_size () { vec=$1 gawk -v vec=${vec} '($1 == vec && $2 == "=") { print $3 }' | sed s/\;// } echo "/* ${SYS}_def.h, generated by MTT on `date` */" > ${OUT} echo "" >> ${OUT} echo "#ifndef HAVE_${SYS}_DEF_H" >> ${OUT} echo "#define HAVE_${SYS}_DEF_H" >> ${OUT} echo "" >> ${OUT} echo "const int MTTNU = `cat ${IN} | get_array_size nu`;" >> ${OUT} echo "const int MTTNX = `cat ${IN} | get_array_size nx`;" >> ${OUT} echo "const int MTTNY = `cat ${IN} | get_array_size ny`;" >> ${OUT} echo "const int MTTNZ = `cat ${IN} | get_array_size nz`;" >> ${OUT} echo "const int MTTNYZ = `cat ${IN} | get_array_size nyz`;" >> ${OUT} echo "const int MTTNPAR = `wc -l ${SYM} | gawk '{ print $1 }'`;" >> ${OUT} echo "" >> ${OUT} |