如果您能说服Python代码创建一些Fortran编译器识别为C结构的东西,并使用Fortran的C与C的互操作特性来读写它们,那么您可能会取得更大的成功。Metcalf, Reid and Cohen状态(p246)
These restrictions allow the type to interoperate with a C struct type
that has the same number of components. The components correspond by
position in their definitions. Each Fortran component must be
interoperable with the corresponding C component.
这也许是一个延伸的评论,而不是一个答案。。。在
据我所知,
f2py
将把Fortran过程(即函数和子例程)的签名转换成Python。我不认为f2py
会将Fortran派生的类型定义转换为Python对象定义。我已经好几年没有使用f2py
,所以我可能在这个问题上错了。用Fortran派生类型的实例来识别Python对象,这一明显的方法可能很难实现。在如果您能说服Python代码创建一些Fortran编译器识别为C结构的东西,并使用Fortran的C与C的互操作特性来读写它们,那么您可能会取得更大的成功。Metcalf, Reid and Cohen状态(p246)
相关问题 更多 >
编程相关推荐