#!perl #
#
# Subroutine SRPCRT($NAME,$NUM1,$NUM2)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Perl subroutine designed to generate coordinates of the source and
# receiver points for given configuration parameters, perform two-point
# ray tracing, and convert unformatted output into a simple formatted
# file.
#
# Input:
#     $NAME...Prefix of data files (name of the job).  Should not exceed
#             5 characters under MS-DOS.  $NAME, $NUM1 and $NUM2
#             together should not exceed 8 characters under MS-DOS.
#     $NUM1...Integer configuration parameter.
#     $NUM2...Optional second configuration parameter.
#
# No output.
#
# Executable programs required:
#     srp, crt, crtpts
# Input files:
#     $NAMEsrp.dat... Input file for the 'srp' program to generate
#             source and receiver files for given configuration
#             parameters.  The receiver file must be named
#             $NAME-rec.out.  Source and receiver names will be
#             prefixed with $NUM1-.
#     $NAMEcrt.dat... Input file for the 'crt' program.
# Output files:
#     $NAME$NUM1$NUM2.out... File containing travel times, slowness
#             vectors and amplitudes (in R.C.C.S.) at
#             the receivers.
#     $NAMEscr.out... Collected screen output of programs 'srp',
#             'crt', and 'crtpts' (written in an append mode).
#
# Version: 5.50
# Date: 2001, January 9
#
# ----------------------------------------------------------------------
#
# Include files required:
  require 'go.pl';
#
  sub SRPCRT {
#
#   History file with input and output parameters:
    open(LU,">$_[0]srp.h");
    print LU "SRP='$_[0]srp.dat' CNAME='$_[1]-' CPAR1=$_[1] CPAR2=$_[2] \n";
    print LU "REC='$_[0]rec.out' PTS='$_[0]$_[1]$_[2].out' NQ=11 KALL=0 KREC=1 KTT=0 \n";
    close (LU) || die "Error in writing history file '$_[0]srp.h'";
#
#   Source and receiver points for given configuration parameters:
    &RUN("srp>>$_[0]scr.out","'$_[0]srp.h'");
#
#   Ray tracing:
    &RUN("crt>>$_[0]scr.out","'$_[0]crt.h'");
#
#   Results of ray tracing:
    &RUN("crtpts>>$_[0]scr.out","'$_[0]srp.h'");
#
#   Screen output (output filename):
    print "Output filename: $_[0]$_[1]$_[2].out \n";
  }
1;                                                               #