C/C++ example for POLY

 

#include "stdafx.h"

#include "DllFunc.h"

 

POLY_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 Variable Definition

   double value,mkid[6];

   int errflg,i;

 

   //Assign Impact Parameters

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

      mkid[i] = upar[i];

   }

 

   //call RD_POLY to collect information for Calculations

   rd_poly(time,0.5,mkid,6,0,&value,&errflg);

  

   //Assign the returned value to user subroutine

   *result = value;

}