End-user products => VAST/77to90 => Code example

VAST/77to90 Example

F77 Input:

      subroutine demo(a,b,c,n)
      dimension a(n), b(n), c(n)
      common /ecom/scratch(10000)
      do 100 i = 1, n
      a(i) = b(i) + c(i)
      if ( a(i).gt.100.0) then
      a(i) = a(i) + scratch(i)
      go to 100
      endif
      c(i) = a(i)*2
100   continue
      end

Created Fortran 90 Module:

module Vecom
 real, dimension(10000) :: scratch
end module Vecom

Created Fortran 90 Code:

     subroutine demo(a, b, c, n)
!---------------------------
! Modules
!---------------------------
     USE Vecom
     implicit none
!---------------------------
!   Dummy Arguments
!---------------------------
     integer n
     real, dimension(n) :: a, b,c
!---------------------------
!    Local Variables
!---------------------------
     integer :: i
!---------------------------
     a = b + c
     where (a > 100.0 )
         a = a + scratch(:n)
     elsewhere
         c = a*2
     end where
     end subroutine demo
Home Contact Legal

Copyright 2003, 2005 Crescent Bay Software Corp.