C/C++ example for CHEBY

 

#include "stdafx.h"

#include "DllFunc.h"

 

CHEBY_API void __cdecl motion_usub

           (double time, double upar[], int npar, int iord, int iflag, double* result)

{

           using namespace rd_syscall;

           // Parameter Information

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

           //   upar    :  Parameters defined by user. (Input)

           //   npar    :  Number of user parameters. (Input)

           //   iord    :  Integrator order. (Input)

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

           //   result  :  Returned value. (Output)

 

           // User Statement

   double value,mkid[5];

   int errflg, i;

 

   // Assign Impact Parameters

   for(i=0;i<5;i++){

      mkid[i] = upar[i];

   }

 

   // call rd_cheby to collect information for calculations

   rd_cheby(time,0.5,mkid,5,0,&value,&errflg);

 

   // Assign the returned value to user subroutine

   *result = array;

}