相关疑难解决方法(0)

Fortran - Cython Workflow

我想建立一个工作流程,在Windows机器上使用Cython从Python到达fortran例程

经过一番搜索,我找到了:http: //www.fortran90.org/src/best-practices.html#interfacing-with-chttps://stackoverflow.com/tags/fortran-iso-c-binding/info

和一些代码pices:

Fortran方面:

pygfunc.h:

void c_gfunc(double x, int n, int m, double *a, double *b, double *c);
Run Code Online (Sandbox Code Playgroud)

pygfunc.f90

module gfunc1_interface
    use iso_c_binding
    use gfunc_module

    implicit none

contains
    subroutine c_gfunc(x, n, m, a, b, c) bind(c)
        real(C_FLOAT), intent(in), value :: x
        integer(C_INT), intent(in), value ::  n, m
        type(C_PTR),    intent(in), value :: a, b
        type(C_PTR),                value :: c

        real(C_FLOAT), dimension(:), pointer :: fa, fb
        real(C_FLOAT), dimension(:,:), pointer :: fc

        call c_f_pointer(a, fa, (/ n /))
        call …
Run Code Online (Sandbox Code Playgroud)

python fortran cython fortran-iso-c-binding

20
推荐指数
1
解决办法
3538
查看次数

标签 统计

cython ×1

fortran ×1

fortran-iso-c-binding ×1

python ×1