C
Carl
I have been experimenting with f2py and some fortran code that I want to
port to Python.
I have the following fortran file (TEST_00.f):
C FILE: TEST_00.f
SUBROUTINE FOO(WORK)
IMPLICIT REAL*8 (A-H, O-Z)
COMMON /SIZES/ NINT
DIMENSION WORK(NINT)
DIMENSION USOL(NINT)
DO 10 I=1,NINT
WORK(I)=0.0
PRINT *, "In Fortran WORK(I)=", WORK(I)
10 CONTINUE
END
DO 10 I=1,NINT
USOL(I)=0.0
PRINT *, "In Fortran USOL(I)=", USOL(I)
10 CONTINUE
END
C END OF TEST_00.f
and the following signature file (generated by f2py TEST_00.f -m TEST_00 -h
TEST_00.pyf):
python module TEST_00 ! in
interface ! in :TEST_00
subroutine foo(work) ! in :TEST_00:TEST_00.f
real*8 dimension(nint) :: work
integer optional,check(len(work)>=nint),depend(work) ::
nint=len(work)
common /sizes/ nint
end subroutine foo
end interface
end python module TEST_00
When compiling (with f2py -c TEST_00.pyf TEST_00.f) I get the following
error message:
/tmp/tmpl75SQT/src/TEST_00module.c:149: error: `nint' undeclared (first use
in this function)
Question: How can one declare arrays passed as parameters via common block
variables?
Yours/ Carl
port to Python.
I have the following fortran file (TEST_00.f):
C FILE: TEST_00.f
SUBROUTINE FOO(WORK)
IMPLICIT REAL*8 (A-H, O-Z)
COMMON /SIZES/ NINT
DIMENSION WORK(NINT)
DIMENSION USOL(NINT)
DO 10 I=1,NINT
WORK(I)=0.0
PRINT *, "In Fortran WORK(I)=", WORK(I)
10 CONTINUE
END
DO 10 I=1,NINT
USOL(I)=0.0
PRINT *, "In Fortran USOL(I)=", USOL(I)
10 CONTINUE
END
C END OF TEST_00.f
and the following signature file (generated by f2py TEST_00.f -m TEST_00 -h
TEST_00.pyf):
python module TEST_00 ! in
interface ! in :TEST_00
subroutine foo(work) ! in :TEST_00:TEST_00.f
real*8 dimension(nint) :: work
integer optional,check(len(work)>=nint),depend(work) ::
nint=len(work)
common /sizes/ nint
end subroutine foo
end interface
end python module TEST_00
When compiling (with f2py -c TEST_00.pyf TEST_00.f) I get the following
error message:
/tmp/tmpl75SQT/src/TEST_00module.c:149: error: `nint' undeclared (first use
in this function)
Question: How can one declare arrays passed as parameters via common block
variables?
Yours/ Carl