Skip to content

Commit c110af5

Browse files
github-actions[bot]rlagharafacanton
authored
update operators (#1131)
Co-authored-by: rlagha <[email protected]> Co-authored-by: Rafael Canton <[email protected]>
1 parent c603f27 commit c110af5

File tree

12 files changed

+892
-136
lines changed

12 files changed

+892
-136
lines changed

docs/source/_static/dpf_operators.html

+6-6
Large diffs are not rendered by default.

src/ansys/dpf/core/operators/filter/filtering_max_over_time.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212

1313
class filtering_max_over_time(Operator):
1414
"""Creates a filtering workflow that will filter results based on a
15-
threshold of Selected invariant.
15+
threshold of a selected invariant.
1616
1717
Parameters
1818
----------
1919
invariant_fc_operator : str
20-
Name of nvariant operator to be used to
21-
calculate filter (e.g. eqv_fc).
20+
Name of the invariant operator to be used to
21+
calculate filter (avalailable:
22+
eqv_fc, invariants_deriv_fc,
23+
invariants_fc).
2224
output_pin : int, optional
2325
Output pin of the invariant operator. default
2426
= 0.
@@ -83,16 +85,18 @@ def __init__(
8385
@staticmethod
8486
def _spec():
8587
description = """Creates a filtering workflow that will filter results based on a
86-
threshold of Selected invariant."""
88+
threshold of a selected invariant."""
8789
spec = Specification(
8890
description=description,
8991
map_input_pin_spec={
9092
0: PinSpecification(
9193
name="invariant_fc_operator",
9294
type_names=["string"],
9395
optional=False,
94-
document="""Name of nvariant operator to be used to
95-
calculate filter (e.g. eqv_fc).""",
96+
document="""Name of the invariant operator to be used to
97+
calculate filter (avalailable:
98+
eqv_fc, invariants_deriv_fc,
99+
invariants_fc).""",
96100
),
97101
1: PinSpecification(
98102
name="output_pin",
@@ -203,8 +207,10 @@ def __init__(self, op: Operator):
203207
def invariant_fc_operator(self):
204208
"""Allows to connect invariant_fc_operator input to the operator.
205209
206-
Name of nvariant operator to be used to
207-
calculate filter (e.g. eqv_fc).
210+
Name of the invariant operator to be used to
211+
calculate filter (avalailable:
212+
eqv_fc, invariants_deriv_fc,
213+
invariants_fc).
208214
209215
Parameters
210216
----------

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

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from .elements_facets_surfaces_over_time import elements_facets_surfaces_over_time
55
from .elements_volume import elements_volume
66
from .elements_volumes_over_time import elements_volumes_over_time
7+
from .faces_area import faces_area
78
from .gauss_to_node import gauss_to_node
89
from .integrate_over_elements import integrate_over_elements
910
from .normals import normals

src/ansys/dpf/core/operators/geo/elements_volume.py

+19-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@
1111

1212

1313
class elements_volume(Operator):
14-
"""Compute the volume of each element of a mesh using default shape
15-
functions.
14+
"""Compute the measure of the Elements (volume for 3D elements, surface
15+
for 2D elements or length for 1D elements) using default shape
16+
functions, except for polyhedrons.
1617
1718
Parameters
1819
----------
1920
mesh : MeshedRegion
2021
mesh_scoping : Scoping
22+
If not provided, the measure of all elements
23+
for the mesh is computed. if
24+
provided, the scoping needs to have
25+
"elemental" location.
2126
2227
2328
Examples
@@ -54,8 +59,9 @@ def __init__(self, mesh=None, mesh_scoping=None, config=None, server=None):
5459

5560
@staticmethod
5661
def _spec():
57-
description = """Compute the volume of each element of a mesh using default shape
58-
functions."""
62+
description = """Compute the measure of the Elements (volume for 3D elements, surface
63+
for 2D elements or length for 1D elements) using default
64+
shape functions, except for polyhedrons."""
5965
spec = Specification(
6066
description=description,
6167
map_input_pin_spec={
@@ -69,7 +75,10 @@ def _spec():
6975
name="mesh_scoping",
7076
type_names=["scoping"],
7177
optional=False,
72-
document="""""",
78+
document="""If not provided, the measure of all elements
79+
for the mesh is computed. if
80+
provided, the scoping needs to have
81+
"elemental" location.""",
7382
),
7483
},
7584
map_output_pin_spec={
@@ -163,6 +172,11 @@ def mesh(self):
163172
def mesh_scoping(self):
164173
"""Allows to connect mesh_scoping input to the operator.
165174
175+
If not provided, the measure of all elements
176+
for the mesh is computed. if
177+
provided, the scoping needs to have
178+
"elemental" location.
179+
166180
Parameters
167181
----------
168182
my_mesh_scoping : Scoping
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
"""
2+
faces_area
3+
==========
4+
Autogenerated DPF operator classes.
5+
"""
6+
from warnings import warn
7+
from ansys.dpf.core.dpf_operator import Operator
8+
from ansys.dpf.core.inputs import Input, _Inputs
9+
from ansys.dpf.core.outputs import Output, _Outputs
10+
from ansys.dpf.core.operators.specification import PinSpecification, Specification
11+
12+
13+
class faces_area(Operator):
14+
"""Compute the measure of the Faces (surface for 2D faces of a 3D model
15+
or length for 1D faces of a 2D model) using default shape
16+
functions, except for polygons.
17+
18+
Parameters
19+
----------
20+
mesh : MeshedRegion
21+
mesh_scoping : Scoping
22+
If not provided, the measure of all faces in
23+
the mesh is computed. if provided,
24+
the scoping needs to have "faces"
25+
location.
26+
27+
28+
Examples
29+
--------
30+
>>> from ansys.dpf import core as dpf
31+
32+
>>> # Instantiate operator
33+
>>> op = dpf.operators.geo.faces_area()
34+
35+
>>> # Make input connections
36+
>>> my_mesh = dpf.MeshedRegion()
37+
>>> op.inputs.mesh.connect(my_mesh)
38+
>>> my_mesh_scoping = dpf.Scoping()
39+
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
40+
41+
>>> # Instantiate operator and connect inputs in one line
42+
>>> op = dpf.operators.geo.faces_area(
43+
... mesh=my_mesh,
44+
... mesh_scoping=my_mesh_scoping,
45+
... )
46+
47+
>>> # Get output data
48+
>>> result_field = op.outputs.field()
49+
"""
50+
51+
def __init__(self, mesh=None, mesh_scoping=None, config=None, server=None):
52+
super().__init__(name="face::area", config=config, server=server)
53+
self._inputs = InputsFacesArea(self)
54+
self._outputs = OutputsFacesArea(self)
55+
if mesh is not None:
56+
self.inputs.mesh.connect(mesh)
57+
if mesh_scoping is not None:
58+
self.inputs.mesh_scoping.connect(mesh_scoping)
59+
60+
@staticmethod
61+
def _spec():
62+
description = """Compute the measure of the Faces (surface for 2D faces of a 3D model
63+
or length for 1D faces of a 2D model) using default shape
64+
functions, except for polygons."""
65+
spec = Specification(
66+
description=description,
67+
map_input_pin_spec={
68+
0: PinSpecification(
69+
name="mesh",
70+
type_names=["abstract_meshed_region"],
71+
optional=False,
72+
document="""""",
73+
),
74+
1: PinSpecification(
75+
name="mesh_scoping",
76+
type_names=["scoping"],
77+
optional=False,
78+
document="""If not provided, the measure of all faces in
79+
the mesh is computed. if provided,
80+
the scoping needs to have "faces"
81+
location.""",
82+
),
83+
},
84+
map_output_pin_spec={
85+
0: PinSpecification(
86+
name="field",
87+
type_names=["field"],
88+
optional=False,
89+
document="""""",
90+
),
91+
},
92+
)
93+
return spec
94+
95+
@staticmethod
96+
def default_config(server=None):
97+
"""Returns the default config of the operator.
98+
99+
This config can then be changed to the user needs and be used to
100+
instantiate the operator. The Configuration allows to customize
101+
how the operation will be processed by the operator.
102+
103+
Parameters
104+
----------
105+
server : server.DPFServer, optional
106+
Server with channel connected to the remote or local instance. When
107+
``None``, attempts to use the global server.
108+
"""
109+
return Operator.default_config(name="face::area", server=server)
110+
111+
@property
112+
def inputs(self):
113+
"""Enables to connect inputs to the operator
114+
115+
Returns
116+
--------
117+
inputs : InputsFacesArea
118+
"""
119+
return super().inputs
120+
121+
@property
122+
def outputs(self):
123+
"""Enables to get outputs of the operator by evaluating it
124+
125+
Returns
126+
--------
127+
outputs : OutputsFacesArea
128+
"""
129+
return super().outputs
130+
131+
132+
class InputsFacesArea(_Inputs):
133+
"""Intermediate class used to connect user inputs to
134+
faces_area operator.
135+
136+
Examples
137+
--------
138+
>>> from ansys.dpf import core as dpf
139+
>>> op = dpf.operators.geo.faces_area()
140+
>>> my_mesh = dpf.MeshedRegion()
141+
>>> op.inputs.mesh.connect(my_mesh)
142+
>>> my_mesh_scoping = dpf.Scoping()
143+
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
144+
"""
145+
146+
def __init__(self, op: Operator):
147+
super().__init__(faces_area._spec().inputs, op)
148+
self._mesh = Input(faces_area._spec().input_pin(0), 0, op, -1)
149+
self._inputs.append(self._mesh)
150+
self._mesh_scoping = Input(faces_area._spec().input_pin(1), 1, op, -1)
151+
self._inputs.append(self._mesh_scoping)
152+
153+
@property
154+
def mesh(self):
155+
"""Allows to connect mesh input to the operator.
156+
157+
Parameters
158+
----------
159+
my_mesh : MeshedRegion
160+
161+
Examples
162+
--------
163+
>>> from ansys.dpf import core as dpf
164+
>>> op = dpf.operators.geo.faces_area()
165+
>>> op.inputs.mesh.connect(my_mesh)
166+
>>> # or
167+
>>> op.inputs.mesh(my_mesh)
168+
"""
169+
return self._mesh
170+
171+
@property
172+
def mesh_scoping(self):
173+
"""Allows to connect mesh_scoping input to the operator.
174+
175+
If not provided, the measure of all faces in
176+
the mesh is computed. if provided,
177+
the scoping needs to have "faces"
178+
location.
179+
180+
Parameters
181+
----------
182+
my_mesh_scoping : Scoping
183+
184+
Examples
185+
--------
186+
>>> from ansys.dpf import core as dpf
187+
>>> op = dpf.operators.geo.faces_area()
188+
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
189+
>>> # or
190+
>>> op.inputs.mesh_scoping(my_mesh_scoping)
191+
"""
192+
return self._mesh_scoping
193+
194+
195+
class OutputsFacesArea(_Outputs):
196+
"""Intermediate class used to get outputs from
197+
faces_area operator.
198+
199+
Examples
200+
--------
201+
>>> from ansys.dpf import core as dpf
202+
>>> op = dpf.operators.geo.faces_area()
203+
>>> # Connect inputs : op.inputs. ...
204+
>>> result_field = op.outputs.field()
205+
"""
206+
207+
def __init__(self, op: Operator):
208+
super().__init__(faces_area._spec().outputs, op)
209+
self._field = Output(faces_area._spec().output_pin(0), 0, op)
210+
self._outputs.append(self._field)
211+
212+
@property
213+
def field(self):
214+
"""Allows to get field output of the operator
215+
216+
Returns
217+
----------
218+
my_field : Field
219+
220+
Examples
221+
--------
222+
>>> from ansys.dpf import core as dpf
223+
>>> op = dpf.operators.geo.faces_area()
224+
>>> # Connect inputs : op.inputs. ...
225+
>>> result_field = op.outputs.field()
226+
""" # noqa: E501
227+
return self._field

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

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from .descending_sort import descending_sort
88
from .descending_sort_fc import descending_sort_fc
99
from .enrich_materials import enrich_materials
10+
from .entity_selector import entity_selector
11+
from .entity_selector_fc import entity_selector_fc
1012
from .identical_fc import identical_fc
1113
from .identical_fields import identical_fields
1214
from .identical_meshes import identical_meshes

0 commit comments

Comments
 (0)