heuwcy 发表于 2022-5-30 10:20:07

求助read (rstplt) recordid

本帖最后由 kyra 于 2022-5-30 10:42 编辑

subroutine cntrlread
!Reads module data from restart-plot file.
!
       read (rstplt) recordid
       inquire (iolength=lent)
   & countn,cpurem(:),dt,dtht,dthy,dtn,emass,emasso,errhld,errmax,
   & gravcn,stdtrn,testda(:),timeht,timehy,tmass,tmasso,
   & cpurei(:),done,help,iextra,ihlppr(:),imdctl(:),iplotlen,
   & iroute,nany,ncase,ncount,nrepet,nstsp,pageno,print,succes,
   & aflag,chngno(:),fail,nmechk,skipt,uniti,unito
       if (recordid%rectyp.ne.'contrl' .or. recordid%nn.ne.0 .or.
   & recordid%noitm.ne.lent) call fabend
       read (rstplt)
   & countn,cpurem(:),dt,dtht,dthy,dtn,emass,emasso,errhld,errmax,
   & gravcn,stdtrn,testda(:),timeht,timehy,tmass,tmasso,
   & cpurei(:),done,help,iextra,ihlppr(:),imdctl(:),iplotlen,
   & iroute,nany,ncase,ncount,nrepet,nstsp,pageno,print,succes,
   & aflag,chngno(:),fail,nmechk,skipt,uniti,unito
       end subroutine cntrlread

本人在做代码解读,上述代码中 read (rstplt) recordid 没太看懂,彭国伦老师书中关于读写部分没看到类似的写法,有大佬指点一下吗,感谢。

kyra 发表于 2022-5-30 10:39:46

rstplt 是个变量(或常量),你替换成它的值,就明白了。比如 rstplt = 12
那么 read(12) recordid 你就明白了,是吧?

heuwcy 发表于 2022-5-30 11:00:13

kyra 发表于 2022-5-30 10:39
rstplt 是个变量(或常量),你替换成它的值,就明白了。比如 rstplt = 12
那么 read(12) recordid 你就明 ...

在这个模块里 没看到关于rstplt的变量定义,我以为是在路径查找文件名的文本,我再仔细检查下。

kyra 发表于 2022-5-30 14:31:19

看看是否 use 了其他模块。rstplt 是否在其他模块定义
页: [1]
查看完整版本: 求助read (rstplt) recordid