Expression Operator
Add an Expression Operator node () under Definitions>Variable Utilities (if Group by Type is active; otherwise, directly under Definitions) to define an operator that evaluates parameterized expressions on specified selections. You add it by right-clicking the Definitions node and choosing Variable Utilities>Expression Operator or by right-clicking the Variable Utilities node and choosing Expression Operator.
The Expression Operator node specifies an operator name, formal argument names and dimensions, a default expression, and a selection where the operator will be defined. Alternate expressions can be defined on subsets of the operator selection (also of lower dimensions) using Operator Contribution subnodes. The defining expressions can, in addition to the formal arguments, contain any variable and operator names that can be evaluated on the corresponding selection. When the operator is used in a model, different operator expressions can be evaluated depending on where the operator is used, and variables in the expressions can evaluate differently depending on their selections.
Geometric Entity Selection
In this section, define the selection for the expression operator. By default, the Geometry entity level is set to Entire model, meaning that the operator will be available globally.
Definition
In the Expression field, enter the default expression for the operator. This expression is the one that will be used on the parts of the Expression Operator node’s selection that have not been overridden by an Operator Contribution subnode. The expression can contain both the specified formal argument names and other variables, which are assumed to exist on the selection. Press Ctrl+Space to choose from previously defined parameters, mathematical constants and functions, operators, and physical constants that you can insert into the expression at the position of the cursor. The output unit of the operator is derived from the default expression.
In the table of arguments, enter the name of each formal argument in the Argument column and optionally its expected dimensions, in the form of a unit expression, in the Dimensions column. The specified dimensions are used primarily for checking unit consistency when the operator is used in expressions. But the specific unit expression used may also affect the result of the evaluation. The argument is converted to the specified unit before being substituted into the operator expression.
By default, the Dimensions column is empty. This means that the corresponding argument’s dimensions are undefined. In this case unit consistency checks will accept any argument in the context where the operator is called, and will propagate its actual dimensions to the operator’s output dimensions.
In the Argument type column, choose Expression to pass the input argument as an expression, or choose Value to pass it by its value. By default, arguments to the expression operator are substituted symbolically into its defining expressions. This means that the expression operator behaves in the same way as a nonlocal coupling, rather than as a function: when the actual argument is an expression, the argument expression is inserted into the defining expression and interpreted in that context. Setting an argument to evaluate by Value forces argument evaluation in the target context, before the expression operator is called. This is similar to the behavior of a standard function.
Use the Delete button () underneath the table to delete the selected argument, if needed.