FORTRAN:保存阵列和在另一程序使用 [英] FORTRAN: Save array and use in another programme

查看:174
本文介绍了FORTRAN:保存阵列和在另一程序使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能在一个程序创建一个数组,然后在其他程序中使用呢?我期待创建数组非常大,它的创作将需要一段时间,所以我不希望每次运行主程序,而是只用它在其他程序中,一旦创建后的时间,使之重新。由于其规模,我不知道,如果打印到文件,然后阅读它回不会又是相当低效的?

Is it possible to create an array in one programme and then use it in other programmes? The array I am looking to create is very large and its creation will take a while so I don't want to make it anew every time I run the main programme but instead just use it after creating it once in the other programme. Because of its size I'm not sure if printing it to file and then reading it back in would not also be quite inefficient?

有尺寸1的整数数组:300 000 100

It is an integer array of dimensions 1:300 000 and 100.

推荐答案

长注释:

有多种格式可以在其中保存数据:未格式化的Fortran顺序,未格式化的Fortran直接与Fortran无格式流的NetCDF,HDF5,VTK,......真的很难与任何明确的答案回答这个问题。我们真的不知道该怎么耗时它是计算,所以我们无法判断是否节能将耗费更多的时间或没有。

There are many formats in which you can save data: Fortran unformatted sequential, Fortran unformatted direct, Fortran unformatted stream, NetCDF, HDF5, VTK, ... Really difficult to answer this with any definite answer. We really don't know how time consuming it is to compute it, so we cannot judge whether saving would be more time consuming or not.

当然你应该寻找格式化二进制格式。

Definitely you should be looking for unformatted or binary formats.

编辑:您的阵列其实并不是那么大。保存和阅读12/112快速。只需使用一个未格式化的文件格式。

your array is actually not that big. The saving and reading will ne quick. Just use an unformatted file form.

这篇关于FORTRAN:保存阵列和在另一程序使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆