4.8.3.103. SYSARY
SYSARY subroutine returns an array of values when it is invoked.
Language type |
Subroutine |
FORTRAN |
call sysary(what, mkid, nid, result, nresult, errflg) |
C/C++ |
sysary(what, mkid, nid, &result, nresult, errflg) |
Where FORCE is type for SYSARY subroutine, mkid and nid must be defined as an integer array and integer. The force_x must be defined as a double precision. The errflg must be defined as a logical in FORTRAN language or an integer in C/C++ language.
Variable Name |
Size |
Description |
what |
char[30] |
The type name. |
mkid |
int* |
The ID array of marker. |
nid |
int |
The number of marker in mkid array. |
result |
double* |
The Result array. |
nresult |
int |
Ending point of the SWEEP function. (x value) |
errflg |
logical |
If an error is encountered in invoking Predefined subroutine, this variable becomes true. This variable must be declared as a logical variable. |
The available types are tabulated in SYSARY as follows.
TYPES FOR SYSARY
FORCE
FUNCTION ARRANGEMENT NAME |
FORCE |
SIZE_INTEGER_PARAMETER |
1 - 3 |
SIZE_RESULT |
6 |
RESULT |
Result(1) = FX Result(2) = FY Result(3) = FZ Result(4) = TX Result(5) = TY Result(6) = TZ |
TYPE |
Force & Torque |
TFORCE
FUNCTION ARRANGEMENT NAME |
TFORCE |
SIZE_INTEGER_PARAMETER |
1 - 3 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
Force |
RFORCE
FUNCTION ARRANGEMENT NAME |
RFORCE |
SIZE_INTEGER_PARAMETER |
1 - 3 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
Torque |
DISP
FUNCTION ARRANGEMENT NAME |
DISP |
SIZE_INTEGER_PARAMETER |
1 - 3 |
SIZE_RESULT |
6 |
RESULT |
Result(1) = DX Result(2) = DY Result(3) = DZ Result(4) = PSI Result(5) = THETA Result(6) = PHI |
TYPE |
TDISP
FUNCTION ARRANGEMENT NAME |
TDISP |
SIZE_INTEGER_PARAMETER |
1 - 3 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
RDISP
FUNCTION ARRANGEMENT NAME |
RDISP |
SIZE_INTEGER_PARAMETER |
1 - 2 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
AM
FUNCTION ARRANGEMENT NAME |
AM |
SIZE_INTEGER_PARAMETER |
1 - 2 |
SIZE_RESULT |
9 |
RESULT |
Result(1) = A(1,1) Result(2) = A(2,1) Result(3) = A(3,1) Result(4) = A(1,2) Result(5) = A(2,2) Result(6) = A(3,2) Result(7) = A(1,3) Result(8) = A(2,3) Result(9) = A(3,3) |
TYPE |
VEL
FUNCTION ARRANGEMENT NAME |
VEL |
SIZE_INTEGER_PARAMETER |
1 - 4 |
SIZE_RESULT |
6 |
RESULT |
Result(1) = VX Result(2) = VY Result(3) = VZ Result(4) = WX Result(5) = WY Result(6) = WZ |
TYPE |
TVEL
FUNCTION ARRANGEMENT NAME |
TVEL |
SIZE_INTEGER_PARAMETER |
1 - 4 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
RVEL
FUNCTION ARRANGEMENT NAME |
RVEL |
SIZE_INTEGER_PARAMETER |
1 - 3 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
ACC
FUNCTION ARRANGEMENT NAME |
ACC |
SIZE_INTEGER_PARAMETER |
1 - 4 |
SIZE_RESULT |
6 |
RESULT |
Result(1) = ACCX Result(2) = ACCY Result(3) = ACCZ Result(4) = WDTX Result(5) = WDTY Result(6) = WDTZ |
TYPE |
TACC
FUNCTION ARRANGEMENT NAME |
TACC |
SIZE_INTEGER_PARAMETER |
1 - 4 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
RACC
FUNCTION ARRANGEMENT NAME |
RACC |
SIZE_INTEGER_PARAMETER |
1 - 4 |
SIZE_RESULT |
3 |
RESULT |
|
TYPE |
Note
The SYSARY function should be called every time in the user subroutine. Because the mkid used in the SYSARY function is registered only one time initially. Using SYSARY within if statement is highly unrecommended.
C---- SUB. REQUEST
SUBROUTINE REQUEST_USUB
& (TIME,UPAR,NPAR,IFLAG,RESULT)
C---- TO EXPORT * SUBROUTINE
!DEC$ ATTRIBUTES DLLEXPORT,C::REQUEST_USUB
C---- INCLUDE SYSTEM CALL
INCLUDE 'SYSCAL.F'
C---- DEFINE VARIABLES
C Parameter Information
C TIME : Simulation time of RD/Solver. (Input)
C UPAR : Parameters defined by user. (Input)
C NPAR : Number of user parameters. (Input)
C IFLAG : When RD/Solver initializes arrays, the flag is true. (Input)
C RESULT : Returned values. (Output, Size : 8)
DOUBLE PRECISION TIME, UPAR(*)
INTEGER NPAR
LOGICAL IFLAG
DOUBLE PRECISION RESULT[REFERENCE](8)
C---- USER STATEMENT
C---- Local Variable Definition
DOUBLE PRECISION VALUE(9)
INTEGER MKID(3)
LOGICAL ERRFLG
C---- Assing Impact Parameter
MKID(1) =INT(UPAR(1))
MKID(2) =INT(UPAR(2))
MKID(3) =INT(UPAR(3))
C---- Call SYSARY to collect Information for Calculation
CALL SYSARY('FORCE',MKID,3,VALUE,6,ERRGLG)
C---- Assign the returned value to User Subroutine Request
RESULT(2) = VALUE(1)
RESULT(3) = VALUE(2)
RESULT(4) = VALUE(3)
RESULT(6) = VALUE(4)
RESULT(7) = VALUE(5)
RESULT(8) = VALUE(6)
RETURN
END
#include "stdafx.h"
#include "DllFunc.h"
SYSARY_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
// Local variable definitions
double VALUE[9];
int mkid[4];
int errflg;
//Call SYSARY to collect information for Calculations
sysary("ACC",mkid,3,VALUE,6,&errflg);
//Assign the returned value to User Subroutine Request
result[1] = VALUE[0];
result[2] = VALUE[1];
result[3] = VALUE[2];
result[5] = VALUE[3];
result[6] = VALUE[4];
result[7] = VALUE[5];
}