Ariane logo ARIANE: A Visual Programming Interface

The Control Structure: For

Definition

A control structure For is an item which implements iteration control of a group of items. An iteration is done from a given initial value to a given final value by a given step.

The group of operators is described in a subgraph. This subgraph can be opened by double-clicking on the item.

The number of inputs, outputs, and parameters are specified during the creation of the item. The number of parameter is at least 3, the three iteration values.

Properties

for

Parameters

The first three parameters are named ($0, $1 et $2) and are used to:

  1. define the initial value of the iteration ($0);
  2. define the final value of the iteration ($1);
  3. define the step of the iteration ($2);

Iteration is related to the following instruction:

	for i=$0 to $1 step $2 do
		execute the related subgraph.

Other parameters $3, $4, ... are considered as constant in the iteration.

Composition of the subgraph

The group of items to iterate is composed in a subgraph.

for subgraph

The input, mask, parameter, and output slots of the control structure are accessible as connection slots in the subgraph:

  1. Input slots of the For item are located at the top left of the subgraph. These inputs are used for the first iteration.
  2. Intermediate input slots are located at the bottom left of the subgraph. Theses inputs are used for the next iterations as re-entry inputs.
  3. The iterate parameter slot, and all other parameter slots are located at the top of the subgraph. The iterate parameter contains the current value of the iteration. The other parameters contains the values set in the property dialog. The second slot of the subgraph corresponds to the the fourth parameter ($3) of the For item.
  4. The mask slot is located at the top of the subgraph. The mask is the same for each iteration.
  5. The output slots are located at the bottom right of the subgraph. These outputs are the final outputs of the For item.
  6. The output result slot is located at the bottom of the subgraph. This value is the final result of the For item.

For example, the graph above corresponds to the following snippet of code:

datafile1 = datafile(slot$0)
for i in parameter$0 to parameter$1 step parameter$2
do
  r1=pmeanfiltering parameter$3 datafile1 datafile2
  r2=test datafile2 datafile3
  cp datafile3 datafile1
done
cp datafile3 outputslot$0
resultslot$0 = r2

Warning

To enable execution, each output as well as the final result must be linked before execution, even directly with inputs slots.

See also


Go to the reference manual