Returns the new layout and decomposition resulting from swapping two directions.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fft_obj), | intent(inout) | :: | this |
A FFT object |
||
| integer, | intent(in) | :: | swap_1 |
Direction to swap |
||
| integer, | intent(in) | :: | swap_2 |
Direction to swap |
||
| integer, | intent(in) | :: | Ng(3) |
Global number of grid points in each direction in the original layout |
||
| integer, | intent(out) | :: | Ng_T(3) |
Global number of grid points in each direction in the transposed layout |
||
| integer, | intent(out) | :: | l_dims_T(3) |
Size of each subblock in the transposed layout |
||
| integer, | intent(out) | :: | l_offsets_T(3) |
Offsets of each subblock in the transposed layout |
impure subroutine fft_obj_GetTransposeLayout(this,swap_1,swap_2,Ng,Ng_T,l_dims_T,l_offsets_T) !> Returns the new layout and decomposition resulting from swapping ! two directions. implicit none class(fft_obj), intent(inout) :: this !! A FFT object integer, intent(in) :: swap_1 !! Direction to swap integer, intent(in) :: swap_2 !! Direction to swap integer, intent(in) :: Ng(3) !! Global number of grid points in each direction in the original layout integer, intent(out) :: Ng_T(3) !! Global number of grid points in each direction in the transposed layout integer, intent(out) :: l_dims_T(3) !! Size of each subblock in the transposed layout integer, intent(out) :: l_offsets_T(3) !! Offsets of each subblock in the transposed layout ! Work variables integer :: dir integer :: coords(3) integer :: cart_dims(3) coords = this%parallel%rank%dir - 1 cart_dims = this%parallel%np ! Determine data layout of transposed array Ng_T = Ng Ng_T(swap_1) = Ng(swap_2) Ng_T(swap_2) = Ng(swap_1) ! Restructure data in each direction do dir=1,3 l_dims_T(dir) = Ng_T(dir)/cart_dims(dir) if (coords(dir).lt. mod(Ng_T(dir),cart_dims(dir))) l_dims_T(dir) = l_dims_T(dir) + 1 l_offsets_T(dir) = coords(dir)*(Ng_T(dir)/cart_dims(dir)) + min(coords(dir), mod(Ng_T(dir), cart_dims(dir))) end do return end subroutine fft_obj_GetTransposeLayout