C/C++ example for HAVSIN

 

#include "stdafx.h"

#include "DllFunc.h"

 

HAVSIN_API void __cdecl differential_usub

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

{

   using namespace rd_syscall;

   // Parameter Information

   //   time: Simulation time of RD/Solver

   //   upar: Parameters defined by user

   //   npar: Number of user parameters

   //   jflag: When RD/Solver evaluates a Jacobian, the flag is true.

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

   //   result: Returned value

 

   // User statement

   double value, velo, stime;

   int iord, errflg;

 

   stime = 1.0;

   velo = 74.0;

   if (jflag) {

      iord = 1;

   }

   else {

      iord = 0;

   }

   rd_havsin(time,0.0,0.0,stime,velo,iord,&value,&errflg);

   *result = value;

 

}