【发布时间】:2022-01-19 06:55:52
【问题描述】:
我有 Fortran 主代码。我希望从我的主 Fortran 代码中调用一个 python 程序并在这两个代码之间传递数组。
我见过几个 F2py 的例子。似乎 python 代码作为主要代码。正如我之前所描述的,我想要反过来。
让我们在主 Fortran 代码中有一个子程序:
subroutine test(nx,ny,mask)
integer, intent(in) :: nx, ny
integer, dimension(nx,ny), intent(inout) :: mask
call someOperation(nx, ny, mask)
end subroutine test
现在,someOperation 在 python 中完成,带有标量值的多维数组将在 Fortran 和 python 之间交换。
怎么做?
【问题讨论】: