pos
is declared to be intent(in)
which means that it is supposed to be allocated when you enter the routine. Note that this is completely different than using an automatic array in fortran since pos
is a dummy argument. The problem is that since pos
is intent(in)
, f2py
is checking it's declared dimensions with the dimensions that you're passing in (mpart
) because npart
is also supposed to be intent(in)
. Since they don't match, you're getting an error.
In other words, you have 2 intent(in)
variables and the values that you're passing in for them are incompatible. The actual solution really depends on what the subroutine is supposed to be doing, and what the intent of the dummy arguments actually should be.
If pos
is really intent(in)
, then you could in principle change npart
to intent(hide)
in which case, numpy will pass the npart
to your subroutine based on the allocated dimensions of pos
. e.g., I believe it will be called as:
libomp.cic(pos,mpart,boxsize,dim)