| Newsgroups |
gmane.comp.python.f2py.user |
| Message-ID |
<[email protected]> |
hello,
I have a small program and would like to use its functionality with f2py:
module example_mod
contains
subroutine init(indx,x)
integer, pointer :: indx(:) !outgoing parameter
integer, dimension(:,:), intent(in) :: x !incoming parameter
print *, "shape(x) = ",shape(x)
allocate(indx(10))
do i=1, 10
indx(i) = i
enddo
end subroutine init
end module example_mod
program test
use example_mod
integer,pointer ::indx(:)
double precision, pointer :: x(:,:)
allocate(x(3,3))
call init(indx,x)
print *, "indx(5) = ", indx(5)
end program test
gfortran -c example_mod.f90
gfortran test.f90 -o test example_mod.o
./test
shape(x) = 3 3
indx(5) = 5
Now i compiled with f2py:
f2py -m main -h --overwrite-signature main.pyf example_mod.f90
f2py -c --fcompiler=gfortran main.pyf example_mod.f90
It worked, but i dont know how to call the function, i alwas got memory errors.
Unfortunately i just read that pointer are not supported by f2py. Is there another way to realize it?
Maybe passing the whole arrays?
Thanks in advance
Malte Mauelshagen
-----------------------------------------------------------------------------
Deutsches Zentrum für Luft- und Raumfahrt e.V.
in der Helmholtz-Gemeinschaft
Ausbildung - Duale Hochschule Baden-Württemberg
Malte Mauelshagen
Lilienthalplatz 7
38108 Braunschweig
Tel.: 0531/295-2483