Skip to content

Using user defined type #49

@eogbe

Description

@eogbe

Hi

I am trying to generate a wrapper for my f90 code using f2py. It works for common types like int, real, etc but when i have user defined type I get the following error:

running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "mc79reorder" sources
creating /tmp/tmpDnh_3K/src.linux-x86_64-2.7
f2py options: []
f2py: mc79sign.pyf
Reading fortran codes...
Reading file 'mc79sign.pyf' (format:free)
Post-processing...
Block: mc79reorder
Block: hsl_mc79_integer
Block: unknown_type
Block: mc79_matching
Post-processing (stage 2)...
Block: mc79reorder
Block: unknown_interface
Block: hsl_mc79_integer
Block: unknown_type
Block: mc79_matching
Building modules...
Building module "mc79reorder"...
Constructing F90 module support for "hsl_mc79_integer"...
Skipping type unknown_type
Creating wrapper for Fortran subroutine "mc79_matching"("mc79_matching")...
Constructing wrapper function "hsl_mc79_integer.mc79_matching"...
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: No C-type found in "{'attrspec': [], 'typename': 'mc79_control', 'intent': ['in'], 'typespec': 'type'}", assuming void.
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: "integer(kind=myint_mc79)" is mapped to C "int" (to override define dict(integer = dict(myint_mc79="")) in /home/eogbe/Documents/solvers/hslcodes/hsl_mc79-1.1.0/src/test/newtest/.f2py_f2cmap file).
getctype: No C-type found in "{'attrspec': [], 'typename': 'mc79_control', 'intent': ['in'], 'typespec': 'type'}", assuming void.
getctype: No C-type found in "{'attrspec': [], 'typename': 'mc79_control', 'intent': ['in'], 'typespec': 'type'}", assuming void.
Traceback (most recent call last):
File "/home/eogbe/anaconda2/bin/f2py", line 28, in
main()
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/f2py2e.py", line 648, in main
run_compile()
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/f2py2e.py", line 633, in run_compile
setup(ext_modules=[ext])
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/distutils/core.py", line 169, in setup
return old_setup(**new_attr)
File "/home/eogbe/anaconda2/lib/python2.7/distutils/core.py", line 151, in setup
dist.run_commands()
File "/home/eogbe/anaconda2/lib/python2.7/distutils/dist.py", line 953, in run_commands
self.run_command(cmd)
File "/home/eogbe/anaconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/distutils/command/build.py", line 47, in run
old_build.run(self)
File "/home/eogbe/anaconda2/lib/python2.7/distutils/command/build.py", line 127, in run
self.run_command(cmd_name)
File "/home/eogbe/anaconda2/lib/python2.7/distutils/cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "/home/eogbe/anaconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
cmd_obj.run()
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/distutils/command/build_src.py", line 148, in run
self.build_sources()
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/distutils/command/build_src.py", line 165, in build_sources
self.build_extension_sources(ext)
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/distutils/command/build_src.py", line 327, in build_extension_sources
sources = self.f2py_sources(sources, ext)
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/distutils/command/build_src.py", line 544, in f2py_sources
+ ['--build-dir', target_dir, source])
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/f2py2e.py", line 440, in run_main
ret = buildmodules(postlist)
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/f2py2e.py", line 384, in buildmodules
dict_append(ret[mnames[i]], rules.buildmodule(modules[i], um))
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/rules.py", line 1211, in buildmodule
mr, wrap = f90mod_rules.buildhooks(m)
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/f90mod_rules.py", line 202, in buildhooks
api, wrap = rules.buildapi(b)
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/rules.py", line 1368, in buildapi
vrd = capi_maps.sign2map(a, var[a])
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/capi_maps.py", line 603, in sign2map
ret['pydocsign'], ret['pydocsignout'] = getpydocsign(a, var)
File "/home/eogbe/anaconda2/lib/python2.7/site-packages/numpy/f2py/capi_maps.py", line 412, in getpydocsign
sig = '%s : %s %s%s' % (a, opt, c2py_map[ctype], init)
KeyError: 'void'

Is there any work around derived data types? I 'm using f2py with gfortran and python 2.7 on centOS.
Emmanuel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions