! Sample interface description file for Python/Fortran connection tool. ! Paul F. Dubois dubois1@llnl.gov ! More than one module is allowed, this file just has one. ! testpyf contains doit, times, and bang function doit(x) ! y = doit(x) returns y = x**2 ! x must be a Python float. doubleprecision x !scalar float double precision doit !returns scalar float end SUBROUTINE ITIMES(X, Y, N, W) ! times(x, y, n, w) sets w(i) = x(i) * y(i), i = 1, n integer, intent(in):: x(n), y(n) ! must have size n integer, intent(out):: w(n) integer n END SUBROUTINE itimes subroutine times(x, y, n, w) ! times(x, y, n, w) sets w(i) = x(i) * y(i), i = 1, n double precision, intent(in):: x(n), y(n) ! must have size n doubleprecision, intent(out):: w(n) integer n end subroutine subroutine ctimes(x, y, n, w) C for complex x, y, w, ctimes(x, y, n, w) sets w(i) = x(i) * y(i), i = 1, n complex, intent(in):: x(n), y(n) ! must have size n complex, intent(out):: w(n) integer n end subroutine function bang( r, ra, n, k, c) c You get a big "bang" out of this integer n, k complex c(2) real r, ra(n), bang end function bang function two (a, n, m, k, b, c) real two integer n, m, k real a(n, m), b(m, k) real, intent(out):: c(n, m) end function two subroutine copy1 (a, n, c) integer:: n = size(a) real a(n) real, intent(out):: c(n) end subroutine copy1 subroutine copy2 (a, n, m, c) integer n = size(a, 1), m = size(a, 2) real a(n, m) real, intent(out):: c(n, m) end subroutine copy2 subroutine no_return () end subroutine no_return function sarg (s, slen) ! sarg(s) returns a tuple: ! First component is 1 if s == 'yes' ! Second component is length of s. integer sarg integer, intent(out):: slen character*(*) s end subroutine sarg ! function ctest (n, c, ca, ct, cout, caout) ! complex ctest ! integer n = size(ca) ! complex c, ca(n) ! complex, intent(out):: cout, caout(n) ! complex, intent(temporary):: ct(3) ! end function ctest subroutine inoutme (n, m) integer n integer, intent(inout):: m(n) end subroutine inoutme function nocheck (n, m, z) integer nocheck integer n integer m(*) integer z(3, *) end function nocheck function work (n, x, ly, y) real work integer n = size(x), ly = (n + n) real x(n) real, intent(temporary):: y(ly) end function mirror (a, k, m, n, b, c) real mirror integer n, m, k real a(m, n), b(k, m) real, intent(out):: c(m, n) end function mirror ! function chartest (c) ! !returns "y" if c is x, "n" otherwise ! character chartest, c ! end function chartest