Re: [f2py] problems with parameters and common blocks
Ben Forbes <[email protected]> Mon, 15 Aug 2011 17:05:41 +1000
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <CACc3ktTEutqGcvQ0aZfDnaYE8WbB9MaLCzxcgtGRVwA_roSh9Q@mail.gmail.com> |
Can you please provide a code snippet? Just enough to get a feel for your problem. It sounds something like this: subroutine main() real::array(20) common /cname/ array ! Does not know there are only 4 elements end subroutine subroutine initialise() real::array(20) common /cname/ array !Initialise first 4 elements of array end subroutine In this case, you should just add an array count integer to the common block. Ben On Mon, Aug 15, 2011 at 4:30 PM, teichmann.clemens <teichmann.clemens-gM/[email protected]> wrote: > Hello, > > I'm developing a python interface for an xml data set and an old fortran > program (xml -> python -> fortran). Because the main computation subroutine > needs many variables, the values are written to variables in common-blocks. > In this common blocks are also arrays that have the size of previously given > parameters. These parameters are just maximum values (e.g. a maximum amount > of sth to compute). So an arrays is initiated with the size 20 even though > there were just the first four entries set. In the subroutine, e.g. > for-loops just iterate over those four entries using a previously given > counter. My problem is that f2py just know the max value (which makes sense) > and so if i handover a python list with just those four values, there is an > system error: > SystemError: error return without exception set > 0-th dimension must be fixed to 22 but got 4 > > Is there any possibilty to either change the parameters before the modul is > implemented or change the size of the arrays? I thought of using dummy > entries for the python lists, but this isn't my desired solution. > > best regards, > Clemens Teichmann > > _______________________________________________ > f2py-users mailing list > f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] > http://cens.ioc.ee/mailman/listinfo/f2py-users > > -- Benjamin D. Forbes School of Physics The University of Melbourne Parkville, VIC 3010, Australia