FORTRAN example for CHEBY

 

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 Definition

INTEGER i

      DOUBLE PRICISION value, mkid(5)

      INTEGER errflg

 

C---- Assign Impact Parameter

      do i=1,5

         mkid(i) = UPAR(i)

      enddo

 

C---- Call RD_CUBSPL to get the result of spline

call RD_CHEBY(time,0.5,mkid(1),5,0,value, errflg)

 

C------- Assign the returned value to User Subroutine

      RESULT = value

 

      RETURN

      END