如何在fortran 90中定义函数 [英] how to define function in fortran 90
问题描述
我试图在我的模块代码中定义一个函数,并在main fortran代码中调用它,但是当我想编译我的代码时,我收到了这个错误:
这个实际参数必须是外部用户函数的名称或内部函数的名称。
我的函数是:
$ b $ pre $ 函数func(x)
隐式无
双精度函数,x
func = x
RETURN
结束函数func
并在主代码中
调用Romberg(dra,func,ra(mm),ra(kk))
我想测量 ra(mm)
& ; ra(kk)
Add:
外部函数
in呼叫者,召集者。这告诉调用者func是一个外部过程。你显然已经用Romberg声明了一个明确的接口来指定参数是一个过程。
I'm trying to define a function in my module code and call it in the main fortran code but when I want to compile my code I'm receiving this error :
This actual argument must be the name of an external user function or the name of an intrinsic function.
and my function is :
Function func (x)
implicit none
double precision func,x
func=x
RETURN
end function func
and in the main code
call Romberg (dra,func,ra(mm),ra(kk))
I want to measure the destance between ra(mm)
& ra(kk)
Add:
external func
in the caller. This tells the caller that "func" is an external procedure. You evidently have Romberg declared with an explicit interface specifying the argument is a procedure.
这篇关于如何在fortran 90中定义函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!