utility:make producer consumer for each iterator
Last update: 31.07.2026Version: 0.0.0
Description
Generates an iterator that can be consumed by the for_each operator.The chain of Operators are split into a first part : the producers and a second part : the consumers.Asynchronous buffers are indeed to connect the producers and the consumers.
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) |
|---|---|---|---|
| -1 | try_generate_iterable | bool |
|
| 0 | iterable | ||
| 1 | operator_to_iterate | Required | operator |
| 2 | pin_index | Required | int32 |
| 3 | valueA | Required | |
| 4 | valueB | Required | |
| 5 | valueC | Required | |
| 1000 | producer_op1 | Required | operator |
| 1001 | output_pin_of_producer_op1 | Required | int32 |
| 1002 | input_pin_of_consumer_op1 | Required | int32 |
| 1003 | consumer_op1 | Required | operator |
try_generate_iterable (Pin -1)
- Required: No
- Expected type(s):
bool
if true, already iterable values connected in pin 3 like vectors, Scoping, TimefreqSupport, Containers and DataSources are split to iterate on it (default is true)
iterable (Pin 0)
- Required: No
- Expected type(s):
Iterable object, generated by make_for_each_range oeprator, that can be combined with the one currently generated.
operator_to_iterate (Pin 1)
- Required: Yes
- Expected type(s):
operator
Operator that must be reconnected with the range values.
pin_index (Pin 2)
- Required: Yes
- Expected type(s):
int32
valueA (Pin 3)
- Required: Yes
- Expected type(s):
valueB (Pin 4)
- Required: Yes
- Expected type(s):
valueC (Pin 5)
- Required: Yes
- Expected type(s):
producer_op1 (Pin 1000)
- Required: Yes
- Expected type(s):
operator
output_pin_of_producer_op1 (Pin 1001)
- Required: Yes
- Expected type(s):
int32
input_pin_of_consumer_op1 (Pin 1002)
- Required: Yes
- Expected type(s):
int32
consumer_op1 (Pin 1003)
- Required: Yes
- Expected type(s):
operator
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 | iterator |
iterator (Pin 0)
- Expected type(s):
to connect to producer_consumer_for_each
Configurations
This operator supports configuration options that modify its behavior.
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: make_producer_consumer_for_each_iterator
Full name: utility.make_producer_consumer_for_each_iterator
Internal name: make_producer_consumer_for_each_iterator
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("make_producer_consumer_for_each_iterator"); // operator instantiation
op.connect(-1, my_try_generate_iterable);
op.connect(0, my_iterable);
op.connect(1, my_operator_to_iterate);
op.connect(2, my_pin_index);
op.connect(3, my_valueA);
op.connect(4, my_valueB);
op.connect(5, my_valueC);
op.connect(1000, my_producer_op1);
op.connect(1001, my_output_pin_of_producer_op1);
op.connect(1002, my_input_pin_of_consumer_op1);
op.connect(1003, my_consumer_op1);
my_iterator = op.getOutput<>(0);
CPython
import ansys.dpf.core as dpf
op = dpf.operators.utility.make_producer_consumer_for_each_iterator() # operator instantiation
op.inputs.try_generate_iterable.connect(my_try_generate_iterable)
op.inputs.iterable.connect(my_iterable)
op.inputs.operator_to_iterate.connect(my_operator_to_iterate)
op.inputs.pin_index.connect(my_pin_index)
op.inputs.valueA.connect(my_valueA)
op.inputs.valueB.connect(my_valueB)
op.inputs.valueC1.connect(my_valueC1)
op.inputs.valueC2.connect(my_valueC2)
op.inputs.producer_op11.connect(my_producer_op11)
op.inputs.producer_op12.connect(my_producer_op12)
op.inputs.output_pin_of_producer_op11.connect(my_output_pin_of_producer_op11)
op.inputs.output_pin_of_producer_op12.connect(my_output_pin_of_producer_op12)
op.inputs.input_pin_of_consumer_op11.connect(my_input_pin_of_consumer_op11)
op.inputs.input_pin_of_consumer_op12.connect(my_input_pin_of_consumer_op12)
op.inputs.consumer_op11.connect(my_consumer_op11)
op.inputs.consumer_op12.connect(my_consumer_op12)
my_iterator = op.outputs.iterator()
IPython
import mech_dpf
import Ans.DataProcessing as dpf
op = dpf.operators.utility.make_producer_consumer_for_each_iterator() # operator instantiation
op.inputs.try_generate_iterable.Connect(my_try_generate_iterable)
op.inputs.iterable.Connect(my_iterable)
op.inputs.operator_to_iterate.Connect(my_operator_to_iterate)
op.inputs.pin_index.Connect(my_pin_index)
op.inputs.valueA.Connect(my_valueA)
op.inputs.valueB.Connect(my_valueB)
op.inputs.valueC.Connect(my_valueC)
op.inputs.producer_op1.Connect(my_producer_op1)
op.inputs.output_pin_of_producer_op1.Connect(my_output_pin_of_producer_op1)
op.inputs.input_pin_of_consumer_op1.Connect(my_input_pin_of_consumer_op1)
op.inputs.consumer_op1.Connect(my_consumer_op1)
my_iterator = op.outputs.iterator.GetData()
Changelog
- Version 0.0.0: Initial release.