GetBotSeg Subroutine

public subroutine GetBotSeg(r, t)

Arguments

Type IntentOptional Attributes Name
real(kind=8), intent(in) :: r
real(kind=8), intent(in) :: t

Calls

proc~~getbotseg~~CallsGraph proc~getbotseg GetBotSeg proc~errout ERROUT proc~getbotseg->proc~errout

Called by

proc~~getbotseg~~CalledByGraph proc~getbotseg GetBotSeg proc~traceray2d~2 TraceRay2D proc~traceray2d~2->proc~getbotseg proc~bellhopcore~2 BellhopCore proc~bellhopcore~2->proc~traceray2d~2 program~bellhop BELLHOP program~bellhop->proc~bellhopcore~2

Source Code

  SUBROUTINE GetBotSeg( r, t )

    ! Get the Bottom segment info (index and range interval) for range, r
    ! LP: t: range component of ray tangent. Endpoints of segments are handled
    ! so that if the ray moves slightly along its current direction, it will
    ! remain in the same segment.

    INTEGER, PARAMETER :: PRTFile = 6
    INTEGER :: IsegBotT( 1 )
    REAL (KIND=8), INTENT( IN ) :: r, t

    IF ( t > 0.0 ) THEN
       IsegBotT = MAXLOC( Bot( : )%x( 1 ), Bot( : )%x( 1 ) <= r )
    ELSE
       IsegBotT = MAXLOC( Bot( : )%x( 1 ), Bot( : )%x( 1 ) <  r )
    ENDIF

    IF ( IsegBotT( 1 ) > 0 .AND. IsegBotT( 1 ) < NbtyPts ) THEN  ! IsegBot MUST LIE IN [ 1, NbtyPts-1 ]
       IsegBot = IsegBotT( 1 )
       rBotSeg = [ Bot( IsegBot )%x( 1 ), Bot( IsegBot + 1 )%x( 1 ) ]   ! segment limits in range
    ELSE
       WRITE( PRTFile, * ) 'r = ', r
       WRITE( PRTFile, * ) 'rLeft  = ', Bot( 1       )%x( 1 )
       WRITE( PRTFile, * ) 'rRight = ', Bot( NbtyPts )%x( 1 )
       CALL ERROUT( 'GetBotSeg', 'Bottom bathymetry undefined below the source' )
    ENDIF

  END SUBROUTINE GetBotSeg