Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: F2PY: Access Fortran module data from multiple python module

Thread Tools

Re: F2PY: Access Fortran module data from multiple python module

Gabriel Genellina
Posts: n/a
En Wed, 19 Nov 2008 20:06:37 -0200, Yann Vonder
<(E-Mail Removed)> escribió:

> Here is a description of what I am trying to implement using F2PY:
> I have created two python extension modules using F2PY. The first
> extension
> module (say contains a Fortran module (say "tmod") and a
> subroutine (say "subr1") that modifies the data contained in "tmod". The
> second extension module ( contains the same Fortran module as
> (tmod), and a different subroutine ("subr2") that also modifies
> the data contained in "tmod". I am hoping to be able to have
> and
> share the content of "tmod," in a way that if a call is made,
> from
> python, to "subr1", followed by a call to "subr2", both subroutine access
> the same data contained in "tmod". Unfortunately, if I run the Python

If you put tmod in both libraries, you'll have two copies of it, and two
copies of the data. Can't you join both libraries onto a single one? Or
make one load the other? Or avoid global variables, and pass the required
data to the subroutines? Either way, this is a design problem that you'll
have to solve on the Fortran side, not in Python.

Gabriel Genellina

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing an array from FORTRAN to C then passing it within C andReturning it to FORTRAN deadpickle C Programming 1 11-07-2010 02:38 PM
Many Fortran code! How to call Fortran code from C/C++? Luna Moon C++ 9 09-04-2007 03:49 PM
Cannot call a C module from Fortran Cottonwood C Programming 21 05-24-2006 08:49 PM
Calling subroutine in fortran module Amit C Programming 5 02-07-2005 06:55 AM
Converting Fortran module<->C++ structure Anonymous C++ 7 12-05-2003 03:00 PM