ADDED mttroot/mtt/bin/trans/cr_txt2r Index: mttroot/mtt/bin/trans/cr_txt2r ================================================================== --- /dev/null +++ mttroot/mtt/bin/trans/cr_txt2r @@ -0,0 +1,70 @@ +#! /bin/sh + + ###################################### + ##### Model Transformation Tools ##### + ###################################### + +# Bourne shell script: cr_txt2r + +# Label file to constitutive relationship conversion +# P.J.Gawthrop March 1997 +# Copyright (c) P.J.Gawthrop, 1997. + +############################################################### +## Version control history +############################################################### +## $Id$ +## $Log$ +# Revision 1.3 1997/04/09 12:59:43 peterg +# Looks for .cr file in current directory - copies from library if they +# don't already exist. +# +# Revision 1.2 1997/04/09 09:25:55 peterg +# Now copies .cr files from linrary to here (if they don't exist +# already). +# +# Revision 1.1 1997/04/09 09:08:12 peterg +# Initial revision +# +############################################################### + +if [ -f "$1_cr.r" ]; then + echo "$1_cr.r exists -- no action taken" +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 + + # Include subsystem CR files - where they exist. + ls *_cr.r |\ + awk '{ + if ($1 != SYS) + print "in \"" $1 "\";" + }' SYS=$1_cr.r >> $1_cr.r + + # Copy .cr files + awk '{ + if (NF>0) { + print "mtt -q -u crcopy " $1; + } + }' $1_cr.txt | sh + + # Include the .cr files + awk '{ + if (NF>0) { + print "in \"" $1 ".cr\";" + } + }' $1_cr.txt >> $1_cr.r + + echo 'END;' >> $1_cr.r + +fi +# Now invoke the standard error handling. +#mtt_error mtt_error.txt + +