这个问题是关于Fortran的。我需要将索引i
从主程序(即i = 1,30 ......)传递给子程序。我创建了一个获取索引的模块,但不知何故,其他子程序无法使用它。在下面的程序中,我想在子例程index
中使用vals4interp
,我认为应该可以使用index
,因为program main_prog
...
do i = 1, timesteps
...
call getindex(i)
enddo
end main_prog
module myindex
!
implicit none
public
integer,public ::index
contains
! get index of loop
subroutine getindex(index)
integer, intent(inout)::index
print*,'in getindex', index
end subroutine getindex
!
subroutine vals4interp(ti,this,tvar)
...
! Here I need 'index', but it's 0 !
call getindex(ti) !! this doesn't help... dunno why I thought it would ...
end vals4interp
是公开的。但事实并非如此。
"max_errors" : 0.5,