C/C++ example for ERRMES

 

#include "stdafx.h"

#include "DllFunc.h"

 

ERRMSG_API void __cdecl axial_force

           (double time, double upar[], int npar, int jflag, 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)

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

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

           //   result : Returned axial force or torque value. (Output)

 

           // User Statement

   // Local Variable Definition

   double a,dist;

   int mkid[2];

   int errflg;

 

   // Assign Impact Parameters

   errflg = TRUE;

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

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

  

   // call the auxiliary subroutine for calculation

   sysfnc("DZ",mkid,2,&dist,&errflg);

   errmes(errflg,"SYSFNC_DX",1,"CONTACT");

   if(dist == 0.0 {

      errflg = FALSE;

   }

   else{

      A = 100.0 / dist;

   }

   errmes(errflg,"275",275,"275275275");

   //Assign the Returned Value

   *result = dist;

  

}