# CURSUB

ModelingUsed to specify a user defined curve element and its derivatives for a reference curve element. User defined curves are typically used in conjunction with point-to-curve, curve-to-curve, and curve-to-surface constraints.

## Use

User defined reference parameter curve using a curve computed in a CURSUB:

<Reference_ParamCurve
id                  = "111"
is_u_closed         = "TRUE"
u_start             = "-1."
u_end               = "1."
usrsub_param_string = "USER(100)"
usrsub_dll_name     = "NULL">
</Reference_ParamCurve>

## Format

Fortran Calling Syntax
SUBROUTINE CURSUB (ID, PAR, NPAR, ALPHA, IORD, IFLAG, VALUES)
C/C++ Calling Syntax
void STDCALL CURSUB (int *id, double *par, int *npar, double *alpha, int *iord, int *iflag, double *values)
Python Calling Syntax
def CURSUB(id, par, npar, alpha, iord, iflag):
return values
MATLAB Calling Syntax
function values = CURSUB(id, par, npar, alpha, iord, iflag)

## Attributes

ID
[integer]
The curve subroutine element identifier.
PAR
[double precision]
An array that contains the constant arguments from the list provided in the user-defined statement.
NPAR
[integer]
The number of entries in the PAR array.
ALPHA
[double precision]
The value of the independent variable a used by the curve subroutine to evaluate the curve.
IFLAG
[logical]
The initialization flag.
IORD
[integer]
The order of the derivative that the curve subroutine returns.
0
The curve coordinates.
1
The curve first derivative with respect to the curvilinear coordinate ALPHA.
2
The curve second derivative with respect to the curvilinear coordinate ALPHA.

## Output

VALUES
[double precision]
The vector output value of dimension 3 that contains the x, y, and z coordinates of the generated curve. Or, the first/second derivatives with respect to ALPHA, according to the IORD input parameter.

## Example

def CURSUB(id, par, npar, alpha, iord, iflag):
values =3*[0.0]
if iord == 0:
values[0] = par[0]*cos((alpha+1.0)*pi)
values[1] = 0
values[2] = par[0]*sin((alpha+1.0)*pi)
return values