FORTRAN example for HAVSIN

 

C---- SUB. DIFFERENTIAL

      SUBROUTINE DIFFERENTIAL_USUB

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

C---- TO EXPORT * SUBROUTINE

      !DEC$ ATTRIBUTES DLLEXPORT,C::DIFFERENTIAL_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     JFLAG  : When RD/Solver evaluates a Jacobian, the flag is true. (Input)

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

C     RESULT : Returned value. (Output)

 

      DOUBLE PRECISION TIME, UPAR(*)

      INTEGER NPAR

      LOGICAL JFLAG, IFLAG

      DOUBLE PRECISION RESULT[REFERENCE]

 

C---- USER STATEMENT

      DOUBLE PRECISION VALUE, VELO, STIME

      INTEGER IORD

      LOGICAL ERRFLG

     

      STIME = 1.0D0

      VELO = 74.0D0

      IF ( JFLAG ) THEN

         IORD = 1

      ELSE

         IORD = 0

      ENDIF

      CALL RD_HAVSIN(TIME,0.0D0,0.0D0,STIME,VELO,IORD,VALUE,ERRFLG)

     

      RESULT = VALUE

     

      RETURN

      END