[f2py] allocatable arrays

Benjamin Kutz <[email protected]> Wed, 17 Nov 2010 13:24:14 +0100
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Hi everybody,

I try to work with allocatable arrays. Therfore I ask for your help.
I have programmed the following code.

Fortran:
/module mod
       real   , dimension (:)  , allocatable  :: test
contains
subroutine work
integer i
i=1
allocate ( test(5) )
do i=1,5
   test(i)=60.5
enddo
end subroutine/
end module mod

wrap.pyf:

/python module something ! in
     interface  ! in :something
         module mod ! in : something:mod.F
             real allocatable,dimension(:) :: test
             subroutine work ! in : something:mod.F
             end subroutine work
         end module mod
     end interface
end python module something
/
python:

/>>>from something import *
 >>>mod.test()
 >>>print 'test',mod.test
/
So far everything works fine.
Python prints the allocated array, but with the following values:

test [ -1.58818684e-23   3.26132798e+00  -1.58818684e-23   3.26132798e+00
   -1.58818684e-23]

It is obvious, that those values are wrong. Can anybody see a mistake in 
my syntax? Or is it even not possible to do what I want?
I know the example in the manual, so please give me further support.
Thank you very much in advance.

Regards
Benjamin

_______________________________________________
f2py-users mailing list
f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
http://cens.ioc.ee/mailman/listinfo/f2py-users