program select
INTEGER medium,isal
real ew
medium=1
isal=0
call DIEL_WAT(medium, isal, ew)
write(*,*) ew
write(*,*) isal
end
subroutine DIEL_WAT(medium, isal, ew)
INTEGER medium,isal,a,b
real ew
SELECT CASE (isal)
CASE ( 1 )
a =20
CASE ( 2 )
a =40
endselect
SELECT CASE (medium)
CASE ( 0 )
b =0
CASE ( 1 )
b=1
CASE ( 2 )
b=2
endselect
ew = a+b
end
476 Bytes, 下载次数: 1
program select
integer :: medium = 1 , isal = 1
real :: ew
call DIEL_WAT(medium, isal, ew)
write(*,*) ew, isal
end program select
subroutine DIEL_WAT(medium, isal, ew)
Integer , parameter :: AList(0:*) = [0,20,40]
Integer , parameter :: BList(0:*) = [0,1,2]
iNTEGER medium,isal
real ew
ew = AList(isal)+BList(medium)
end subroutine DIEL_WAT
vvt 发表于 2022-5-26 15:29
如果你的 isal , medium 可能的取值是连续的。可以尝试用数组表来代替 select
[mw_shl_code=fortran,true]p ...
zjk0112 发表于 2022-5-26 23:01
我用vs2022+oneAPI的Fortran编辑器跑mkl里的例子就是遇到过这样的情况。没有转置时,索引的值是0,一转置就 ...
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |