Index: mttroot/mtt/bin/trans/cr_txt2r ================================================================== --- mttroot/mtt/bin/trans/cr_txt2r +++ mttroot/mtt/bin/trans/cr_txt2r @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.6 1998/04/14 13:54:15 peterg +## Uses the _sub.sh rep to recursively generate and include sub systems. +## ## Revision 1.5 1998/03/09 13:36:00 peterg ## Cosmetic change ## ## Revision 1.4 1998/03/06 15:54:41 peterg ## Put message bcak in in simpler form @@ -46,29 +49,36 @@ # Revision 1.1 1997/04/09 09:08:12 peterg # Initial revision # ############################################################### -if [ -f "$1_cr.r" ]; then - echo "Using $1_cr.r" +# The level of the recursion null at top level; _lower at lower levels. +level=$2 + +crfile=$1_cr$level.r + +if [ -f "$crfile" ]; then + echo "Using $crfile" else # Inform user - echo "Creating $1_cr.r" - - echo "% Constitutive relation file for $1 ($1_cr.r)" > $1_cr.r - echo "% Generated by MTT at `date`" >> $1_cr.r - -echo >> $1_cr.r - - # Recursively create subsystem CR files - sh $1_sub.sh 'cr_txt2r ' '' - + echo "Creating $crfile" + + echo "% Constitutive relation file for $1 ($crfile)" > $crfile + echo "% Generated by MTT at `date`" >> $crfile + +echo >> $crfile + + # Recursively create subsystem CR files -- at lower level + sh $1_sub.sh 'cr_txt2r ' ' _lower' + # Include subsystem CR files - sh $1_sub.sh 'echo ' '_cr.r' |\ + sh $1_sub.sh 'echo ' '_cr_lower.r' |\ awk '{ print "in \"" $1 "\";" - }' >> $1_cr.r + }' >> $crfile + +if [ -z "$level" ]; then # Copy .cr files awk '{ if (NF>0) { print "mtt -q -u crcopy " $1; @@ -78,14 +88,15 @@ # Include the .cr files awk '{ if (NF>0) { print "in \"" $1 ".cr\";" } - }' $1_cr.txt >> $1_cr.r + }' $1_cr.txt >> $crfile - echo 'END;' >> $1_cr.r + echo 'END;' >> $crfile +fi fi # Now invoke the standard error handling. #mtt_error mtt_error.txt