Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | IWin | |||
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 DayltgHitInteriorObstruction(IWin,R1,R2,IHIT)
! SUBROUTINE INFORMATION:
! AUTHOR Fred Winkelmann
! DATE WRITTEN July 1997
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! This subroutine checks for interior obstructions between reference point and window element.
! 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) :: IWin ! Window index
REAL(r64), INTENT(IN) :: R1(3) ! Origin of ray (m)
REAL(r64), INTENT(IN) :: R2(3) ! Destination of ray (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
REAL(r64) :: r12 ! Distance between R1 and R2
REAL(r64) :: d ! Distance between R1 and pierced surface
REAL(r64) :: RN(3) ! Unit vector along ray
! FLOW:
IHIT = 0
r12 = SQRT(DOT_PRODUCT(R1 - R2,R1 - R2))
RN = R2 - R1
RN = RN / (SQRT(DOT_PRODUCT(RN,RN))) ! Make unit vector
! Loop over obstructions, which can be building elements, like walls,
! or shadowing surfaces, like overhangs. Exclude base surface of window IWin.
DO ISurf = 1,TotSurfaces
IType = Surface(ISurf)%Class
IF ((IType==SurfaceClass_Wall .OR. IType==SurfaceClass_Roof .OR. IType==SurfaceClass_Floor) &
.AND. ISurf /= Surface(IWin)%BaseSurf .AND. ISurf /= Surface(Surface(IWin)%BaseSurf)%ExtBoundCond) THEN
IF(Surface(ISurf)%Zone == Surface(IWin)%Zone) THEN ! Wall/ceiling/floor is in same zone as 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 DayltgHitInteriorObstruction