C语言转换为Fortran语言代码示例 - 条件语句和数学运算
if(temp>=456.0 .and. temp<525.0) then C_UDMI(cell,thread,0)=C_UDMI(cell,thread,0) C_UDMI(cell,thread,1)=C_UDMI(cell,thread,1) C_UDMI(cell,thread,2)=C_UDMI(cell,thread,2) end if if(temp>=525.0) then HMXr11=((HMXktemp)/HMXh)exp((tempHMXSf1-HMXEf1)/(Rtemp)) HMXr12=((HMXktemp)/HMXh)exp((tempHMXSr1-HMXEr1)/(Rtemp)) HMXr21=((HMXktemp)/HMXh)exp((tempHMXSf2-HMXEf2)/(Rtemp)) HMXr22=((HMXktemp)/HMXh)exp((tempHMXSr2-HMXEr2)/(Rtemp)) HMXr3=HMXZ3exp(-HMXEf3/(Rtemp)) HMXr4=HMXZ4exp(-HMXEf4/(Rtemp)) if(C_UDMI(cell,thread,0)>=C_UDMI(cell,thread,1)) then HMXd0=-(C_UDMI(cell,thread,0)*HMXr11-C_UDMI(cell,thread,1)*HMXr12)-(C_UDMI(cell,thread,0)C_UDMI(cell,thread,1)(HMXr21-HMXr22)) HMXd1=(C_UDMI(cell,thread,0)*HMXr11-C_UDMI(cell,thread,1)*HMXr12)+(C_UDMI(cell,thread,0)C_UDMI(cell,thread,1)(HMXr21-HMXr22))-(C_UDMI(cell,thread,1)*HMXr3)-(C_UDMI(cell,thread,1)*C_UDMI(cell,thread,2)*HMXr4) HMXd2=(C_UDMI(cell,thread,1)*HMXr3)+(C_UDMI(cell,thread,1)*C_UDMI(cell,thread,2)*HMXr4) end if if(C_UDMI(cell,thread,0)<C_UDMI(cell,thread,1)) then HMXd0=-C_UDMI(cell,thread,0)*HMXr11-C_UDMI(cell,thread,0)*C_UDMI(cell,thread,1)*HMXr21 HMXd1=C_UDMI(cell,thread,0)*HMXr11+(C_UDMI(cell,thread,0)C_UDMI(cell,thread,1)HMXr21)-(C_UDMI(cell,thread,1)HMXr3)-(C_UDMI(cell,thread,1)C_UDMI(cell,thread,2)HMXr4) HMXd2=(C_UDMI(cell,thread,1)HMXr3)+(C_UDMI(cell,thread,1)C_UDMI(cell,thread,2)HMXr4) end if C_UDMI(cell,thread,0)=C_UDMI(cell,thread,0)+HMXd0ts C_UDMI(cell,thread,1)=C_UDMI(cell,thread,1)+HMXd1ts C_UDMI(cell,thread,2)=C_UDMI(cell,thread,2)+HMXd2ts HMXsource1=HMXpHMXQ1(C_UDMI(cell,thread,0)HMXr11-C_UDMI(cell,thread,1)HMXr12) HMXsource2=HMXpHMXQ2(C_UDMI(cell,thread,0)C_UDMI(cell,thread,1)(HMXr21-HMXr22)) HMXsource3=HMXpHMXQ3(C_UDMI(cell,thread,1)HMXr3) HMXsource4=HMXpHMXQ4(C_UDMI(cell,thread,1)*C_UDMI(cell,thread,2)*HMXr4) end if
原文地址: http://www.cveoy.top/t/topic/lG8J 著作权归作者所有。请勿转载和采集!