C/C++ example for GET_RFLEX_NMODE

 

#include "stdafx.h"

#include "DllFunc.h"

#include "math.h"

 

using namespace rd_syscall;

 

ModalForce_API void __cdecl modal_force

           (int id, double time, double upar[], int npar, int ifbody, double pos[12],

           double vel[6], double acc[6], int nmode, int nnode, int nModalLoad,

double *ModalLoadsint jflag, int iflag, double *result)

{

           // User Statement

           int check_nmode,ierr;

 

           // Check number of selected mode

           get_rflex_nmode(ifbody,&check_nmode,&ierr);

           errmes(ierr,"MForce",id,"hyc_usub_test");

 

    // The number of selected modes must be the same

    // between "get_rflex_nmode()" funtion and "nmode" argument of ModalForceUSUB.

    if(nmode!=check_nmode)

    {

        errmes(0,"MForce",id,

"Selected number of mode is wrong!!! There's an error!");

    }

 

           for(int i=0;i<6+nmode;i++) result[i]=0.0;

}