# NAG Library Function Document

## nag_blgm_optget (g22znc)

Note: please be advised that this function is classed as ‘experimental’ and its interface may be developed further in the future. Please see Section 3.1.1 in How to Use the NAG Library and its Documentation for further information.

## 1Purpose

nag_blgm_optget (g22znc) is a general option getting function for Chapter g22. It is used to query the value of optional parameters.

## 2Specification

 #include #include
 void nag_blgm_optget (void *handle, const char *optstr, Integer *ivalue, double *rvalue, char *cvalue, Integer lcvalue, Nag_VariableType *optype, NagError *fail)

## 3Description

nag_blgm_optget (g22znc) can only be called on G22 handles. It can be used to query the current values of optional parameters and will return either an integer, real or character value dependent upon the type associated with the optional parameter being queried.
The optional parameter of interest is presented as a character string of the form ‘option
In cases where an optional parameter may have multiple instances in a particular G22 handle an instance identifier can be specified. This is presented using the form ‘$\mathit{option}:\mathit{instance identifier}$’. In such cases, if the instance identifier is omitted, the value of the first instance is returned. If the value of optional parameter is not the same for all instances and an instance identifier is omitted, a warning is raised.
Information relating to available option names, their corresponding valid values, whether the use of an instance identifier may be appropriate and what form it can take is given in the individual function documents.

None.

## 5Arguments

1:    $\mathbf{handle}$void *Input
On entry: the G22 handle which must have been initialized by one of Chapter g22 initialization functions.
2:    $\mathbf{optstr}$const char *Input
On entry: a string identifying the option and, where required, the instance identifier.
identify
Returns a string description of the G22 handle supplied in handle. See Section 9 for more details.
option
Returns the value of option. If there are multiple instances of option, the value of the first is returned. If not all instances of option have the same value, ${\mathbf{fail}}\mathbf{.}\mathbf{code}=$ NW_INSTANCE is returned.
$\mathit{option}:\mathit{instance identifier}$
Returns the value of a single instance of option.
optstr is case insensitive and option and instance identifier may consist of one or more tokens separated by white space.
See the documentation of the individual Chapter g22 functions for details of valid values for option and instance identifier.
3:    $\mathbf{ivalue}$Integer *Output
On exit: if ${\mathbf{optype}}=\mathrm{Nag_Integer}$, option identifies an integer-valued parameter and ivalue holds its current value.
4:    $\mathbf{rvalue}$double *Output
On exit: if ${\mathbf{optype}}=\mathrm{Nag_Real}$, option identifies a real-valued parameter and rvalue holds its current value.
5:    $\mathbf{cvalue}$char *Output
Note: the string returned in cvalue will never exceed $\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{lcvalue}},41\right)$ characters in length, including the terminating null character.
On exit: if ${\mathbf{optype}}=\mathrm{Nag_Character}$, option identifies a character-valued parameter and cvalue holds its current value.
6:    $\mathbf{lcvalue}$IntegerInput
On entry: length of the string cvalue. At most ${\mathbf{lcvalue}}-1$ non-null characters will be written into cvalue.
Constraint: ${\mathbf{lcvalue}}>1$.
7:    $\mathbf{optype}$Nag_VariableType *Output
On exit: indicates whether option is an integer, real or character-valued optional parameter and hence which of ivalue, rvalue or cvalue holds the current value.
${\mathbf{optype}}=\mathrm{Nag_Integer}$
option is an integer-valued optional parameter; its current value has been returned in ivalue.
${\mathbf{optype}}=\mathrm{Nag_Real}$
option is a real-valued optional parameter; its current value has been returned in rvalue.
${\mathbf{optype}}=\mathrm{Nag_Character}$
option is a character-valued optional parameter; its current value has been returned in cvalue.
8:    $\mathbf{fail}$NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

## 6Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
On entry, argument $〈\mathit{\text{value}}〉$ had an illegal value.
NE_HANDLE
handle has not been initialized or is corrupt.
handle is not a G22 handle.
NE_INSTANCE
Invalid instance identifier for option.
On entry, ${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
Numeric instance identifier is out of range.
On entry, $\mathit{instance identifier}=〈\mathit{\text{value}}〉$
Constraint: $〈\mathit{\text{value}}〉\le \mathit{instance identifier}$ and $\mathit{instance identifier}\le 〈\mathit{\text{value}}〉$.
NE_INT
On entry, ${\mathbf{lcvalue}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{lcvalue}}>1$.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_INVALID_OPTION
On entry, option is not readable: ${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
On entry, option was not recognized: ${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NW_INSTANCE
On entry, option cannot have an associated instance identifier. The supplied instance identifier was ignored.
${\mathbf{optstr}}=〈\mathit{\text{value}}〉$.
option has multiple instances. Information from the first instance has been returned.
NW_TRUNCATED
On entry, option is a character optional parameter, but cvalue is too short to hold the stored value. The minimum number of characters to store the value is returned in ivalue. The value returned in cvalue will be truncated.

Not applicable.

## 8Parallelism and Performance

nag_blgm_optget (g22znc) is not threaded in any implementation.