Skip to content

Commit e3c0949

Browse files
Update generated code for DPF 261_daily on main (#2837)
Co-authored-by: PProfizi <100710998+PProfizi@users.noreply.github.com>
1 parent f184fc2 commit e3c0949

File tree

6 files changed

+842
-10
lines changed

6 files changed

+842
-10
lines changed

doc/source/_static/dpf_operators.html

Lines changed: 48 additions & 10 deletions
Large diffs are not rendered by default.

src/ansys/dpf/core/operators/utility/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from .change_location import change_location
88
from .change_shell_layers import change_shell_layers
99
from .compute_time_scoping import compute_time_scoping
10+
from .concatenate_fields import concatenate_fields
11+
from .concatenate_fields_containers import concatenate_fields_containers
1012
from .customtypefield_get_attribute import customtypefield_get_attribute
1113
from .cyclic_support_get_attribute import cyclic_support_get_attribute
1214
from .default_value import default_value
Lines changed: 390 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,390 @@
1+
"""
2+
concatenate_fields
3+
4+
Autogenerated DPF operator classes.
5+
"""
6+
7+
from __future__ import annotations
8+
from typing import TYPE_CHECKING
9+
10+
from warnings import warn
11+
from ansys.dpf.core.dpf_operator import Operator
12+
from ansys.dpf.core.inputs import Input, _Inputs
13+
from ansys.dpf.core.outputs import Output, _Outputs
14+
from ansys.dpf.core.operators.specification import PinSpecification, Specification
15+
from ansys.dpf.core.config import Config
16+
from ansys.dpf.core.server_types import AnyServerType
17+
18+
if TYPE_CHECKING:
19+
from ansys.dpf.core.field import Field
20+
21+
22+
class concatenate_fields(Operator):
23+
r"""Concatenates fields into a unique one by incrementing the number of
24+
components.
25+
26+
Example: - Field1 components: { UX, UY, UZ } - Field2 components: { RX,
27+
RY, RZ } - Output field : { UX, UY, UZ, RX, RY, RZ }
28+
29+
30+
Inputs
31+
------
32+
rescoping_value: float, optional
33+
Value used to fill the missing values when scopings are different. Default is 0.
34+
reference_scoping_index: int, optional
35+
Pin of the field of which to take the scoping for the output field.
36+
If -1 all scopings will be merged, if -2 all scopings will be intersected. Default is -1
37+
field_support: AbstractFieldSupport, optional
38+
Support of the output field.
39+
fields1:
40+
A vector of fields to merge from pin 0 to ...
41+
fields2:
42+
A vector of fields to merge from pin 0 to ...
43+
44+
Outputs
45+
-------
46+
merged_fields: Field
47+
Field which has as many components as the sum of all the input fields' numbers of components.
48+
49+
Examples
50+
--------
51+
>>> from ansys.dpf import core as dpf
52+
53+
>>> # Instantiate operator
54+
>>> op = dpf.operators.utility.concatenate_fields()
55+
56+
>>> # Make input connections
57+
>>> my_rescoping_value = float()
58+
>>> op.inputs.rescoping_value.connect(my_rescoping_value)
59+
>>> my_reference_scoping_index = int()
60+
>>> op.inputs.reference_scoping_index.connect(my_reference_scoping_index)
61+
>>> my_field_support = dpf.AbstractFieldSupport()
62+
>>> op.inputs.field_support.connect(my_field_support)
63+
>>> my_fields1 = dpf.()
64+
>>> op.inputs.fields1.connect(my_fields1)
65+
>>> my_fields2 = dpf.()
66+
>>> op.inputs.fields2.connect(my_fields2)
67+
68+
>>> # Instantiate operator and connect inputs in one line
69+
>>> op = dpf.operators.utility.concatenate_fields(
70+
... rescoping_value=my_rescoping_value,
71+
... reference_scoping_index=my_reference_scoping_index,
72+
... field_support=my_field_support,
73+
... fields1=my_fields1,
74+
... fields2=my_fields2,
75+
... )
76+
77+
>>> # Get output data
78+
>>> result_merged_fields = op.outputs.merged_fields()
79+
"""
80+
81+
def __init__(
82+
self,
83+
rescoping_value=None,
84+
reference_scoping_index=None,
85+
field_support=None,
86+
fields1=None,
87+
fields2=None,
88+
config=None,
89+
server=None,
90+
):
91+
super().__init__(
92+
name="merge::concatenate_fields",
93+
config=config,
94+
server=server,
95+
inputs_type=InputsConcatenateFields,
96+
outputs_type=OutputsConcatenateFields,
97+
)
98+
if rescoping_value is not None:
99+
self.inputs.rescoping_value.connect(rescoping_value)
100+
if reference_scoping_index is not None:
101+
self.inputs.reference_scoping_index.connect(reference_scoping_index)
102+
if field_support is not None:
103+
self.inputs.field_support.connect(field_support)
104+
if fields1 is not None:
105+
self.inputs.fields1.connect(fields1)
106+
if fields2 is not None:
107+
self.inputs.fields2.connect(fields2)
108+
109+
@staticmethod
110+
def _spec() -> Specification:
111+
description = r"""Concatenates fields into a unique one by incrementing the number of
112+
components.
113+
114+
Example: - Field1 components: { UX, UY, UZ } - Field2 components: { RX,
115+
RY, RZ } - Output field : { UX, UY, UZ, RX, RY, RZ }
116+
"""
117+
spec = Specification(
118+
description=description,
119+
map_input_pin_spec={
120+
-3: PinSpecification(
121+
name="rescoping_value",
122+
type_names=["double"],
123+
optional=True,
124+
document=r"""Value used to fill the missing values when scopings are different. Default is 0.""",
125+
),
126+
-2: PinSpecification(
127+
name="reference_scoping_index",
128+
type_names=["int32"],
129+
optional=True,
130+
document=r"""Pin of the field of which to take the scoping for the output field.
131+
If -1 all scopings will be merged, if -2 all scopings will be intersected. Default is -1""",
132+
),
133+
-1: PinSpecification(
134+
name="field_support",
135+
type_names=["abstract_field_support"],
136+
optional=True,
137+
document=r"""Support of the output field.""",
138+
),
139+
0: PinSpecification(
140+
name="fields",
141+
type_names=["any"],
142+
optional=False,
143+
document=r"""A vector of fields to merge from pin 0 to ...""",
144+
),
145+
1: PinSpecification(
146+
name="fields",
147+
type_names=["any"],
148+
optional=False,
149+
document=r"""A vector of fields to merge from pin 0 to ...""",
150+
),
151+
},
152+
map_output_pin_spec={
153+
0: PinSpecification(
154+
name="merged_fields",
155+
type_names=["field"],
156+
optional=False,
157+
document=r"""Field which has as many components as the sum of all the input fields' numbers of components.""",
158+
),
159+
},
160+
)
161+
return spec
162+
163+
@staticmethod
164+
def default_config(server: AnyServerType = None) -> Config:
165+
"""Returns the default config of the operator.
166+
167+
This config can then be changed to the user needs and be used to
168+
instantiate the operator. The Configuration allows to customize
169+
how the operation will be processed by the operator.
170+
171+
Parameters
172+
----------
173+
server:
174+
Server with channel connected to the remote or local instance. When
175+
``None``, attempts to use the global server.
176+
177+
Returns
178+
-------
179+
config:
180+
A new Config instance equivalent to the default config for this operator.
181+
"""
182+
return Operator.default_config(name="merge::concatenate_fields", server=server)
183+
184+
@property
185+
def inputs(self) -> InputsConcatenateFields:
186+
"""Enables to connect inputs to the operator
187+
188+
Returns
189+
--------
190+
inputs:
191+
An instance of InputsConcatenateFields.
192+
"""
193+
return self._inputs
194+
195+
@property
196+
def outputs(self) -> OutputsConcatenateFields:
197+
"""Enables to get outputs of the operator by evaluating it
198+
199+
Returns
200+
--------
201+
outputs:
202+
An instance of OutputsConcatenateFields.
203+
"""
204+
return self._outputs
205+
206+
207+
class InputsConcatenateFields(_Inputs):
208+
"""Intermediate class used to connect user inputs to
209+
concatenate_fields operator.
210+
211+
Examples
212+
--------
213+
>>> from ansys.dpf import core as dpf
214+
>>> op = dpf.operators.utility.concatenate_fields()
215+
>>> my_rescoping_value = float()
216+
>>> op.inputs.rescoping_value.connect(my_rescoping_value)
217+
>>> my_reference_scoping_index = int()
218+
>>> op.inputs.reference_scoping_index.connect(my_reference_scoping_index)
219+
>>> my_field_support = dpf.AbstractFieldSupport()
220+
>>> op.inputs.field_support.connect(my_field_support)
221+
>>> my_fields1 = dpf.()
222+
>>> op.inputs.fields1.connect(my_fields1)
223+
>>> my_fields2 = dpf.()
224+
>>> op.inputs.fields2.connect(my_fields2)
225+
"""
226+
227+
def __init__(self, op: Operator):
228+
super().__init__(concatenate_fields._spec().inputs, op)
229+
self._rescoping_value: Input[float] = Input(
230+
concatenate_fields._spec().input_pin(-3), -3, op, -1
231+
)
232+
self._inputs.append(self._rescoping_value)
233+
self._reference_scoping_index: Input[int] = Input(
234+
concatenate_fields._spec().input_pin(-2), -2, op, -1
235+
)
236+
self._inputs.append(self._reference_scoping_index)
237+
self._field_support: Input = Input(
238+
concatenate_fields._spec().input_pin(-1), -1, op, -1
239+
)
240+
self._inputs.append(self._field_support)
241+
self._fields1: Input = Input(concatenate_fields._spec().input_pin(0), 0, op, 0)
242+
self._inputs.append(self._fields1)
243+
self._fields2: Input = Input(concatenate_fields._spec().input_pin(1), 1, op, 1)
244+
self._inputs.append(self._fields2)
245+
246+
@property
247+
def rescoping_value(self) -> Input[float]:
248+
r"""Allows to connect rescoping_value input to the operator.
249+
250+
Value used to fill the missing values when scopings are different. Default is 0.
251+
252+
Returns
253+
-------
254+
input:
255+
An Input instance for this pin.
256+
257+
Examples
258+
--------
259+
>>> from ansys.dpf import core as dpf
260+
>>> op = dpf.operators.utility.concatenate_fields()
261+
>>> op.inputs.rescoping_value.connect(my_rescoping_value)
262+
>>> # or
263+
>>> op.inputs.rescoping_value(my_rescoping_value)
264+
"""
265+
return self._rescoping_value
266+
267+
@property
268+
def reference_scoping_index(self) -> Input[int]:
269+
r"""Allows to connect reference_scoping_index input to the operator.
270+
271+
Pin of the field of which to take the scoping for the output field.
272+
If -1 all scopings will be merged, if -2 all scopings will be intersected. Default is -1
273+
274+
Returns
275+
-------
276+
input:
277+
An Input instance for this pin.
278+
279+
Examples
280+
--------
281+
>>> from ansys.dpf import core as dpf
282+
>>> op = dpf.operators.utility.concatenate_fields()
283+
>>> op.inputs.reference_scoping_index.connect(my_reference_scoping_index)
284+
>>> # or
285+
>>> op.inputs.reference_scoping_index(my_reference_scoping_index)
286+
"""
287+
return self._reference_scoping_index
288+
289+
@property
290+
def field_support(self) -> Input:
291+
r"""Allows to connect field_support input to the operator.
292+
293+
Support of the output field.
294+
295+
Returns
296+
-------
297+
input:
298+
An Input instance for this pin.
299+
300+
Examples
301+
--------
302+
>>> from ansys.dpf import core as dpf
303+
>>> op = dpf.operators.utility.concatenate_fields()
304+
>>> op.inputs.field_support.connect(my_field_support)
305+
>>> # or
306+
>>> op.inputs.field_support(my_field_support)
307+
"""
308+
return self._field_support
309+
310+
@property
311+
def fields1(self) -> Input:
312+
r"""Allows to connect fields1 input to the operator.
313+
314+
A vector of fields to merge from pin 0 to ...
315+
316+
Returns
317+
-------
318+
input:
319+
An Input instance for this pin.
320+
321+
Examples
322+
--------
323+
>>> from ansys.dpf import core as dpf
324+
>>> op = dpf.operators.utility.concatenate_fields()
325+
>>> op.inputs.fields1.connect(my_fields1)
326+
>>> # or
327+
>>> op.inputs.fields1(my_fields1)
328+
"""
329+
return self._fields1
330+
331+
@property
332+
def fields2(self) -> Input:
333+
r"""Allows to connect fields2 input to the operator.
334+
335+
A vector of fields to merge from pin 0 to ...
336+
337+
Returns
338+
-------
339+
input:
340+
An Input instance for this pin.
341+
342+
Examples
343+
--------
344+
>>> from ansys.dpf import core as dpf
345+
>>> op = dpf.operators.utility.concatenate_fields()
346+
>>> op.inputs.fields2.connect(my_fields2)
347+
>>> # or
348+
>>> op.inputs.fields2(my_fields2)
349+
"""
350+
return self._fields2
351+
352+
353+
class OutputsConcatenateFields(_Outputs):
354+
"""Intermediate class used to get outputs from
355+
concatenate_fields operator.
356+
357+
Examples
358+
--------
359+
>>> from ansys.dpf import core as dpf
360+
>>> op = dpf.operators.utility.concatenate_fields()
361+
>>> # Connect inputs : op.inputs. ...
362+
>>> result_merged_fields = op.outputs.merged_fields()
363+
"""
364+
365+
def __init__(self, op: Operator):
366+
super().__init__(concatenate_fields._spec().outputs, op)
367+
self._merged_fields: Output[Field] = Output(
368+
concatenate_fields._spec().output_pin(0), 0, op
369+
)
370+
self._outputs.append(self._merged_fields)
371+
372+
@property
373+
def merged_fields(self) -> Output[Field]:
374+
r"""Allows to get merged_fields output of the operator
375+
376+
Field which has as many components as the sum of all the input fields' numbers of components.
377+
378+
Returns
379+
-------
380+
output:
381+
An Output instance for this pin.
382+
383+
Examples
384+
--------
385+
>>> from ansys.dpf import core as dpf
386+
>>> op = dpf.operators.utility.concatenate_fields()
387+
>>> # Get the output from op.outputs. ...
388+
>>> result_merged_fields = op.outputs.merged_fields()
389+
"""
390+
return self._merged_fields

0 commit comments

Comments
 (0)