File mttroot/mtt/bin/trans/struc2input_txt2txt artifact ad38cbf533 part of check-in 49988ed4a2


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: struc2input_txt2txt
# Creates the deafault numerical parameters file for the system (txt)

# Copyright (c) P.J.Gawthrop 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5  1998/02/04 12:26:47  peterg
## Simplified output format
##
## Revision 1.4  1998/02/04 11:45:05  peterg
## Less verbose comments.
##
## Revision 1.3  1998/01/29 17:06:21  peterg
## Better annotation of each input
##
## Revision 1.2  1997/05/15 09:44:12  peterg
## Put switches into the input file.
##
# Revision 1.1  1997/05/03  14:55:17  peterg
# Initial revision
#
###############################################################

#Look for a command line argument
# By default, don't look for BG switches

switches=no
while [ -n "`echo $1 | grep '-'`" ]; do
  case $1 in
	-s )
		switches=yes ;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

# Inform user
echo Creating $1_input.txt

#Create the input file complete with headers.
echo "# Numerical parameter file ($1_input.txt)" > $1_input.txt
echo "# Generated by MTT at `date`" >> $1_input.txt
cat $MTTPATH/trans/rcs_header.txt  >> $1_input.txt

#Write out the defaults -- inputs to steady-state values
  echo "# Set the inputs"  >> $1_input.txt
cat $1_ss.r  $1_struc.txt | sed 's/\$//' |\
awk '{
  if(match($1,"MTTu")) {
    j++
    u[j]=$3;
  }
    
  if($1=="input") {
    i++; 
    print  "u(" i ") =\t", u[i], "; \# " $4 " (" $3 ")"
  }
}'  >> $1_input.txt


#Set some switches
if [ "$switches" = "yes" ]; then
  echo  >> $1_input.txt
  echo "# Set the switches"  >> $1_input.txt
  awk '{print  tolower($1) "= (t>=0);"}'< $1_switch.txt   >> $1_input.txt
fi





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