Distances2D Subroutine

subroutine Distances2D(rayx, Topx, Botx, dTop, dBot, Topn, Botn, DistTop, DistBot)

Calculates the distances to the boundaries

Arguments

Type IntentOptional Attributes Name
real(kind=8), intent(in) :: rayx(2)
real(kind=8), intent(in) :: Topx(2)
real(kind=8), intent(in) :: Botx(2)
real(kind=8), intent(out) :: dTop(2)
real(kind=8), intent(out) :: dBot(2)
real(kind=8), intent(in) :: Topn(2)
real(kind=8), intent(in) :: Botn(2)
real(kind=8), intent(out) :: DistTop
real(kind=8), intent(out) :: DistBot

Called by

proc~~distances2d~~CalledByGraph proc~distances2d Distances2D proc~traceray2d~2 TraceRay2D proc~traceray2d~2->proc~distances2d proc~bellhopcore~2 BellhopCore proc~bellhopcore~2->proc~traceray2d~2 program~bellhop BELLHOP program~bellhop->proc~bellhopcore~2

Source Code

SUBROUTINE Distances2D( rayx, Topx, Botx, dTop, dBot, Topn, Botn, DistTop, DistBot )
!! Calculates the distances to the boundaries

  ! Formula differs from JKPS because code uses outward pointing normals

  REAL (KIND=8), INTENT( IN  ) :: rayx( 2 )              ! ray coordinate
  REAL (KIND=8), INTENT( IN  ) :: Topx( 2 ), Botx( 2 )   ! top, bottom coordinate
  REAL (KIND=8), INTENT( IN  ) :: Topn( 2 ), Botn( 2 )   ! top, bottom normal vector (outward)
  REAL (KIND=8), INTENT( OUT ) :: dTop( 2 ), dBot( 2 )   ! vector pointing from top, bottom bdry to ray
  REAL (KIND=8), INTENT( OUT ) :: DistTop, DistBot       ! distance (normal to bdry) from the ray to top, bottom boundary

  dTop    = rayx - Topx  ! vector pointing from top    to ray
  dBot    = rayx - Botx  ! vector pointing from bottom to ray
  DistTop = -DOT_PRODUCT( Topn, dTop )
  DistBot = -DOT_PRODUCT( Botn, dBot )

END SUBROUTINE Distances2D