FORTRAN example for request user subroutine

 

C---- SUB. REQUEST

      SUBROUTINE REQUEST_USUB

     &          (TIME,UPAR,NPAR,IFLAG,RESULT)

C---- TO EXPORT * SUBROUTINE

      !DEC$ ATTRIBUTES DLLEXPORT,C::REQUEST_USUB

 

C---- INCLUDE SYSTEM CALL

      INCLUDE 'SYSCAL.F'

 

C---- DEFINE VARIABLES

C     Parameter Information

C     TIME   : Simulation time of RD/Solver. (Input)

C     UPAR   : Parameters defined by user. (Input)

C     NPAR   : Number of user parameters. (Input)

C     IFLAG  : When RD/Solver initializes arrays, the flag is true. (Input)

C     RESULT : Returned values. (Output, Size : 8)

 

      DOUBLE PRECISION TIME, UPAR(*)

      INTEGER NPAR

      LOGICAL IFLAG

      DOUBLE PRECISION RESULT[REFERENCE](8)

 

C---- USER STATEMENT

      DOUBLE PRECISION DX, DY, DZ, AX, AY, AZ

      INTEGER MKID(2), i

      LOGICAL ERRFLG

 

      MKID(1) = INT(UPAR(1))

      MKID(2) = INT(UPAR(2))

 

      do i = 1, 8

        RESULT(i) = 0.0

      enddo

 

      call sysfnc('DX', MKID, 2, DX, ERRFLG)

      call sysfnc('DY', MKID, 2, DY, ERRFLG)

      call sysfnc('DZ', MKID, 2, DZ, ERRFLG)

      call sysfnc('AX', MKID, 2, AX, ERRFLG)

      call sysfnc('AY', MKID, 2, AY, ERRFLG)

      call sysfnc('AZ', MKID, 2, AZ, ERRFLG)

 

      RESULT(2) = DX

      RESULT(3) = DY

      RESULT(4) = DZ

      RESULT(6) = AX

      RESULT(7) = AY

      RESULT(8) = AZ

 

      RETURN

      END