Interchange Loops

Description:  Swaps inner and outer loops of the selected nested do-loop. This refactoring merely switches the inner and outer do-headers. It will not make any changes to the body of the loop.

State: Implemeted         Author: Tim Yuvashev      Version:   Photran 5.0

Code Example:

    program main

    integer :: max
    parameter (max = 10)
   
    integer , dimension (max,max) ::clouds
    integer , dimension (max,max) ::ocean
    integer :: i,j

    do i = 1,10
        do j= 1,10
            clouds(i,j) = ocean(i+2,j-1)
       end do
    end do

end program main

   program main

    integer :: max
    parameter (max = 10)

    integer , dimension (max,max) ::clouds
    integer , dimension (max,max) ::ocean
    integer :: i,j

    do j= 1,10
        do i = 1,10
            clouds(i,j) = ocean(i+2,j-1)
        end do
    end do

end program main


ScreenShots

      

HTML Comment Box is loading comments...