Note
Function that extends an array for FFT processing.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=R8), | intent(in), | dimension(1:nx, 1:ny ) | :: | tab_in |
input array |
|
real(kind=R8), | intent(out), | dimension(1:nx2, 1:ny2) | :: | tab_out |
apodized array |
|
integer(kind=I4), | intent(in) | :: | nx |
2D input array length |
||
integer(kind=I4), | intent(in) | :: | ny |
2D input array width |
||
integer(kind=I4), | intent(in) | :: | nx2 |
2D output array length |
||
integer(kind=I4), | intent(in) | :: | ny2 |
2D output array width |
||
character(len=*), | intent(in) | :: | ext |
extension |
||
character(len=*), | intent(in), | optional | :: | type_apo |
apodization type |
subroutine extend(tab_in, tab_out, nx, ny, nx2, ny2, ext, type_apo) implicit none integer(kind=I4), intent(in ) :: nx !! *2D input array length* integer(kind=I4), intent(in ) :: ny !! *2D input array width* integer(kind=I4), intent(in ) :: nx2 !! *2D output array length* integer(kind=I4), intent(in ) :: ny2 !! *2D output array width* real (kind=R8), intent(in ), dimension(1:nx, 1:ny ) :: tab_in !! *input array* real (kind=R8), intent(out), dimension(1:nx2, 1:ny2) :: tab_out !! *apodized array* character(len=*), intent(in ) :: ext !! *extension* character(len=*), intent(in ), optional :: type_apo !! *apodization type* integer(kind=I4) :: i, j, ibx, iby, iex, iey real(kind=R8), dimension(:,:), allocatable :: tab_tmp ibx = ceiling( (nx2 - nx)/2. ) ; iex = ibx + nx - 1 iby = ceiling( (ny2 - ny)/2. ) ; iey = iby + ny - 1 allocate( tab_tmp(1:nx2, 1:ny2) ) tab_tmp(1:nx2, 1:ny2) = 0 tab_tmp(ibx:iex, iby:iey) = tab_in(1:nx, 1:ny) select case ( ext ) case( 'symmetry' ) do i = 1, ibx - 1 tab_tmp(ibx - i, iby:iey) = tab_tmp(ibx + i, iby:iey) enddo do i = iex + 1, nx2 tab_tmp(i, iby:iey) = tab_tmp(iex - (i - iex), iby:iey) enddo do j = 1, iby - 1 tab_tmp(1:nx2, iby - j) = tab_tmp(1:nx2, iby + j) enddo do j = iey + 1, ny2 tab_tmp(1:nx2, j) = tab_tmp(1:nx2, iey - (j - iey)) enddo case( 'constant' ) do i = 1, ibx - 1 tab_tmp(i, iby:iey) = tab_tmp(ibx, iby:iey) enddo do i = iex + 1, nx2 tab_tmp(i, iby:iey) = tab_tmp(iex, iby:iey) enddo do j = 1, iby - 1 tab_tmp(1:nx2, j) = tab_tmp(1:nx2, iby) enddo do j = iey + 1, ny2 tab_tmp(1:nx2, j) = tab_tmp(1:nx2, iey) enddo case( 'zero' ) endselect if ( present(type_apo) ) then call apod( tab_in = tab_tmp(1:nx2, 1:ny2), & ! tab_out = tab_out(1:nx2, 1:ny2), & ! long = nx2, & ! larg = ny2, & ! type_apo = type_apo ) ! else tab_out(1:nx2, 1:ny2) = tab_tmp(1:nx2, 1:ny2) endif deallocate( tab_tmp ) return endsubroutine extend