小编Joh*_*sty的帖子

(1) 处的外部函数“f”在 f2py 的子例程中没有隐式类型

我已经使用 Fortran 90 一段时间了,最​​近决定使用 f2py 封装一些模块,以使用 Python 作为前端来简化原型设计。

\n\n

但是,在尝试编译传递外部函数(来自 Python)的子例程时,我遇到了错误。这是复制错误的代码:

\n\n
! file: callback.f90\nsubroutine callback(f,x,y)\n  implicit none\n  ! - args -\n  ! in\n  external :: f\n  real(kind=kind(0.0d0)), intent(in) :: x\n  ! out\n  real(kind=kind(0.0d0)), intent(inout) :: y\n\n  y = f(x)\nend subroutine\n
Run Code Online (Sandbox Code Playgroud)\n\n

现在,如果我使用 f2py 生成签名文件 (.pyf),我将获得以下结果:

\n\n
!    -*- f90 -*- \n! Note: the context of this file is case sensitive.\npython module callback__user__routines \ninterface callback_user_interface \n    function f(x) result (y) ! in :callback:callback.f90\n        intent(inout) f\n        real(kind=kind(0.0d0)) intent(in) :: x\n        real(kind=kind(0.0d0)) …
Run Code Online (Sandbox Code Playgroud)

python fortran external callback f2py

2
推荐指数
1
解决办法
1525
查看次数

标签 统计

callback ×1

external ×1

f2py ×1

fortran ×1

python ×1