      SUBROUTINE LINTRP(X1,Y1,X2,Y2,XVALUE,INTVAL)
      IMPLICIT NONE
C
C**********************************************************************
C
C   NAME- LINTRP
C
C   LANGUAGE- FORTRAN  TYPE- SUBROUTINE      COMPUTER- IBM SP
C
C   VERSION- 1.0    DATE- 01/19/89   PROGRAMMER- KARL W. COX (SMSRC)
C   VERSION- 2.0    DATE- 06/17/04   PROGRAMMER- FRANK TILLEY (RAYTHEON)
C            REHOSTED FROM CEMSCS MVS MAINFRAME TO IBM SP UNIX PLATFORM.
C
C   FUNCTION-
C  THIS ROUTINE RETURNS THE ORDINATE VALUE, CORRESPONDING TO THE
C  ABSCISSA XVALUE, OF THE LINE PASSING THROUGH THE POINTS (X1,Y1)
C  AND (X2,Y2).  (I.E., OBTAINS THE LINEAR INTERPOLATED ORDINATE).
C
C
C   CALLING SEQUENCE PARAMETERS-
C     VARIABLE          TYPE I/O  FUNCTION
C     --------          ---- ---  --------
C     X1                REAL  I   X COORDINATE OF THE FIRST POINT
C     Y1                REAL  I   Y COORDINATE OF THE FIRST POINT
C     X2                REAL  I   X COORDINATE OF THE SECOND POINT
C     Y2                REAL  I   Y COORDINATE OF THE SECOND POINT
C     XVALUE            REAL  I   ABSCISSA (I.E., X) VALUE TO BE
C                                 INTERPOLATED
C     INTVAL            REAL  O   INTERPOLATED VALUE
C
C   COMMON AREA PARAMETERS-
C
      INCLUDE 'SPVAL'

C   LOCAL PARAMETERS-
C     VARIABLE          TYPE  FUNCTION
C     --------          ----  --------
C     SLOPE             R*8   SLOPE OF THE LINE CONNECTING THE
C                             FIRST (X1,Y1) AND SECOND(X2,Y2) POINTS
C
C**********************************************************************
C
C
C  SUBROUTINE ARGUMENTS
C
         REAL   Y1,Y2,INTVAL
         REAL   X1,X2,XVALUE
C
C  TEMPORARY VARIABLES
C
         REAL*8 SLOPE
C
C  IF BOTH X1 AND X2 ARE EQUAL WE WILL RETURN Y1 AS THE INTVAL
C
         IF(X1 .EQ. X2) THEN
           INTVAL = Y1
           RETURN
         ENDIF
C
         IF((Y2.NE. R4SPV).AND.(Y1.NE. R4SPV))THEN
           SLOPE = (Y2 - Y1)/(X2 - X1)
           INTVAL =  Y1 + SLOPE * (XVALUE - X1)
         ELSE
           INTVAL = R4SPV
         ENDIF
C
         RETURN
         END
