Screenshot_2018-12-04_16-10-20.png (146.33 KB, 下载次数: 502)
Jackdaw 发表于 2018-12-4 16:11
文件内容和变量类型不对应,检查输入文件吧
do i = 1, N_Param
curr => cfg%record(i)
curr%id = i
curr%pname = PARAM_NAME(i)
curr%ptype = PARAM_TYPE(i)
curr%isArray = PARAM_ARRAY(i)
curr%defaultval = PARAM_DVAL(i)
if (curr%ptype .eq. TYPE_REAL) then
read(curr%defaultval,*) curr%rval
else if (curr%ptype .eq. TYPE_INTEGER) then
read(curr%defaultval,*) curr%ival
else if (curr%ptype .eq. TYPE_COMPLEX) then
read(curr%defaultval,*) curr%cval
end if
type(Param),pointer :: curr
integer :: i
character(len=*), parameter :: PARAM_DVAL(N_Param) = &
&(/"-1 ", "HSF.in ", "HSF.out ", "12 ", "0.0 ", &
& "0 ", &
& "0.001 ", "0.0 ", "8 ", "0.125 ", "0.001 ", &
& "quest ", "geom.def", "8 ", "0.0 ", "8 ", &
& "16 ", "10 ", "50 ", "4 ", "12 ", &
& "12 ", "5000 ", "30 ", "0 ", "1000 ", &
& "12 ", "4 ", "4 ", "2 ", "0.0001 ", &
& "0 ", "1.0 ", "10 "/)
li913 发表于 2018-12-4 16:08
最好截个图。既然已经运行了,基本上和编译链接没有关系,不要胡猜。
do i = 1, N_Param
curr => cfg%record(i)
curr%id = i
curr%pname = PARAM_NAME(i)
curr%ptype = PARAM_TYPE(i)
curr%isArray = PARAM_ARRAY(i)
curr%defaultval = PARAM_DVAL(i)
if (curr%ptype .eq. TYPE_REAL) then
read(curr%defaultval,*) curr%rval
else if (curr%ptype .eq. TYPE_INTEGER) then
read(curr%defaultval,*) curr%ival
else if (curr%ptype .eq. TYPE_COMPLEX) then
read(curr%defaultval,*) curr%cval
end if
character(len=*), parameter :: PARAM_DVAL(N_Param) = &
&(/"-1 ", "HSF.in ", "HSF.out ", "12 ", "0.0 ", &
& "0 ", &
& "0.001 ", "0.0 ", "8 ", "0.125 ", "0.001 ", &
& "quest ", "geom.def", "8 ", "0.0 ", "8 ", &
& "16 ", "10 ", "50 ", "4 ", "12 ", &
& "12 ", "5000 ", "30 ", "0 ", "1000 ", &
& "12 ", "4 ", "4 ", "2 ", "0.0001 ", &
& "0 ", "1.0 ", "10 "/)
do i = 1, N_Param
print *, i
curr => cfg%record(i)
curr%id = i
curr%pname = PARAM_NAME(i)
curr%ptype = PARAM_TYPE(i)
curr%isArray = PARAM_ARRAY(i)
curr%defaultval = PARAM_DVAL(i)
if (curr%ptype .eq. TYPE_REAL) then
read(curr%defaultval,*) curr%rval
else if (curr%ptype .eq. TYPE_INTEGER) then
read(curr%defaultval,*) curr%ival
else if (curr%ptype .eq. TYPE_COMPLEX) then
read(curr%defaultval,*) curr%cval
end if
捕获.PNG (55.17 KB, 下载次数: 476)
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |