C                                                            <HTML><PRE>
C Program BNDLIN to write 12 lines forming edges of the model box
C
C Version: 5.30
C Date: 1999, June 10
C
C Coded by: Ludek Klimes
C     Department of Geophysics, Charles University Prague,
C     Ke Karlovu 3, 121 16 Praha 2, Czech Republic,
C     E-mail: klimes@seis.karlov.mff.cuni.cz
C
C.......................................................................
C
C                                                    <A NAME="data"></A>
C Description of the data files:
C
C Input data read from the * external unit:
C     The data are read in by the list directed input (free format)
C     using a single READ statement.
C (1) 'SEP',/
C     'SEP'...String in apostrophes containing the name of the input
C             SEP parameter or history file with the input data.
C             <A HREF="#SEP">Description of file SEP</A>
C     No default, obligatory parameter.
C
C                                                     <A NAME="SEP"></A>
C Data file 'SEP' has the form of the SEP (Stanford Exploration Project)
C parameter file:
C     All the data are specified in the form of PARAMETER=VALUE, e.g.
C     N1=50, with PARAMETER directly preceding = without intervening
C     spaces and with VALUE directly following = without intervening
C     spaces.  The PARAMETER=VALUE couple must be delimited by a space
C     or comma from both sides.
C     The PARAMETER string is not case-sensitive.
C     PARAMETER= followed by a space resets the default parameter value.
C     All other text in the input files is ignored.  The file thus may
C     contain unused data or comments without leading comment character.
C     Everything between comment character # and the end of the
C     respective line is ignored, too.
C     The PARAMETER=VALUE couples may be specified in any order.
C     The last appearance takes precedence.
C Data specifying the input model file:
C     MODEL='string'... Input data file describing the model, it is
C             described in the subroutine file 'model.for'.
C             <A HREF="model.for#data">Description of file MODEL</A>
C             Default:  'MODEL'='model.dat'
C Data specifying the output file:
C     LIN='string'... Name of the output file.  It is recommended to
C             specify it rather than to use the default name.
C             <A HREF="../forms/formsdat.htm#LIN">Format of file LIN</A>
C             Default: LIN='lin.out'
C
C=======================================================================
C
C Common block /MODELC/:
      INCLUDE 'model.inc'
C None of the storage locations of the common block are altered.
C
C-----------------------------------------------------------------------
C
      CHARACTER*80 FILE1
      PARAMETER (LU1=1)
C
C     Reading main input data:
      WRITE(*,'(A)') '+BNDLIN: Enter input filename: '
      FILE1=' '
      READ(*,*) FILE1
      IF(FILE1.EQ.' ') THEN
C       <A NAME="error01"></A><FONT COLOR="RED">BNDLIN-01</FONT>
        CALL ERROR('BNDLIN-01: No input file specified')
C       Input file in the form of the SEP (Stanford Exploration Project)
C       parameter or history file must be specified.
C       There is no default filename.
      END IF
      WRITE(*,'(A)') '+BNDLIN: Working...            '
      CALL RSEP1(LU1,FILE1)
C
C     Reading the model description file:
      CALL RSEP3T('MODEL',FILE1,'model.dat')
      OPEN(LU1,FILE=FILE1,STATUS='OLD')
      CALL MODEL1(LU1)
      CLOSE(LU1)
C
C     Step along the lines (presently non-documented feature)
      CALL RSEP3R('BNDSTEP',STEP,999999.)
C
C     Reading output filename and opening the output file:
      CALL RSEP3T('LIN',FILE1,'lin.out')
      OPEN(LU1,FILE=FILE1)
C
      WRITE(LU1,'(A)') '/'
      CALL WLINE(LU1,BOUNDM(1),BOUNDM(3),BOUNDM(5),
     *               BOUNDM(2),BOUNDM(3),BOUNDM(5),STEP)
      CALL WLINE(LU1,BOUNDM(2),BOUNDM(3),BOUNDM(5),
     *               BOUNDM(2),BOUNDM(4),BOUNDM(5),STEP)
      CALL WLINE(LU1,BOUNDM(2),BOUNDM(4),BOUNDM(5),
     *               BOUNDM(1),BOUNDM(4),BOUNDM(5),STEP)
      CALL WLINE(LU1,BOUNDM(1),BOUNDM(4),BOUNDM(5),
     *               BOUNDM(1),BOUNDM(3),BOUNDM(5),STEP)
      CALL WLINE(LU1,BOUNDM(1),BOUNDM(3),BOUNDM(6),
     *               BOUNDM(2),BOUNDM(3),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(2),BOUNDM(3),BOUNDM(6),
     *               BOUNDM(2),BOUNDM(4),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(2),BOUNDM(4),BOUNDM(6),
     *               BOUNDM(1),BOUNDM(4),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(1),BOUNDM(4),BOUNDM(6),
     *               BOUNDM(1),BOUNDM(3),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(1),BOUNDM(3),BOUNDM(5),
     *               BOUNDM(1),BOUNDM(3),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(2),BOUNDM(3),BOUNDM(5),
     *               BOUNDM(2),BOUNDM(3),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(2),BOUNDM(4),BOUNDM(5),
     *               BOUNDM(2),BOUNDM(4),BOUNDM(6),STEP)
      CALL WLINE(LU1,BOUNDM(1),BOUNDM(4),BOUNDM(5),
     *               BOUNDM(1),BOUNDM(4),BOUNDM(6),STEP)
      WRITE(LU1,'(A)') '/'
      CLOSE(LU1)
      WRITE(*,'(A)') '+BNDLIN: Done.                 '
      STOP
      END
C
C=======================================================================
C
      SUBROUTINE WLINE(LU1,X1,X2,X3,Y1,Y2,Y3,STEP)
C
      WRITE(LU1,'(A)') '''MODEL BOUNDARY'''
      WRITE(LU1,'(A)') '/'
      DIST=SQRT((X1-Y1)**2+(X2-Y2)**2+(X3-Y3)**2)
      DO 10 S=0.,0.999999,STEP/DIST
        Z=AMIN1(S+STEP/DIST,1.)
        S1=X1+(Y1-X1)*S
        S2=X2+(Y2-X2)*S
        S3=X3+(Y3-X3)*S
        Z1=X1+(Y1-X1)*Z
        Z2=X2+(Y2-X2)*Z
        Z3=X3+(Y3-X3)*Z
        WRITE(LU1,'(3F9.3,A)') S1,S2,S3,' /'
        WRITE(LU1,'(3F9.3,A)') Z1,Z2,Z3,' /'
        WRITE(LU1,'(A)') '/'
   10 CONTINUE
      RETURN
      END
C
C=======================================================================
C
      INCLUDE 'error.for'
C     <A HREF="error.for">error.for</A>
      INCLUDE 'sep.for'
C     <A HREF="sep.for">sep.for</A>
      INCLUDE 'length.for'
C     <A HREF="length.for">length.for</A>
      INCLUDE 'model.for'
C     <A HREF="model.for">model.for</A>
      INCLUDE 'metric.for'
C     <A HREF="metric.for">metric.for</A>
      INCLUDE 'srfc.for'
C     <A HREF="srfc.for">srfc.for</A>
      INCLUDE 'parm.for'
C     <A HREF="parm.for">parm.for</A>
      INCLUDE 'val.for'
C     <A HREF="val.for">val.for</A>
      INCLUDE 'fit.for'
C     <A HREF="fit.for">fit.for</A>
C
C=======================================================================
C                                                                 </PRE>
