Calculate the cross product c = a x b on the [-nth, nth]
domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(in), | dimension(-ntgrid:, :) | :: | a | ||
real, | intent(in), | dimension(-ntgrid:, :) | :: | b | ||
real, | intent(out), | dimension(-ntgrid:, :) | :: | c |
pure subroutine crosstgrid(a, b, c)
real, dimension(-ntgrid:, :), intent (in) :: a, b
real, dimension(-ntgrid:, :), intent (out) :: c
integer :: i
do i = -nth, nth
c(i, 1) = a(i, 2) * b(i, 3) - b(i, 2) * a(i, 3)
c(i, 2) = a(i, 3) * b(i, 1) - b(i, 3) * a(i, 1)
c(i, 3) = a(i, 1) * b(i, 2) - b(i, 1) * a(i, 2)
end do
end subroutine crosstgrid