-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
array function error #59
Comments
Hello, My code is:
When I call f90wrap, f90wrap_toplevel.f90 is generated:
And my test.py file is:
So I cannot get the value of 'b' variable. Is it possible to make this work? |
This should work as you expect, I’ll take a look. Thanks for reporting! |
I tried your example, I think it's working correctly - if you preallocate arrays from Python you can pass them in and out of Fortran and they are modified in place, e.g: import test
import numpy as np
a = np.zeros(10, dtype=np.float32)
b = np.zeros(10, dtype=np.float32)
a[:] = [i for i in range(len(a))]
test.test(a, b)
print(b) shows the modified version of the array |
Thanks, it's working! |
Consider the simple fortran function:
The f90wrap wrapper yields two parmeters n and n0 for some reason (does not dare to guess the output size, I suppose this is related to issue #33).
but the corresponding python wrapper is inconsistent (import and doc removed for brevety), lacking the n0 parameter.
So far my workaround is to use sed to fix the python wrapper:
But something less ad-hoc would be preferable of course.
Note that in this example the fortran wrapper fails (segmentation fault), but it works well when used in a module.
The text was updated successfully, but these errors were encountered: