C/C++ example for request user subroutine

 

#include "stdafx.h"

#include "DllFunc.h"

 

Request_API void __cdecl request_usub

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

{

           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)

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

           //   result : Returned values. (Output, Size : 8)

 

           // User Statement

           double DX, DY, DZ, AX, AY, AZ;

           int mid[2], ERRFLG, i;

 

           mid[0] = (int)upar[0];

           mid[1] = (int)upar[1];

 

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

                     result[i] = 0.0;

           }

 

           sysfnc("DX",mid,2,&DX,&ERRFLG);

           sysfnc("DY",mid,2,&DY,&ERRFLG);

           sysfnc("DZ",mid,2,&DZ,&ERRFLG);

           sysfnc("AX",mid,2,&AX,&ERRFLG);

           sysfnc("AY",mid,2,&AY,&ERRFLG);

           sysfnc("AZ",mid,2,&AZ,&ERRFLG);

 

           result[1] = DX;

           result[2] = DY;

           result[3] = DZ;

           result[5] = AX;

           result[6] = AY;

           result[7] = AZ;

}