Den 03.07.2012 11:54, skrev George Nurser:
>> module zp
>>    implicit none
>>    contains
>>    subroutine ics(..., num_particles, particle_mass, positions, velocities)
>>      use data_types, only : dp
>>      implicit none
>>      ... inputs ...
>>      integer, intent(out) :: num_particles
>>      real (kind=dp), intent(out) :: particle_mass
>>      real (kind=dp), intent(out), dimension(:, :), allocatable :: positions,
>> velocities
>>      ...
>>    end subroutine
>> end module
>>

This looks like a Fortran error.  deallocate is called automatically on 
allocatable arrays when a subroutine exit (guarranteed from Fortran 95, 
optional in Fortran 90). Allocatable arrays might even be put on the 
stack depending on the requested size. I am not even sure intent(out) on 
an allocatable array is legal or an error the compiler should trap, but 
it is obviously very bad Fortran. So "positions" and "velocities" should 
here be declared pointer, not allocatable.

As for f2py: Allocatable arrays are local variables for internal use, 
and they are not a part of the subroutine's calling interface. f2py only 
needs to know about the interface, not the local variables.

Sturla




_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to