FORTRAN example for SHF

 

C---- SUB. MOTION_USUB

      SUBROUTINE MOTION_USUB

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

C---- TO EXPORT * SUBROUTINE

      !DEC$ ATTRIBUTES DLLEXPORT,C::MOTION_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     IORD   : Integrator order. (Input)

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

C     RESULT : Returned value. (Output)

 

      DOUBLE PRECISION TIME, UPAR(*)

      INTEGER NPAR, IORD

      LOGICAL IFLAG

      DOUBLE PRECISION RESULT[REFERENCE]

 

C---- USER STATEMENT

C---- LOCAL VARIABLE DEFINITIONS

      DOUBLE PRECISION OFFSET, AMP, OMEGA, PHI, AVERAGE

      DOUBLE PRECISION VALUE

      INTEGER ORDER

      LOGICAL ERRFLG

     

C---- ASSIGN IMPACT PARAMETER

      OFFSET   = UPAR(1)

      AMP      = UPAR(2)

      OMEGA    = UPAR(3)

      PHI      = UPAR(4)

      AVERAGER = UPAR(5)

      ORDER    = (INT)UPAR(6)

     

C---- CALL THE SHF TO COLLECT INFORMATION FOR CALCULATION

      CALL RD_SHF(TIME,OFFSET,AMP,OMEGA,PHI,AVERAGE,ORDER,VALUE,ERRFLG)

      RESULT = VALUE

 

      RETURN

      END