f90wrap
f90wrap copied to clipboard
object-bound procedures...
...do not seem to be supported. I mean here:
module mod1_api
implicit none
type typ1
integer :: n = 2
contains
procedure :: inc
end type
contains
subroutine inc(self)
class(typ1), intent(inout) :: self
t%n = t%n + 1
end subroutine
end module
e.g. of use in fortran:
program prog
use mod1_api
type(typ1) :: t
call t%inc()
print*, t%n
end program
Note it is a secondary issue (there seem to be more advantages not using this feature than otherwise in fortran...), so it would be only justified to work on that if this would require only minor work (e.g. in the wrapper, replace back class with type, remove the contains part of the type and use information provided by procedure :: inc or procedure :: inc => typ1_inc to add methods to the corresponding python class...)
This would be quite handy on the python side though.
An option to f90wrap to create classes automatically from type and functions / methods having the type as first argument could also be a handy feature. What do you think? I will have a look into it at some point...
The second request, to create classes from functions which "look like" methods is already supported. See the --move-methods command line argument to f90wrap. Wrappers for functions/subroutines with a derived type instance as first argument are moved into the Python class defining the type.
Excellent, thanks !
Hi! Is there support scheduled for the first request here, i.e. allow class(object) declaration instead of type(object)?
As far as I know no-one is working on this, but pull requests would be welcome!
Has there been any development on this front? Being able to move type bound procedures into the python class would be very useful!
Are there any new developments in this direction?