[英]Initializing vector in fortran 95
I am using a external program that is run by a script. 我正在使用由脚本运行的外部程序。 The script require a direction vector to be specified - this is how programs manual describes it:
该脚本需要指定方向向量-这是程序手册对此的描述方式:
real(kind=dp) :: direction(3)
So when running the program script I specify: 因此,在运行程序脚本时,我指定:
direction = (/0.5,0.5,0.5/)
The program yields an error saying it can't read the direction vector - could you tell if I am doing something wrong or this is actually a bug. 该程序产生一个错误,表明它无法读取方向向量-您能否确定我做错了还是这实际上是一个错误。 Thank you.
谢谢。
This 这个
direction = (/0.5,0.5,0.5/)
is syntactically correct for a Fortran statement to set the values of the direction
array. 从语法上来说,对于Fortran语句设置
direction
数组的值是正确的。 But it is not syntactically correct in a namelist file. 但这在名称列表文件中在语法上不正确。 In such a file either
在这样的文件中
direction = 3*0.5
or 要么
direction = 0.5,0.5,0.5
is correct. 是正确的。
Comments turned into an answer not for vainglory but so that future generations will find a question answered. 评论变成了不是虚荣的答案,而是子孙后代才能找到答案的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.