Subroutine to transform an array of complexes so that the center is in the corners
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
complex(kind=R8), | intent(in), | dimension(1:long, 1:larg) | :: | tab_in |
2D array to transform |
|
complex(kind=R8), | intent(out), | dimension(1:long, 1:larg) | :: | tab_out |
transformed 2D array |
|
integer(kind=I4), | intent(in) | :: | long |
2D array length |
||
integer(kind=I4), | intent(in) | :: | larg |
2D array width |
subroutine trans_center2corner_cmpl(tab_in, tab_out, long, larg) !! Subroutine to transform an array of complexes so that the center is in the corners implicit none integer(kind=I4), intent(in ) :: long !! *2D array length* integer(kind=I4), intent(in ) :: larg !! *2D array width* complex(kind=R8), intent(in ), dimension(1:long, 1:larg) :: tab_in !! *2D array to transform* complex(kind=R8), intent(out), dimension(1:long, 1:larg) :: tab_out !! *transformed 2D array* integer(kind=I4) :: i, j, ii, jj ii = 0 jj = 0 if ( long == 2 * (long/2) ) ii = 1 if ( larg == 2 * (larg/2) ) jj = 1 do j = 1, larg do i = 1, long tab_out(i, j) = tab_in( mod( i + long/2 - ii, long ) + 1, & ! mod( j + larg/2 - jj, larg ) + 1 ) enddo enddo return endsubroutine trans_center2corner_cmpl