C/C++ example for GET_RFLEX_NSTRAIN

 

#include "stdafx.h"

#include "DllFunc.h"

#include "math.h"

using namespace rd_syscall;

 

// Global variables for saving Stress and Strain data

double Stress144[11];

double Strain144[11];

double Stress144_3nref[11];

double Strain144_3nref[11];

 

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 *ModalLoads,

           int jflag, int iflag, double *result)

{

// User Statement

int ierr;

int itemp,Node144SeqID, Node143SeqID, Node582SeqID;

double StressShape144[6],StrainShape144[6];

 

// Saved Node Seq. ID

get_rflex_nodeseqid(ifbody,144,&Node144SeqID,&ierr);

get_rflex_nodeseqid(ifbody,143,&Node143SeqID,&ierr);

get_rflex_nodeseqid(ifbody,582,&Node582SeqID,&ierr);

 

// Saved Node stress/strain

    // Assumption : All following used nodes (Node ID:144,143,582)

//                must be defined a Output node set in RFlex body edit mode.

get_rflex_nstress(ifbody,Node144SeqID,1,0,Stress144,&ierr);

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

get_rflex_nstrain(ifbody,Node144SeqID,1,0,Strain144,&ierr);

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

get_rflex_nstress_3nref(ifbody,Node144SeqID,1,Node144SeqID,Node143SeqID,Node582SeqID,

Stress144_3nref,&ierr);

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

get_rflex_nstrain_3nref(ifbody,Node144SeqID,1,Node144SeqID,Node143SeqID,Node582SeqID,

Strain144_3nref,&ierr);

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

 

// Get stress shape

    // Check 1st mode/stress shape data

get_rflex_stressshape(ifbody,7,Node144SeqID,1,StressShape144,&ierr);

 

    // Get strain shape

    // Check 1st mode/strain shape data

get_rflex_strainshape(ifbody,7,Node144SeqID,1,StrainShape144,&ierr);

 

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

}

 

// Adding plot USUB/Request

ModalForce_API void __cdecl request_usub(double time, double upar[], int npar, int iflag, double result[8])

{

result[1]=Stress144[0];

result[2]=Strain144[0];

result[3]=Stress144_3nref[0];

result[5]=Strain144_3nref[0];

}