Calculates the distances to the boundaries
Type | Intent | Optional | 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 |
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