Skip to main content

DPF Framework 2026 R1

utility:for each

Last update: 31.07.2026

Version: 0.0.0

Description

Allows to write a loop over a chunk of operators.

Inputs

This table lists the input pins for this operator. Input pins define the data that the operator requires to perform its operation. Some inputs are required, while others are optional and provide additional configuration. Each parameter is detailed in the sections that follow the table.

Pin number Name Status Expected type(s)
0 iterable Required
1 iterable_values
2 pin_index int32
3 forward Required

iterable (Pin 0)

  • Required: Yes
  • Expected type(s):

Either the result of the make_iterable_info operator, or the operator that must be incremented.

iterable_values (Pin 1)

  • Required: No
  • Expected type(s):

pin_index (Pin 2)

  • Required: No
  • Expected type(s): int32

forward (Pin 3)

  • Required: Yes
  • Expected type(s):

Outputs

This table lists the output pins for this operator. Output pins provide the results of the operator's computation and can be connected to inputs of other operators or retrieved for further processing. Each output is detailed in the sections that follow the table.

Pin number Name Expected type(s)
0 empty
3 output

empty (Pin 0)

  • Expected type(s):

output (Pin 3)

  • Expected type(s):

Configurations

This operator supports configuration options that modify its behavior.

evaluate_inputs_before_run

  • Expected type(s): bool
  • Default value: false

If this option is set to true, all input pins of the operator will be evaluated before entering the run method to maintain a correct Operator status.

mutex

  • Expected type(s): bool
  • Default value: false

If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads.

Scripting

This operator can be accessed through scripting interfaces using these identifiers.

Category: utility

Plugin: core

Scripting name: for_each

Full name: utility.for_each

Internal name: for_each

License: None

Examples

These examples demonstrate how to use this operator in different programming environments. Each example shows how to instantiate the operator, connect the required inputs, and retrieve the output.

C++
#include "dpf_api.h"

ansys::dpf::Operator op("for_each"); // operator instantiation
op.connect(0, my_iterable);
op.connect(1, my_iterable_values);
op.connect(2, my_pin_index);
op.connect(3, my_forward);
 my_empty = op.getOutput<>(0);
 my_output = op.getOutput<>(3);
CPython
import ansys.dpf.core as dpf

op = dpf.operators.utility.for_each() # operator instantiation
op.inputs.iterable.connect(my_iterable)
op.inputs.iterable_values.connect(my_iterable_values)
op.inputs.pin_index.connect(my_pin_index)
op.inputs.forward1.connect(my_forward1)
op.inputs.forward2.connect(my_forward2)
my_empty = op.outputs.empty()
my_output = op.outputs.output()
IPython
import mech_dpf
import Ans.DataProcessing as dpf

op = dpf.operators.utility.for_each() # operator instantiation
op.inputs.iterable.Connect(my_iterable)
op.inputs.iterable_values.Connect(my_iterable_values)
op.inputs.pin_index.Connect(my_pin_index)
op.inputs.forward.Connect(my_forward)
my_empty = op.outputs.empty.GetData()
my_output = op.outputs.output.GetData()

Changelog

  • Version 0.0.0: Initial release.

Connect with Ansys