且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Fortran命令行参数

更新时间:2023-08-25 23:13:28

当然可以使用 GET_COMMAND_ARGUMENT ,就像您已经做的那样,这很容易。问题的难点是根据这些参数字符串,用各种数字,逻辑和字符串值填充变量。这就是以下内容所做的事情:

Of course you can use GET_COMMAND_ARGUMENT as you already do but that is the easy part. The hard part of the problem is to fill your variables with various numerical, logical and string values according to those argument strings. That is what the the following does:

一个人可以使用名称列表进行简单的参数解析。只需添加开始和结束标记。

One can use a namelist for easy argument parsing. Just add the begin and end markers. It is not too flexible, though, but very simple!

A(非常!)简短的Google搜索 getopt 的简单方法!展示了该库的几个Fortran端口(或包括解析在内的类似端口):

A (very!) short google search for getopt reveals a couple of Fortran ports of this library (or similar ones which include parsing):

http://fortranwiki.org/fortran/show/getopt_long_module

> http://www.dominik-epple.de/getoptions/

http://lagrange.mechse.illinois .edu / partmc / partmc-2.4.0 / doc / html / getopt_8_f90_source.html

http://libsufr.sourceforge.net/doxygen/getopt_8f90_source.html (感谢AstroFloyd)

http://libsufr.sourceforge.net/doxygen/getopt_8f90_source.html (thanks to AstroFloyd)