Comments (5)
Thanks for reporting, I will have a look at the asterisk parsing.
For the real(kind=8)
case, note that you need to supply a file containing the mapping from kinds to C types as no attempt is made to interpret the kind strings (I admit that this is silly when they are simply numbers like kind=8
, I'll try to fix this soon too...). Here's an example kind_map
for your case:
$ cat kind_map
{
'real': {'': 'float',
'8': 'double'}
}
$ f90wrap -k kind_map test.f90
which results in the correct wrapper:
subroutine f90wrap_foo(a, b)
implicit none
external foo
real(8), intent(in) :: a
integer :: b
call foo(a, b)
end subroutine f90wrap_foo
from f90wrap.
(Oops, signed in as wrong GitHub user, previous comment was by me as well)
from f90wrap.
Interfaced functions of a f90 module are translated to static methods in the auto generate python class, however in the function list for the overloaded call loop, the function names are not prefixed by Class_name, i.e. [Class_name.method1(a,b), Class_name.method1(a,b,c), ... ]
Understood. Do you have a simple test case I could use to speed up debugging this issue?
from f90wrap.
Hi, sure no problem.
example.F90
!-*-f90-*-
module class_example
implicit none
private
public :: Example, return_example
interface return_example
module procedure return_example_first, return_example_second, return_example_third
end interface return_example
type Example
integer :: first
integer :: second
integer :: third
end type Example
! singleton
type(Example) :: this
contains
!------------------------------------------------------------------------------------!
function return_example_first(first) result(instance)
implicit none
integer :: first
type(Example) :: instance
this%first = first
instance = this
return
end function return_example_first
!------------------------------------------------------------------------------------!
function return_example_second(first,second) result(instance)
implicit none
integer :: first
integer :: second
type(Example) :: instance
this%first = first
this%second = second
instance = this
return
end function return_example_second
!------------------------------------------------------------------------------------!
function return_example_third(first,second,third) result(instance)
implicit none
integer :: first
integer :: second
integer :: third
type(Example) :: instance
this%first = first
this%second = second
this%third = third
instance = this
return
end function return_example_third
!------------------------------------------------------------------------------------!
end module class_example
Then f90wrap -m example ./example.F90
produces example.py, which contains the following loop over interfaced member functions (which should be prefixed with the class name since they are static, or not be static):
example.py (abridged)
...
@staticmethod
def _return_example_third(first, second, third):
...
@staticmethod
def return_example(*args, **kwargs):
"""
return_example(*args, **kwargs)
Defined at ./example.F90 lines 8-10
Overloaded interface containing the following procedures:
_return_example_first
_return_example_second
_return_example_third
"""
for proc in [_return_example_first, _return_example_second, \
_return_example_third]:
try:
return proc(*args, **kwargs)
except TypeError:
continue
Manually changing the above list to,
for proc in [Class_Example._return_example_first, \
Class_Example._return_example_second, \
Class_Example._return_example_third]:
Fixes the python runtime error (NameError: global function return_example* is not defined).
from f90wrap.
Interface generation should now be fixed. I didn't look at the asterisk parsing yet.
from f90wrap.
Related Issues (20)
- Help wrapping a project HOT 7
- Data type determined at run time
- Issues with Compiling MPI Program HOT 3
- Support for Intel oneAPI2022
- multidimensional arrays in derived types broken if compiled with long integers as default HOT 1
- Python 3.11 support HOT 8
- Pre-build f90wrap wheels for windows HOT 3
- Derived types containing allocatable character arrays
- `integer, value, intent(in)`/`integer, value` arguments converted to/wrapped as `real`
- Wrong module class name in a call to `f90wrap.runtime.FortranDerivedTypeArray` HOT 2
- numpy > 1.23 support HOT 2
- Switch to pyproject.toml based build system HOT 7
- duplicate symbol in formal argument list HOT 2
- Issues on Mac OS X - for f90wrap 0.2.12 HOT 1
- BUG: Routines including procedure arguments (callbacks) are excluded HOT 1
- Can `f90wrap`parse FORD docstrings?
- unexpected removal of procedures associated with derived types HOT 1
- install fails on macos 14 HOT 4
- Binary Wheels for Mac HOT 1
- example with fortran to python callback function fails with as of f90wrap v0.2.13: "bad argument to internal function" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from f90wrap.