Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | IWin1 | |||
integer, | intent(in) | :: | IWin2 | |||
real(kind=r64), | intent(in) | :: | R1(3) | |||
real(kind=r64), | intent(in) | :: | R2(3) | |||
integer, | intent(out) | :: | IHIT |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
SUBROUTINE DayltgHitBetWinObstruction(IWin1,IWin2,R1,R2,IHIT)
! SUBROUTINE INFORMATION:
! AUTHOR Fred Winkelmann
! DATE WRITTEN Feb 2004
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Determines if a ray from point R1 on window IWin1 to point R2
! on window IWin2 hits an obstruction
! METHODOLOGY EMPLOYED:na
! REFERENCES:na
! USE STATEMENTS:na
IMPLICIT NONE ! Enforce explicit typing of all variables in this routine
! SUBROUTINE ARGUMENT DEFINITIONS:
INTEGER, INTENT(IN) :: IWin1 ! Surface number of origin window
INTEGER, INTENT(IN) :: IWin2 ! Surface number of destination window
REAL(r64), INTENT(IN) :: R1(3) ! Origin of ray (on IWin1) (m)
REAL(r64), INTENT(IN) :: R2(3) ! Destination of ray (on IWin2) (m)
INTEGER, INTENT(OUT) :: IHIT ! Hit flag: 1 = ray hits an obstruction, 0 = does not
! SUBROUTINE PARAMETER DEFINITIONS: na
! INTERFACE BLOCK SPECIFICATIONS: na
! DERIVED TYPE DEFINITIONS: na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: ISurf ! Surface index
INTEGER :: IType ! Surface type/class
REAL(r64) :: HP(3) ! Hit coordinates, if ray hits an obstruction surface (m)
REAL(r64) :: r12 ! Distance between R1 and R2 (m)
REAL(r64) :: d ! Distance between R1 and obstruction surface (m)
REAL(r64) :: RN(3) ! Unit vector along ray from R1 to R2
! FLOW:
IHIT = 0
r12 = SQRT(DOT_PRODUCT(R1 - R2,R1 - R2))
RN = R2 - R1
RN = RN / (SQRT(DOT_PRODUCT(RN,RN))) ! Unit vector
! Loop over obstructions, which can be building elements, like walls,
! or shadowing surfaces, like overhangs. Exclude base surface of window IWin1.
! Exclude base surface of window IWin2.
DO ISurf = 1,TotSurfaces
IType = Surface(ISurf)%Class
IF ((IType==SurfaceClass_Wall .OR. IType==SurfaceClass_Roof .OR. IType==SurfaceClass_Floor) &
.AND. ISurf /= Surface(IWin2)%BaseSurf .AND. ISurf /= Surface(IWin1)%BaseSurf &
.AND. ISurf /= Surface(Surface(IWin2)%BaseSurf)%ExtBoundCond &
.AND. ISurf /= Surface(Surface(IWin1)%BaseSurf)%ExtBoundCond) THEN
IF(Surface(ISurf)%Zone == Surface(IWin2)%Zone) THEN ! Wall/ceiling/floor is in same zone as destination window
CALL DayltgPierceSurface(ISurf,R1,RN,IHIT,HP)
IF (IHIT > 0) THEN
d = SQRT(DOT_PRODUCT(R1 - HP,R1 - HP))
IF (d > r12) THEN ! Discount any hits farther than the window.
IHIT = 0
ELSE ! The hit is closer than the window.
EXIT
END IF
END IF
END IF
ELSE IF (Surface(ISurf)%ShadowingSurf) THEN
CALL DayltgPierceSurface(ISurf,R1,RN,IHIT,HP)
IF (IHIT > 0) THEN
d = SQRT(DOT_PRODUCT(R1 - HP,R1 - HP))
IF (d > r12) THEN ! Discount any hits farther than the window.
IHIT = 0
ELSE ! The hit is closer than the window.
EXIT
END IF
END IF
END IF
END DO
RETURN
END SUBROUTINE DayltgHitBetWinObstruction