[英]Python's equivalent of "EQUIVALENCE" concept in Fortran?
I am interested in rewriting an old Fortran code to Python.我有兴趣将旧的 Fortran 代码重写为 Python。 The code was for solving any general field variable, call it
F
(velocity, temperature, pressure, etc).该代码用于求解任何一般场变量,称之为
F
(速度、温度、压力等)。 But to solve each variable we have to define EQUIVALENCE
of that variable to F
.但是要解决每个变量,我们必须将该变量的
EQUIVALENCE
定义为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?是否有上述概念的 Python 版本?
To my knowledge, there is no way to manipulate the memory usage in python.据我所知,没有办法在 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. F 和 FOLD 将指向相同的数据。 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.
我建议使用 numpy 和 scipy 来创建求解器并使用 python 概念使其高效,而不是试图模仿 fortran 概念。 Especially very old ones.
尤其是很老的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.