Fortran PARAMETER变量从输入初始化 [英] Fortran PARAMETER variable initialized from input

查看:225
本文介绍了Fortran PARAMETER变量从输入初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Fortran中,是在运行时还是编译时设置的 PARAMETER 属性?
我想知道是否可以在运行时传递数组的大小,并将此集合设置为 PARAMETER



可以这样做吗?如果是这样,怎么样?如果不是,为什么?

解决方案

如果要将数组大小定义为运行时,则需要动态分配。所有参数(常量)必须定义为编译时间。


In Fortran, is the PARAMETER attribute set at runtime or compilation time? I was wondering if I can pass in the size the of the array at run time and have this set as PARAMETER.

Can this be done? If so, how? If not, why?

解决方案

You need dynamic allocation if the size of your array is to be defined as runtime. All parameter (constants) must be defined as compiling time.

这篇关于Fortran PARAMETER变量从输入初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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