[語法]從fortran改成c++
老實說我對兩個程式語言都不熟,我也知道程式沒有很難
可是我盡量從fortran改成C++程式,改成這樣還是一堆錯誤
請各位前輩看一下哪邊還需要更改
成功的話 小弟贈予p幣500
自己改的程式碼連接 http://rafb.net/p/PgBVZ999.html
原文程式碼連接 http://src.wtgstudio.com/?cAajG0
-----------------------------這是我改過的程式------------------------------
void
u_userNucl (float dtn, /* gaussian distribution parameter */
float dts, /* gaussian distribution parameter */
float nmax, /* gaussian distribution parameter */
double tliq, /* liquidus temperature */
double rtime, /* current time */
double pdt, /* time step */
int ir, /* cell reference number */
double x, /* first cell coordinates */
double y, /* second cell coordinates */
double z, /* third cell coordinates */
float *phi1, /* first Euler angle */
float *phi, /* second Euler angle */
float *phi2, /* third Euler angle */
double tc, /* cell temperature */
float *und, /* current nucleation undercooling */
float dt0, /* initial nucleation undercooling */
double crliq, /* cooling rate in the cell at liquidus */
double tmax, /*maximum temperature reached in the cell*/
int nuclv, /*number of user variables for nucleation*/
float *puv) ; /* array of user variables for nucleation*/
/*rtime*4 int dts,nmax,phi1,phi,phi2,und,dt0,puv(nuclv)*/
int main(void)
{
if (rtime=0.)
puv(1) = .0
int extime=5000+100*(tliq-tc)
if (extime<0.)
extime=.0
// EXTIME is the typical extinction time of a site which depends on
// temperature
puv(1) = puv(1) + pdt/extime
if (puv(1)>1.)
und= 1000.
}
----------------------------------這是fortran原文-----------------------------
SUBROUTINE USERNUCL(DTN,DTS,DNMAX,TLIQ,RTIME,PDT,IR,X,Y,Z,
& I1,PHI,PHI2,TC,UND,DT0,CRLIQ,TMAX,NUCLV,PUV)
C
C ///////////////////////////////////////////////////////////////////
C //
C // ** PURPOSE **
C // THIS USER SUBROUTINE DESCRIBES THE CHANGE OF NUCLEATION
c // BEHAVIOUR AS THE METAL IS MAINTAINED AT HIGH TEMEPRATURE
C //
C //
C // ** INPUT ARGUMENTS **
C // [S] DTN GAUSSIAN DISTRIBUTION PARAMETER
C // [S] DTS GAUSSIAN DISTRIBUTION PARAMETER
C // [S] DNMAX GAUSSIAN DISTRIBUTION PARAMETER
C // [D] TLIQ LIQUIDUS TEMPERATURE
C // [D] RTIME CURRENT TIME
C // [D] PDT TIME STEP
C // [I] IR CELL REFERENCE NUMBER
C // [D] X,Y,Z CELL COORDINATES
C // [S] PHI1 1st EULER ANGLE
C // [S] PHI 2nd EULER ANGLE
C // [S] PHI2 3rd EULER ANGLE
C // [D] TC CELL TEMPERATURE
C // [S] UND CURRENT NUCLEATION UNDERCOOLING
C // [S] DT0 INITIAL NUCLEATION UNDERCOOLING
C // [D] CRLIQ COOLING RATE IN THE CELL AT LIQUIDUS
C // [D] TMAX MAXIMUM TEMPERATURE REACHED IN THE CELL
C // [I] NUCLV NUMBER OF USER VARIABLES FOR NUCLEATION
C // [S] PUV ARRAY OF USER VARIABLES FOR NUCLEATION
C //
C //
C // ** OUTPUT ARGUMENTS **
C // [S] UND CURRENT NUCLEATION UNDERCOOLING
C // [S] PHI1 1st EULER ANGLE
C // [S] PHI 2nd EULER ANGLE
C // [S] PHI2 3rd EULER ANGLE
C //
C //
C ///////////////////////////////////////////////////////////////////
CC
IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C
REAL*4 DTN,DTS,DNMAX,PHI1,PHI,PHI2,UND,DT0,PUV(NUCLV)
CC
IF (RTIME .EQ. 0.) THEN
PUV(1) = .0
END IF
EXTIME =5000 + 100*(TLIQ-TC);
IF (EXTIME .LT. 0.) EXTIME = .0
C// EXTIME is the typical extinction time of a site which depends on
C// temperature
PUV(1) = PUV(1) + PDT/EXTIME
IF (PUV(1) .GE. 1.) THEN
UND = 1000.
END IF
END
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.118.198.85
※ 編輯: Homeparty 來自: 140.118.198.85 (02/14 17:02)
推
02/15 00:07, , 1F
02/15 00:07, 1F
推
02/15 00:11, , 2F
02/15 00:11, 2F
→
02/15 00:11, , 3F
02/15 00:11, 3F
推
02/15 00:20, , 4F
02/15 00:20, 4F
推
02/15 00:22, , 5F
02/15 00:22, 5F
推
02/15 00:24, , 6F
02/15 00:24, 6F
→
02/15 00:25, , 7F
02/15 00:25, 7F
推
02/15 00:28, , 8F
02/15 00:28, 8F
→
02/15 00:29, , 9F
02/15 00:29, 9F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章