C/C++ example for SHF

 

#include "stdafx.h"

#include "DllFunc.h"

 

SHF_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

 

   // Local Varialbe Definitions

   double offset, amp, omega, phi, average;

   double value;

   int order, errflg;

 

   // Assign Impact Parameter

   offset   = upar[0];

   amp      = upar[1];

   omega    = upar[2];

   phi      = upar[3];

   average = upar[4];

   order    = (int)upar[5];

 

   //call the SHF to collect Information for Calculation

   rd_shf(time, offset, amp, omega, phi, average, order, &value, &errflg);

 

   // Rerurn the Value

   *result = value;

}