3x1 Unit vector.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(3) | :: | r |
pure function unit(r) result(rhat) implicit none real(wp),dimension(3) :: rhat real(wp),dimension(3),intent(in) :: r real(wp) :: rmag rmag = norm2(r) if (rmag/=zero) then rhat = r/rmag else rhat = zero end if end function unit