我已经问过这个问题了,但是这次我试图更清楚一点。 我真的是Fortran的新手,所以原谅任何sytax错误,这是更多伪代码。fortran模块的范围
module variables
implicit none
SAVE
integer x
integer y
end module
subroutine init()
use variables
x = x + 2
y = y + 1
endsubroutine
那么我的主要程序是
program main
use variables
implicit none
call init()
call some_other_function()
endprogram
如果我包括我的模块将它们保留其值some_other_function() 假设some_other_function()是一个巨大的仿真程序的一个抽象。 我可以依靠我的初始化变量保持它们的值。
这是模块中的SAVE语句吗?
背景信息:我有程序1正在被program2 调用很长时间。 Program1有一个巨大的利用阶段,只需要发生一次。如果我在program2调用program1之前运行了初始阶段,是否可以依赖所有保存的模块声明变量
另外我还有做一个endubroutine保存, 或包括保存在模块 – 2013-04-04 19:31:44