Skip to content
Christoffer Fink edited this page Jul 18, 2014 · 3 revisions

Any type of parameter can also be an array parameter. The converse interpretation is also valid; an array parameter can be of any type. This also implies that an "array" is not a type per se, but more of an attribute of a parameter.

It may be tempting to view arrays as syntactic sugar for automatically generating multiple parameters using the same definition. However, the elements are not independent, so this is not an equivalent interpretation.

Defining Arrays

Arrays are defined in the XML configuration by appending the size of one or more dimensions to the type of the parameter, with each size enclosed in square brackets ([]). The size of a dimension can also be omitted to define a dynamically sized array. InPUT will then use a size that is specified when generating a value for the parameter. If no size is given when values are generated, then InPUT will use a default size of one.

Examples

    <i:NParam id='A' type='float[5]' />
    <i:NParam id='B' inclMin='A*2' type='integer[3][5]' />
    <i:NParam id='C' exclMin='0,5' exclMax='2,10' type='integer[]' />
    <i:NParam id='D' type='integer[][5][][3][]' fixed='2' />
    <i:SParam id='Hello' type='String[]' />
    <i:SParam id='Point' type='[5][3]'>
      <i:NParam id='X' type='integer' />
      <i:NParam id='Y' type='integer' />
    </i:SParam>
    <i:SParam id="Shape" type='[5]'>
        <i:SParam id="Point">
            <i:NParam id="X" type="integer" />
            <i:NParam id="Y" type="integer" />
        </i:SParam>
        <i:SChoice id="Square">
            <i:NParam id="Side" type="integer" />
        </i:SChoice>
        <i:SChoice id="Rectangle">
            <i:NParam id="Width" type="integer" />
            <i:NParam id="Height" type="integer" />
        </i:SChoice>
    </i:SParam>

These examples demonstrate that arrays can be numeric or structured, even containing choices; floating point or integer; fixed; with or without ranges; with multi-ranges or ranges relative to other parameters; and arbitrarily multi-dimensional. Or, equivalently, all those possible parameters can also be arrays.

Note that, with the exception of parameters that are defined using the built-in String type, structured parameters are defined without a type. In those cases, the array dimensions are appended to an empty type string. The Point and Shape parameters in the examples demonstrate this.

Array Elements and Indices

Indices start at 1.

Individual elements of an array parameter are automatically assigned an ID that is based on the ID of the parameter and the index of the element. Each component is separated by a dot (.). See Array test.

The IDs for array elements are included in the set of parameter IDs that are supported by a design, but not those supported by a design space. See Supported Parameter IDs test.

Examples

Assuming the parameter definitions from the examples above.

  • The value for parameter 'A' is an array containing 5 floating point values.
  • 'A.1' is the first element of 'A'.
  • 'B.2.5' is the last element of the middle array of 'B'.
  • If S is the set of parameter IDs that a design space supports, and D is the set of parameter IDs that a design based on that design spaces supports, then 'A.1' ∉ S and 'A.1' ∈ D.

Relevant Tests

Clone this wiki locally