Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

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

 
 
Gabriel Genellina
Guest
Posts: n/a
 
      11-21-2008
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 fsubr1.so) contains a Fortran module (say "tmod") and a
> subroutine (say "subr1") that modifies the data contained in "tmod". The
> second extension module (fsubr2.so) contains the same Fortran module as
> fsubr1.so (tmod), and a different subroutine ("subr2") that also modifies
> the data contained in "tmod". I am hoping to be able to have fsubr1.so
> and
> fsubr2.so 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
 
 
 
Reply

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



Advertisments