Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Passing arrays in subroutines

Averkov__Igor
Beginner
238 Views

Hello!
I am interesting, in wich cases the compiler will force to allocate any of used array from the memory


Case 1:
subroutine VolFracToMassFrac(VolFrac, MassFrac)
  real, intent(in) :: VolFrac(:)  
  real, intent(in) :: MassFrac(:)
    ...
end function


Case 2:
function VolFracToMassFrac(VolFrac, SubstCodes) result(Res)
  real    , intent(in) :: VolFrac(:)
  real Res (SIZE(VolFrac))          
    ...
end function


Case 3:
subroutine VolFracToMassFrac(VolFrac, MassFrac)
  real, intent(in) :: VolFrac(:)  
  real, intent(in) :: MassFrac(:)
      real Temp(SIZE(VolFrac))
    ...
end function


I am using Compaq Visual Fortran, but I am also intresting how it will be in the Intel Compiler.
Thank you

 

0 Kudos
1 Reply
Averkov__Igor
Beginner
238 Views

In case 2 it would be written:

Case 2:
function VolFracToMassFrac(VolFrac) result(Res)
  real    , intent(in) :: VolFrac(:)
  real Res (SIZE(VolFrac))          
    ...
end function

 

0 Kudos
Reply