#include "stdafx.h" #include "DllFunc.h" #include <stdio.h>
Get_rflex_modeid_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) {
using namespace rd_syscall; // Parameter Information // id: MFORCE ID (Input) // time: Simulation time of RD/Solver (Input) // upar: Parameters defined by user (Input) // npar: Number of user parameters (Input) // ifbody : RFLEX body seq ID (Input) // pos : Position(1~3) and Orientation matrix (4~12) w.r.t Ground.InertiaMarker (Input) // vel : Velocity vector w.r.t. Ground.InertiaMarker (Input) // acc : Acceleration vector w.r.t Ground.InertiaMarker (Input) // nmode : No of selected mode (Input) // nnode : No of node (Input) // nModalLoad : No of selected modal load cases (Input) // ModalLoads : Modal-force vector (Input, size : [(6+nmode) x nModalLoad] ) // 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 modal froce vector (Output, Size : [6+nmode] )
int i,j,ierr; double eigen; double frq; int *SelectedModeIds;
FILE* ForDebug;
if(iflag) {
ForDebug=fopen("CprogramDebug.txt","w"); fprintf(ForDebug,"*** C program \n");
// RFLEX Information fprintf(ForDebug,"*** RFLEX Information\n"); fprintf(ForDebug," RFLEX body seq. Id = %d\n",ifbody); fprintf(ForDebug," No. selected mode = %d\n",nmode); fprintf(ForDebug," No. Modal Load Case = %d\n",nModalLoad); fprintf(ForDebug," No. Node(Grid) = %d\n",nnode); fprintf(ForDebug," No. User Parameter (USUB) = %d\n",npar);
fprintf(ForDebug,"\n\n");
// selected mode information SelectedModeIds = new int[nmode]; fprintf(ForDebug,"*** Selected mode ids\n "); get_rflex_modeid(ifbody,SelectedModeIds,&ierr); for(i=0;i<nmode;i++) { fprintf(ForDebug," %d ",SelectedModeIds[i]); } fprintf(ForDebug,"\n\n");
// Eigenvalues & Frequency fprintf(ForDebug,"*** Eigenvalues and Frequency\n"); for(i=0;i<nmode;i++) { get_rflex_frq(ifbody,SelectedModeIds[i],&frq,&eigen,&ierr); fprintf(ForDebug," Mode ID : %d, Eigenvalue : %20.10e, requency : %20.10e\n",SelectedModeIds[i],eigen,frq); } fprintf(ForDebug,"\n\n");
fclose(ForDebug); }
for(i=0;i<6+nmode;i++) { result[i] = 0.0; } } |