File mttroot/mtt/bin/trans/cr_txt2r artifact 7b281e063b part of check-in dac04e29db


#! /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.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
##
## Revision 1.3  1998/03/06 15:51:06  peterg
## Zapped the irritating error message
##
## Revision 1.2  1998/03/04 15:32:53  peterg
## Major revision.
## Now just includes cr files using in"";
## Two sorts of CR:
## 	generic (.cr)
## 	tied to a system (_cr.r)
##
## Revision 1.1  1998/03/04 15:31:14  peterg
## Initial revision
##
# 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
#
###############################################################

# 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 $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_lower.r' |\
    awk '{
      print "in \"" $1 "\";"
    }'  >> $crfile

if [ -z "$level" ]; then

    # 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  >> $crfile

    echo 'END;' >> $crfile
fi

fi
# Now invoke the standard error handling.
#mtt_error mtt_error.txt




MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]