Subroutine Type |
Modeling. |
|||
Definition |
Inputs a user-defined matrix element. |
|||
Use |
<Reference_Matrix id = "301001" usrsub_param_string = "USER(502,300,100,20,10,1)" usrsub_dll_name = "NULL" usrsub_fnc_name = "MATRIX_READ" /> |
|||
Calling Syntax |
Fortran SUBROUTINE MATRIX_READ (ID, PAR, NPAR, ERRFLG)
C void STDCALL MATRIX_READ (int *id, double *par, int *npar, int *errflg)
Python def MATRIX_READ(id, par, npar): return error_flag
MATLAB function eflg = MATRIX_READ(id, par, npar) |
|||
Input Arguments |
[integer] ID |
The matrix element identifier. |
||
[double precision] PAR |
An array that contains the constant arguments from the list provided in the |
|||
[integer] NPAR |
The number of entries in the PAR array. |
|||
[int] ERRFLAG |
The intialization flag. |
|||
Output Values |
None. |
|||
Example |
def MATRIX_READ(id, par, npar):
eflg=0 n = par[0].__int__() radius = par[1] b_id = int(par[2]) ne = 3*(n+1); rowidx = ne*[0] colidx = [0 for i in range(ne)] value = range(ne)
u = -2.0*pi du = 4.0*pi/n icount = 0
for i in xrange(n+1): x = radius*(1.0+cos(u))/2.0 y = radius*sin(u)/2.0 z = radius*sin(u/2.0)
rowidx[icount] = i+1 colidx[icount] = 1 value[icount] = x icount+=1 rowidx[icount] = i+1 colidx[icount] = 2 value[icount] = y icount+=1 rowidx[icount] = i+1 colidx[icount] = 3 value[icount] = z icount+=1 u += du
eflg = py_put_matrix(id, n+1, 3, rowidx, colidx, value) del rowidx del colidx del value
u = 2.0*pi-0.1 vx = -radius*sin(u)/2.0 vy = radius*cos(u)/2.0 vz = radius*cos(u/2.0)/2.0 output, eflg = py_modfnc("Body_Rigid", b_id, "v_ic_x") print "\nmodfnc result for v_ic_x : %s, %d\n" %(output,eflg) eflg = py_modset("Body_Rigid", b_id, "v_ic_x", str(11*vx)) output, eflg = py_modfnc("Body_Rigid", b_id, "v_ic_y") print "\nmodfnc result for v_ic_y : %s, %d\n" %(output,eflg) eflg = py_modset("Body_Rigid", b_id, "v_ic_y", str(11*vy)) output, eflg = py_modfnc("Body_Rigid", b_id, "v_ic_z") print "\nmodfnc result for v_ic_z : %s, %d\n" %(output,eflg) eflg = py_modset("Body_Rigid", b_id, "v_ic_z", str(11*vz))
return eflg |
|||
Comments |
<Reference_ParamCurve id = "301001" is_u_closed = "TRUE" is_curve_points = "TRUE" matrix_id = "301001" /> |
|||
See Also: |