[f2py] Structure support?
James Amundson
amundson@fnal.gov
25 Mar 2002 14:26:37 -0600
On Mon, 2002-03-25 at 11:54, Pearu Peterson wrote:
>
> On 25 Mar 2002, James Amundson wrote:
>
> > Hi,
> >
> > Is there any support for structures in f2py? i.e.,
> >
> > module JFAClass
> > implicit none
> > type triplet
> > integer :: x,y,z
> > end type triplet
> > type(triplet)::mytriplet
> >
> >
> > etc? I'm having trouble with that sort of code. If it is completely
> > unsupported, then I won't bother. If it is unsupported, would there be
> > some sort of workaround?
>
> Currently structures are unsupported. Until I will have some extra time
> and a free F90 compiler to work on this...
If things work out the right way I may be able to help, but it is too
early for me to promise anything. (I'm really just trying to understand
what I should expect to work, not begging for new features.)
I use the Intel Fortran 90 compiler on Linux. It is free for
non-commercial use.
> As a work around, you'll need to write some simple Fortran wrappers to
> access items in structures and then wrap these wrappers to python.
Wrapping the structures by hand I understand. I have two problems, only
one of which I know how to fix:
1) The declaration of the triplet type above causes f2py to barf. (I can
supply details if necessary.) Is there some way to tell f2py to ignore
the type definition.
2) When I try to use the type triplet, i.e., with the line
type(triplet) :: mtriplet
f2py fails to find the type triplet, resulting in this message:
getctype: No C-type found in "{'typespec': 'type', 'typename':
'triplet'}", assuming void.
which then causes an error because void is not in the list of possible
types. I can work around this problem by adding
!f2py intent(hide):: ourtriplet
I do not know how to work around the first problem, however.
Thanks again,
Jim