Re: [f2py] COMMON BLOCK revisited

"Charlie E. Strauss" <[email protected]>
Newsgroups gmane.comp.python.f2py.user
Message-ID <[email protected]>
Why can't you put this all into one module?

> Hi
>
> I dug the user mailing list and found this post on COMMON BLOCKS:
>
> -------- thread message ----------------------------------------
>> Pearu,
>>
>> I have the same common blocks in different modules.  I'd like to make
>> common blocks from both modules reference the same variable.  I can't
>> seem to do it.
>
> Because it is not possible.
>> .................
> No. And it is not due to f2py limitations. Namely COMMON blocks
> are 'common' only for routines that are inside of the same executable
> (e.g. shared module). And each time a module is loaded, a memory is
> allocated for COMMON blocks and pointers inside Fortran routines (inside
> that module) point to these COMMON blocks, roughly speaking.
> If you load another module, it will have its own COMMON blocks and
> pointers in its routines will point to that.
>> ................
> Sorry, not possible :( COMMON blocks just are sticked to one executable
> and I don't see any ways how they could be shared between different
> executables.
> ------ end of thread message --------------------------------
>
> I need to wrap a f77 code which has common block declared in almost every
> subroutine. There are inputs like max dimensions of arrays in the common
> block used by every subroutine.
>
> So explicitly using assignment to pass the value to every common block in
> each subroutine is not worth it (but definitely a solution). Changing the
> code by removing the common block is one thing, but are there other ways ?
>
> Referencing a numpy variable to the variable in the COMMON BLOCK is
> impossible according to the above post. And assignment of a numpy array to
> the wrapped COMMON BLOCK array (I believe) copies the contents and does
> not
> reference (or is there a way).
>
>>> import WarppedSubroutine
>>> NumpyReal = 0.1
>>> WrappedSubroutine.CommonBlock.RealInBlock = NumpyReal
>
> I would appreciate if some one can give some hints.
>
> Regards,
>
> --
> Pavanakumar Mohanamuraly
>
>
>
> _______________________________________________
> f2py-users mailing list
> f2py-users-Y4l6ocDipWCuvFJfX82//[email protected]
> http://cens.ioc.ee/mailman/listinfo/f2py-users
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.