Index: mttroot/mtt/bin/trans/switch_txt2m ================================================================== --- mttroot/mtt/bin/trans/switch_txt2m +++ mttroot/mtt/bin/trans/switch_txt2m @@ -14,10 +14,14 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.7 1999/04/02 06:30:37 peterg +## New _switchopen +## Removed switcha +## ## Revision 1.6 1998/10/01 18:20:50 peterg ## Split up the three if conditions on the switch and state value into ## three separate ifs. This is because p2c seems to generate incorrect ## code id just the one if is used (???). ## @@ -25,35 +29,35 @@ ## Separate switch.m file for euler and implicit integration ## ############################################################### -echo Creating $1_switch.m # Find system constants Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'` #Write some file headers lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m +#echo Creating $1_switch.m # Set states to zero -awk '{ - if ($1=="#"){ - printf("#== Switches set element of state vector to zero ==#\n") - } - else{ - printf("\n#== Switch: %s ==#\n",$1) - printf("if (%s==0.0) \n", $1); - printf(" mttx(%s)=0.0;\n", $2); - printf("end;\n"); - printf("if (%s<0.0)\n",$1); - printf(" if (mttx(%s)<=0.0)\n",$2); - printf(" mttx(%s)=0.0;\n", $2); - printf(" end;\n"); - printf("end;\n"); - - } -}' Nx=$Nx < $1_switch.txt >> $1_switch.m +# awk '{ +# if ($1=="#"){ +# printf("#== Switches set element of state vector to zero ==#\n") +# } +# else{ +# printf("\n#== Switch: %s ==#\n",$1) +# printf("if (%s==0.0) \n", $1); +# printf(" mttx(%s)=0.0;\n", $2); +# printf("end;\n"); +# printf("if (%s<0.0)\n",$1); +# printf(" if (mttx(%s)<=0.0)\n",$2); +# printf(" mttx(%s)=0.0;\n", $2); +# printf(" end;\n"); +# printf("end;\n"); + +# } +# }' Nx=$Nx < $1_switch.txt >> $1_switch.m ## Set index version echo Creating $1_switchopen.m #Write some file headers @@ -70,11 +74,11 @@ printf("\n#== Switch: %s ==#\n",$1) printf("if (%s==0.0) \n", $1); printf(" open(%s) = 1;\n", $2); printf("end;\n"); printf("if (%s<0.0)\n",$1); - printf(" if (mttx(%s)<=0.0)\n",$2); + printf(" if (mttx(%s)<0.0)\n",$2); printf(" open(%s) = 1;\n", $2); printf(" end;\n"); printf("end;\n"); }