简体   繁体   中英

Python's equivalent of "EQUIVALENCE" concept in Fortran?

I am interested in rewriting an old Fortran code to Python. The code was for solving any general field variable, call it F (velocity, temperature, pressure, etc). But to solve each variable we have to define EQUIVALENCE of that variable to F .

For example, something like this:

EQUIVALENCE (F(1,1,1),TP(1,1)),(FOLD(1,1,1),TPOLD(1,1))

Is there a Python version of the above concept?

To my knowledge, there is no way to manipulate the memory usage in python. You can perhaps simply use a list.

F=[]

and

FOLD=[]

When you do

F=FOLD 

F and FOLD will point to the same data. I would suggest to use numpy and scipy to create solvers and use python concepts to make it efficient instead of trying to mimic fortran concepts. Especially very old ones.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM