Skip to content

Commit c796b47

Browse files
authored
update operators
1 parent 819df92 commit c796b47

File tree

14 files changed

+1136
-132
lines changed

14 files changed

+1136
-132
lines changed

docs/source/_static/dpf_operators.html

Lines changed: 7 additions & 80 deletions
Large diffs are not rendered by default.

src/ansys/dpf/core/operators/math/accumulate_level_over_label_fc.py

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@
1111

1212

1313
class accumulate_level_over_label_fc(Operator):
14-
"""Compute the component-wise sum over all the fields having the same id
15-
for the label set in input in the fields container and apply
14+
"""Compute the component-wise sum over all the fields that have the same
15+
ID as the label set as input in the fields container and apply
1616
10.0xlog10(data/10xx-12) on the result. This computation can be
17-
incremental, if the input fields container is connected and the
18-
operator is ran several time, the output field will be on all the
19-
inputs connected
17+
incremental. If the input fields container is connected and the
18+
operator is run multiple times, the output field will be on all
19+
the connected inputs.
2020
2121
Parameters
2222
----------
2323
fields_container : FieldsContainer
24+
label : str, optional
25+
Label of the fields container where it should
26+
operate.
2427
2528
2629
Examples
@@ -33,33 +36,39 @@ class accumulate_level_over_label_fc(Operator):
3336
>>> # Make input connections
3437
>>> my_fields_container = dpf.FieldsContainer()
3538
>>> op.inputs.fields_container.connect(my_fields_container)
39+
>>> my_label = str()
40+
>>> op.inputs.label.connect(my_label)
3641
3742
>>> # Instantiate operator and connect inputs in one line
3843
>>> op = dpf.operators.math.accumulate_level_over_label_fc(
3944
... fields_container=my_fields_container,
45+
... label=my_label,
4046
... )
4147
4248
>>> # Get output data
4349
>>> result_field = op.outputs.field()
4450
"""
4551

46-
def __init__(self, fields_container=None, config=None, server=None):
52+
def __init__(self, fields_container=None, label=None, config=None, server=None):
4753
super().__init__(
4854
name="accumulate_level_over_label_fc", config=config, server=server
4955
)
5056
self._inputs = InputsAccumulateLevelOverLabelFc(self)
5157
self._outputs = OutputsAccumulateLevelOverLabelFc(self)
5258
if fields_container is not None:
5359
self.inputs.fields_container.connect(fields_container)
60+
if label is not None:
61+
self.inputs.label.connect(label)
5462

5563
@staticmethod
5664
def _spec():
57-
description = """Compute the component-wise sum over all the fields having the same id
58-
for the label set in input in the fields container and
65+
description = """Compute the component-wise sum over all the fields that have the same
66+
ID as the label set as input in the fields container and
5967
apply 10.0xlog10(data/10xx-12) on the result. This
60-
computation can be incremental, if the input fields
61-
container is connected and the operator is ran several
62-
time, the output field will be on all the inputs connected"""
68+
computation can be incremental. If the input fields
69+
container is connected and the operator is run multiple
70+
times, the output field will be on all the connected
71+
inputs."""
6372
spec = Specification(
6473
description=description,
6574
map_input_pin_spec={
@@ -69,6 +78,13 @@ def _spec():
6978
optional=False,
7079
document="""""",
7180
),
81+
1: PinSpecification(
82+
name="label",
83+
type_names=["string"],
84+
optional=True,
85+
document="""Label of the fields container where it should
86+
operate.""",
87+
),
7288
},
7389
map_output_pin_spec={
7490
0: PinSpecification(
@@ -130,6 +146,8 @@ class InputsAccumulateLevelOverLabelFc(_Inputs):
130146
>>> op = dpf.operators.math.accumulate_level_over_label_fc()
131147
>>> my_fields_container = dpf.FieldsContainer()
132148
>>> op.inputs.fields_container.connect(my_fields_container)
149+
>>> my_label = str()
150+
>>> op.inputs.label.connect(my_label)
133151
"""
134152

135153
def __init__(self, op: Operator):
@@ -138,6 +156,10 @@ def __init__(self, op: Operator):
138156
accumulate_level_over_label_fc._spec().input_pin(0), 0, op, -1
139157
)
140158
self._inputs.append(self._fields_container)
159+
self._label = Input(
160+
accumulate_level_over_label_fc._spec().input_pin(1), 1, op, -1
161+
)
162+
self._inputs.append(self._label)
141163

142164
@property
143165
def fields_container(self):
@@ -157,6 +179,27 @@ def fields_container(self):
157179
"""
158180
return self._fields_container
159181

182+
@property
183+
def label(self):
184+
"""Allows to connect label input to the operator.
185+
186+
Label of the fields container where it should
187+
operate.
188+
189+
Parameters
190+
----------
191+
my_label : str
192+
193+
Examples
194+
--------
195+
>>> from ansys.dpf import core as dpf
196+
>>> op = dpf.operators.math.accumulate_level_over_label_fc()
197+
>>> op.inputs.label.connect(my_label)
198+
>>> # or
199+
>>> op.inputs.label(my_label)
200+
"""
201+
return self._label
202+
160203

161204
class OutputsAccumulateLevelOverLabelFc(_Outputs):
162205
"""Intermediate class used to get outputs from

src/ansys/dpf/core/operators/math/accumulate_min_over_label_fc.py

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@
1111

1212

1313
class accumulate_min_over_label_fc(Operator):
14-
"""Compute the component-wise sum over all the fields having the same id
15-
for the label set in input in the fields container and take its
16-
opposite. This computation can be incremental, if the input fields
17-
container is connected and the operator is ran several time, the
18-
output field will be on all the inputs connected
14+
"""Compute the component-wise sum over all the fields that have the same
15+
ID as the label set as input in the fields container and take its
16+
opposite. This computation can be incremental. If the input fields
17+
container is connected and the operator is run multiple times, the
18+
output field will be on all the connected inputs.
1919
2020
Parameters
2121
----------
2222
fields_container : FieldsContainer
23+
label : str, optional
24+
Label of the fields container where it should
25+
operate.
2326
2427
2528
Examples
@@ -32,33 +35,38 @@ class accumulate_min_over_label_fc(Operator):
3235
>>> # Make input connections
3336
>>> my_fields_container = dpf.FieldsContainer()
3437
>>> op.inputs.fields_container.connect(my_fields_container)
38+
>>> my_label = str()
39+
>>> op.inputs.label.connect(my_label)
3540
3641
>>> # Instantiate operator and connect inputs in one line
3742
>>> op = dpf.operators.math.accumulate_min_over_label_fc(
3843
... fields_container=my_fields_container,
44+
... label=my_label,
3945
... )
4046
4147
>>> # Get output data
4248
>>> result_field = op.outputs.field()
4349
"""
4450

45-
def __init__(self, fields_container=None, config=None, server=None):
51+
def __init__(self, fields_container=None, label=None, config=None, server=None):
4652
super().__init__(
4753
name="accumulate_min_over_label_fc", config=config, server=server
4854
)
4955
self._inputs = InputsAccumulateMinOverLabelFc(self)
5056
self._outputs = OutputsAccumulateMinOverLabelFc(self)
5157
if fields_container is not None:
5258
self.inputs.fields_container.connect(fields_container)
59+
if label is not None:
60+
self.inputs.label.connect(label)
5361

5462
@staticmethod
5563
def _spec():
56-
description = """Compute the component-wise sum over all the fields having the same id
57-
for the label set in input in the fields container and
58-
take its opposite. This computation can be incremental, if
64+
description = """Compute the component-wise sum over all the fields that have the same
65+
ID as the label set as input in the fields container and
66+
take its opposite. This computation can be incremental. If
5967
the input fields container is connected and the operator
60-
is ran several time, the output field will be on all the
61-
inputs connected"""
68+
is run multiple times, the output field will be on all the
69+
connected inputs."""
6270
spec = Specification(
6371
description=description,
6472
map_input_pin_spec={
@@ -68,6 +76,13 @@ def _spec():
6876
optional=False,
6977
document="""""",
7078
),
79+
1: PinSpecification(
80+
name="label",
81+
type_names=["string"],
82+
optional=True,
83+
document="""Label of the fields container where it should
84+
operate.""",
85+
),
7186
},
7287
map_output_pin_spec={
7388
0: PinSpecification(
@@ -129,6 +144,8 @@ class InputsAccumulateMinOverLabelFc(_Inputs):
129144
>>> op = dpf.operators.math.accumulate_min_over_label_fc()
130145
>>> my_fields_container = dpf.FieldsContainer()
131146
>>> op.inputs.fields_container.connect(my_fields_container)
147+
>>> my_label = str()
148+
>>> op.inputs.label.connect(my_label)
132149
"""
133150

134151
def __init__(self, op: Operator):
@@ -137,6 +154,10 @@ def __init__(self, op: Operator):
137154
accumulate_min_over_label_fc._spec().input_pin(0), 0, op, -1
138155
)
139156
self._inputs.append(self._fields_container)
157+
self._label = Input(
158+
accumulate_min_over_label_fc._spec().input_pin(1), 1, op, -1
159+
)
160+
self._inputs.append(self._label)
140161

141162
@property
142163
def fields_container(self):
@@ -156,6 +177,27 @@ def fields_container(self):
156177
"""
157178
return self._fields_container
158179

180+
@property
181+
def label(self):
182+
"""Allows to connect label input to the operator.
183+
184+
Label of the fields container where it should
185+
operate.
186+
187+
Parameters
188+
----------
189+
my_label : str
190+
191+
Examples
192+
--------
193+
>>> from ansys.dpf import core as dpf
194+
>>> op = dpf.operators.math.accumulate_min_over_label_fc()
195+
>>> op.inputs.label.connect(my_label)
196+
>>> # or
197+
>>> op.inputs.label(my_label)
198+
"""
199+
return self._label
200+
159201

160202
class OutputsAccumulateMinOverLabelFc(_Outputs):
161203
"""Intermediate class used to get outputs from

src/ansys/dpf/core/operators/math/accumulate_over_label_fc.py

Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@
1111

1212

1313
class accumulate_over_label_fc(Operator):
14-
"""Compute the component-wise sum over all the fields having the same id
15-
for the label set in input in the fields container. This
16-
computation can be incremental, if the input fields container is
17-
connected and the operator is ran several time, the output field
18-
will be on all the inputs connected
14+
"""Compute the component-wise sum over all the fields that have the same
15+
ID as the label set as input in the fields container. This
16+
computation can be incremental. If the input fields container is
17+
connected and the operator is run multiple times, the output field
18+
will be on all the connected inputs.
1919
2020
Parameters
2121
----------
2222
fields_container : FieldsContainer
23+
label : str, optional
24+
Label of the fields container where it should
25+
operate.
2326
2427
2528
Examples
@@ -32,30 +35,36 @@ class accumulate_over_label_fc(Operator):
3235
>>> # Make input connections
3336
>>> my_fields_container = dpf.FieldsContainer()
3437
>>> op.inputs.fields_container.connect(my_fields_container)
38+
>>> my_label = str()
39+
>>> op.inputs.label.connect(my_label)
3540
3641
>>> # Instantiate operator and connect inputs in one line
3742
>>> op = dpf.operators.math.accumulate_over_label_fc(
3843
... fields_container=my_fields_container,
44+
... label=my_label,
3945
... )
4046
4147
>>> # Get output data
4248
>>> result_field = op.outputs.field()
4349
"""
4450

45-
def __init__(self, fields_container=None, config=None, server=None):
51+
def __init__(self, fields_container=None, label=None, config=None, server=None):
4652
super().__init__(name="accumulate_over_label_fc", config=config, server=server)
4753
self._inputs = InputsAccumulateOverLabelFc(self)
4854
self._outputs = OutputsAccumulateOverLabelFc(self)
4955
if fields_container is not None:
5056
self.inputs.fields_container.connect(fields_container)
57+
if label is not None:
58+
self.inputs.label.connect(label)
5159

5260
@staticmethod
5361
def _spec():
54-
description = """Compute the component-wise sum over all the fields having the same id
55-
for the label set in input in the fields container. This
56-
computation can be incremental, if the input fields
57-
container is connected and the operator is ran several
58-
time, the output field will be on all the inputs connected"""
62+
description = """Compute the component-wise sum over all the fields that have the same
63+
ID as the label set as input in the fields container. This
64+
computation can be incremental. If the input fields
65+
container is connected and the operator is run multiple
66+
times, the output field will be on all the connected
67+
inputs."""
5968
spec = Specification(
6069
description=description,
6170
map_input_pin_spec={
@@ -65,6 +74,13 @@ def _spec():
6574
optional=False,
6675
document="""""",
6776
),
77+
1: PinSpecification(
78+
name="label",
79+
type_names=["string"],
80+
optional=True,
81+
document="""Label of the fields container where it should
82+
operate.""",
83+
),
6884
},
6985
map_output_pin_spec={
7086
0: PinSpecification(
@@ -124,6 +140,8 @@ class InputsAccumulateOverLabelFc(_Inputs):
124140
>>> op = dpf.operators.math.accumulate_over_label_fc()
125141
>>> my_fields_container = dpf.FieldsContainer()
126142
>>> op.inputs.fields_container.connect(my_fields_container)
143+
>>> my_label = str()
144+
>>> op.inputs.label.connect(my_label)
127145
"""
128146

129147
def __init__(self, op: Operator):
@@ -132,6 +150,8 @@ def __init__(self, op: Operator):
132150
accumulate_over_label_fc._spec().input_pin(0), 0, op, -1
133151
)
134152
self._inputs.append(self._fields_container)
153+
self._label = Input(accumulate_over_label_fc._spec().input_pin(1), 1, op, -1)
154+
self._inputs.append(self._label)
135155

136156
@property
137157
def fields_container(self):
@@ -151,6 +171,27 @@ def fields_container(self):
151171
"""
152172
return self._fields_container
153173

174+
@property
175+
def label(self):
176+
"""Allows to connect label input to the operator.
177+
178+
Label of the fields container where it should
179+
operate.
180+
181+
Parameters
182+
----------
183+
my_label : str
184+
185+
Examples
186+
--------
187+
>>> from ansys.dpf import core as dpf
188+
>>> op = dpf.operators.math.accumulate_over_label_fc()
189+
>>> op.inputs.label.connect(my_label)
190+
>>> # or
191+
>>> op.inputs.label(my_label)
192+
"""
193+
return self._label
194+
154195

155196
class OutputsAccumulateOverLabelFc(_Outputs):
156197
"""Intermediate class used to get outputs from

0 commit comments

Comments
 (0)