Component Couplings
The purpose of a model is often to compute the sum, average, maximum value, or minimum value of a quantity over a group of rays, such as the average intensity or the maximum path length. An instance of the Geometrical Optics interface with Name <name> creates the following four component couplings:
<name>.<name>op1(expr) evaluates the sum of the expression expr over the rays. The sum includes all rays that are active, frozen, or stuck to boundaries. It excludes rays that have not yet been released and those that have disappeared.
<name>.<name>op_all1(expr) evaluates the sum of the expression expr over all rays, including rays those that are not yet released or have disappeared. Since the coordinates of unreleased and disappeared rays are not-a-number (NaN), the sum may return NaN if the model includes unreleased or disappeared rays. An expression such as gop.gopop1(isnan(qx)) can be used to compute the total number of unreleased and disappeared rays.
<name>.<name>aveop1(expr) evaluates the average of the expression expr over the active, frozen, and stuck rays. Unreleased and disappeared rays contribute to neither the numerator nor the denominator of the arithmetic mean.
<name>.<name>aveop_all1(expr) evaluates the average of the expression expr over all rays. It is likely to return NaN if the model includes unreleased or disappeared rays.
<name>.<name>maxop1(expr) evaluates the maximum value of the expression expr over all active, frozen, and stuck rays.
<name>.<name>maxop_all1(expr) evaluates the maximum value of the expression expr over all rays.
<name>.<name>minop1(expr) evaluates the minimum value of the expression expr over the active, frozen, and stuck rays.
<name>.<name>minop_all1(expr) evaluates the minimum value of the expression expr over all rays.
<name>.<name>maxop1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the maximum value of the expression expr out of all active, frozen, and stuck rays. For example, the expression gop.gopmaxop1(gop.I, qx) would evaluate the x-coordinate qx of the ray with the greatest intensity gop.I.
<name>.<name>maxop_all1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the maximum value of the expression expr for all rays, including disappeared and unreleased rays.
<name>.<name>minop1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the minimum value of the expression expr out of all active, frozen, and stuck rays. For example, the expression gop.gopminop1(gop.I, qx) would evaluate the x-coordinate qx of the ray with the minimum intensity gop.I.
<name>.<name>minop_all1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the minimum value of the expression expr for all rays, including disappeared and unreleased rays.
An instance of the Geometrical Optics interface with the default name gop defines the built-in component couplings shown in Table 2-2.