Skip to content

Commit b4bdc2f

Browse files
authored
Update the operators for 2023.2.pre0 (#644)
* Update code_generation.py Signed-off-by: paul.profizi <[email protected]> * Operators generated with dpf_standalone_win_v23.2.pre0 from #DPF - Server - Customer Portal-20221123.1 Signed-off-by: paul.profizi <[email protected]> * Update the operator generation script to have everything in one step. Signed-off-by: paul.profizi <[email protected]> * Regenerated operators Signed-off-by: paul.profizi <[email protected]> * Update code_generation.py Signed-off-by: paul.profizi <[email protected]> * Add server operators Signed-off-by: paul.profizi <[email protected]> * Loosen retry criteria for tests_remote_workflow and test_workflow (due to 221) Signed-off-by: paul.profizi <[email protected]> * Revert to manual generation Signed-off-by: paul.profizi <[email protected]> * Fix init files for hdf5 Signed-off-by: paul.profizi <[email protected]> * fix flake8 Signed-off-by: paul.profizi <[email protected]> * Loosen retries Signed-off-by: paul.profizi <[email protected]> Signed-off-by: paul.profizi <[email protected]>
1 parent 2c41da3 commit b4bdc2f

File tree

89 files changed

+18435
-1599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+18435
-1599
lines changed

.ci/code_generation.py

+16-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import time
66
import shutil
77

8+
9+
core.set_default_server_context(core.AvailableServerContexts.premium)
10+
811
if os.name == "posix":
912
LIB_TO_GENERATE = [
1013
"libAns.Dpf.Native.so",
@@ -24,7 +27,6 @@
2427
else:
2528
LIB_TO_GENERATE = [
2629
"Ans.Dpf.Native.dll",
27-
"Ans.Dpf.Mechanical.dll",
2830
"Ans.Dpf.FEMutils.dll",
2931
"meshOperatorsCore.dll",
3032
"mapdlOperatorsCore.dll",
@@ -62,13 +64,18 @@
6264
code_gen = core.Operator("python_generator")
6365
code_gen.connect(1, TARGET_PATH)
6466
for lib in LIB_TO_GENERATE:
65-
code_gen.connect(0, lib)
66-
if lib != LIB_TO_GENERATE[0]:
67-
code_gen.connect(2, False)
68-
else:
69-
code_gen.connect(2, True)
70-
code_gen.run()
71-
time.sleep(0.1)
67+
try:
68+
code_gen.connect(0, lib)
69+
if lib != LIB_TO_GENERATE[0]:
70+
code_gen.connect(2, False)
71+
else:
72+
code_gen.connect(2, True)
73+
print(f"Generating {lib} operators for server {core.SERVER.version}...")
74+
code_gen.run()
75+
time.sleep(0.1)
76+
except Exception as e:
77+
print(f"Could not generate operators for library {lib}:\n{str(e)}")
78+
raise e
7279

7380
for lib in LIB_OPTIONAL_TO_GENERATE:
7481
try:
@@ -77,6 +84,7 @@
7784
code_gen.connect(2, False)
7885
else:
7986
code_gen.connect(2, True)
87+
print(f"Generating optional {lib} operators for server {core.SERVER.version}...")
8088
code_gen.run()
8189
time.sleep(0.1)
8290
except Exception as e:

.github/workflows/test_docker.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ jobs:
125125
- name: "Test API test_workflow"
126126
uses: nick-fields/retry@v2
127127
with:
128-
timeout_minutes: 2
129-
max_attempts: 2
128+
timeout_minutes: 3
129+
max_attempts: 3
130130
shell: bash
131131
command: |
132132
pytest $DEBUG $COVERAGE --cov-append $RERUNS --junitxml=../tests/junit/test-results8.xml test_workflow/.

.github/workflows/tests.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ jobs:
216216
- name: "Test API test_remote_workflow"
217217
uses: nick-fields/retry@v2
218218
with:
219-
timeout_minutes: 3
219+
timeout_minutes: 4
220220
max_attempts: 3
221221
shell: bash
222222
command: |
@@ -239,8 +239,9 @@ jobs:
239239
- name: "Test API test_workflow"
240240
uses: nick-fields/retry@v2
241241
with:
242-
timeout_minutes: 2
243-
max_attempts: 2
242+
timeout_minutes: 3
243+
max_attempts: 4
244+
retry_wait_seconds: 15
244245
shell: bash
245246
command: |
246247
pytest $DEBUG $COVERAGE --cov-append $RERUNS --junitxml=../tests/junit/test-results8.xml test_workflow/.

ansys/dpf/core/operators/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from . import math
2-
from . import result
32
from . import utility
4-
from . import min_max
3+
from . import result
54
from . import scoping
65
from . import filter
76
from . import logic
87
from . import metadata
9-
from . import serialization
8+
from . import min_max
109
from . import mesh
11-
from . import geo
10+
from . import serialization
1211
from . import averaging
12+
from . import geo
1313
from . import invariant
1414
from . import mapping
+11-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
from .elemental_difference import elemental_difference
21
from .elemental_nodal_to_nodal import elemental_nodal_to_nodal
32
from .elemental_nodal_to_nodal_fc import elemental_nodal_to_nodal_fc
43
from .elemental_to_nodal import elemental_to_nodal
54
from .elemental_to_nodal_fc import elemental_to_nodal_fc
6-
from .elemental_to_elemental_nodal import elemental_to_elemental_nodal
7-
from .nodal_difference import nodal_difference
8-
from .elemental_to_elemental_nodal_fc import elemental_to_elemental_nodal_fc
9-
from .nodal_difference_fc import nodal_difference_fc
10-
from .elemental_difference_fc import elemental_difference_fc
11-
from .nodal_fraction_fc import nodal_fraction_fc
12-
from .elemental_nodal_to_nodal_elemental_fc import elemental_nodal_to_nodal_elemental_fc
13-
from .elemental_fraction_fc import elemental_fraction_fc
145
from .to_nodal import to_nodal
6+
from .nodal_difference import nodal_difference
7+
from .elemental_to_elemental_nodal import elemental_to_elemental_nodal
158
from .to_nodal_fc import to_nodal_fc
169
from .nodal_extend_to_mid_nodes import nodal_extend_to_mid_nodes
10+
from .nodal_difference_fc import nodal_difference_fc
11+
from .elemental_to_elemental_nodal_fc import elemental_to_elemental_nodal_fc
1712
from .elemental_nodal_to_nodal_elemental import elemental_nodal_to_nodal_elemental
18-
from .extend_to_mid_nodes import extend_to_mid_nodes
19-
from .extend_to_mid_nodes_fc import extend_to_mid_nodes_fc
13+
from .nodal_fraction_fc import nodal_fraction_fc
14+
from .elemental_nodal_to_nodal_elemental_fc import elemental_nodal_to_nodal_elemental_fc
2015
from .elemental_mean import elemental_mean
2116
from .elemental_mean_fc import elemental_mean_fc
2217
from .to_elemental_fc import to_elemental_fc
2318
from .gauss_to_node_fc import gauss_to_node_fc
2419
from .nodal_to_elemental import nodal_to_elemental
2520
from .nodal_to_elemental_fc import nodal_to_elemental_fc
2621
from .to_elemental_nodal_fc import to_elemental_nodal_fc
22+
from .elemental_fraction_fc import elemental_fraction_fc
23+
from .elemental_difference import elemental_difference
24+
from .elemental_difference_fc import elemental_difference_fc
25+
from .extend_to_mid_nodes_fc import extend_to_mid_nodes_fc
26+
from .extend_to_mid_nodes import extend_to_mid_nodes

ansys/dpf/core/operators/build.py

+16-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from ansys.dpf.core.mapping_types import map_types_to_python
1414

1515

16+
dpf.set_default_server_context(dpf.AvailableServerContexts.premium)
1617
dpf.start_local_server(config=dpf.AvailableServerConfigs.LegacyGrpcServer)
1718

1819
def build_docstring(specification):
@@ -166,17 +167,25 @@ def build_operator(
166167

167168

168169
if __name__ == "__main__":
170+
print(f"Generating operators for server {dpf.SERVER.version}")
171+
169172
this_path = os.path.dirname(os.path.abspath(__file__))
170173

171174
available_operators = available_operator_names()
172175

176+
print(f"{len(available_operators)} operators found to generate.")
177+
173178
succeeded = 0
179+
done = 0
174180
for operator_name in available_operators:
181+
if succeeded == done + 100:
182+
done += 100
183+
print(f"{done} operators done...")
175184
specification = dpf.Operator.operator_specification(operator_name)
176185

177186
category = specification.properties.get("category", "")
178187
if not category:
179-
raise (f"Category not defined for operator {operator_name}.")
188+
raise ValueError(f"Category not defined for operator {operator_name}.")
180189
scripting_name = specification.properties.get("scripting_name", "")
181190

182191
# Make directory for new category
@@ -221,3 +230,9 @@ def build_operator(
221230

222231
print(f"Generated {succeeded} out of {len(available_operators)}")
223232
dpf.SERVER.shutdown()
233+
if succeeded == len(available_operators):
234+
print("Success")
235+
exit(0)
236+
else:
237+
print("Terminated with errors")
238+
exit(1)

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from .normals_provider_nl import normals_provider_nl
21
from .rotate_in_cylindrical_cs_fc import rotate_in_cylindrical_cs_fc
2+
from .elements_volumes_over_time import elements_volumes_over_time
3+
from .normals_provider_nl import normals_provider_nl
34
from .rotate_in_cylindrical_cs import rotate_in_cylindrical_cs
45
from .rotate import rotate
56
from .rotate_fc import rotate_fc
67
from .to_polar_coordinates import to_polar_coordinates
7-
from .elements_volumes_over_time import elements_volumes_over_time
8-
from .gauss_to_node import gauss_to_node
98
from .elements_facets_surfaces_over_time import elements_facets_surfaces_over_time
9+
from .gauss_to_node import gauss_to_node
1010
from .elements_volume import elements_volume
1111
from .element_nodal_contribution import element_nodal_contribution
1212
from .integrate_over_elements import integrate_over_elements

ansys/dpf/core/operators/geo/rotate_in_cylindrical_cs.py

+51-14
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class rotate_in_cylindrical_cs(Operator):
2626
3-3 rotation matrix and origin coordinates
2727
must be set here to define a
2828
coordinate system.
29+
mesh : MeshedRegion, optional
30+
Mesh support of the input field
2931
3032
3133
Examples
@@ -40,25 +42,32 @@ class rotate_in_cylindrical_cs(Operator):
4042
>>> op.inputs.field.connect(my_field)
4143
>>> my_coordinate_system = dpf.Field()
4244
>>> op.inputs.coordinate_system.connect(my_coordinate_system)
45+
>>> my_mesh = dpf.MeshedRegion()
46+
>>> op.inputs.mesh.connect(my_mesh)
4347
4448
>>> # Instantiate operator and connect inputs in one line
4549
>>> op = dpf.operators.geo.rotate_in_cylindrical_cs(
4650
... field=my_field,
4751
... coordinate_system=my_coordinate_system,
52+
... mesh=my_mesh,
4853
... )
4954
5055
>>> # Get output data
51-
>>> result_fields_container = op.outputs.fields_container()
56+
>>> result_field = op.outputs.field()
5257
"""
5358

54-
def __init__(self, field=None, coordinate_system=None, config=None, server=None):
59+
def __init__(
60+
self, field=None, coordinate_system=None, mesh=None, config=None, server=None
61+
):
5562
super().__init__(name="transform_cylindricalCS", config=config, server=server)
5663
self._inputs = InputsRotateInCylindricalCs(self)
5764
self._outputs = OutputsRotateInCylindricalCs(self)
5865
if field is not None:
5966
self.inputs.field.connect(field)
6067
if coordinate_system is not None:
6168
self.inputs.coordinate_system.connect(coordinate_system)
69+
if mesh is not None:
70+
self.inputs.mesh.connect(mesh)
6271

6372
@staticmethod
6473
def _spec():
@@ -85,11 +94,17 @@ def _spec():
8594
must be set here to define a
8695
coordinate system.""",
8796
),
97+
2: PinSpecification(
98+
name="mesh",
99+
type_names=["abstract_meshed_region"],
100+
optional=True,
101+
document="""Mesh support of the input field""",
102+
),
88103
},
89104
map_output_pin_spec={
90105
0: PinSpecification(
91-
name="fields_container",
92-
type_names=["fields_container"],
106+
name="field",
107+
type_names=["field"],
93108
optional=False,
94109
document="""""",
95110
),
@@ -146,6 +161,8 @@ class InputsRotateInCylindricalCs(_Inputs):
146161
>>> op.inputs.field.connect(my_field)
147162
>>> my_coordinate_system = dpf.Field()
148163
>>> op.inputs.coordinate_system.connect(my_coordinate_system)
164+
>>> my_mesh = dpf.MeshedRegion()
165+
>>> op.inputs.mesh.connect(my_mesh)
149166
"""
150167

151168
def __init__(self, op: Operator):
@@ -156,6 +173,8 @@ def __init__(self, op: Operator):
156173
rotate_in_cylindrical_cs._spec().input_pin(1), 1, op, -1
157174
)
158175
self._inputs.append(self._coordinate_system)
176+
self._mesh = Input(rotate_in_cylindrical_cs._spec().input_pin(2), 2, op, -1)
177+
self._inputs.append(self._mesh)
159178

160179
@property
161180
def field(self):
@@ -200,6 +219,26 @@ def coordinate_system(self):
200219
"""
201220
return self._coordinate_system
202221

222+
@property
223+
def mesh(self):
224+
"""Allows to connect mesh input to the operator.
225+
226+
Mesh support of the input field
227+
228+
Parameters
229+
----------
230+
my_mesh : MeshedRegion
231+
232+
Examples
233+
--------
234+
>>> from ansys.dpf import core as dpf
235+
>>> op = dpf.operators.geo.rotate_in_cylindrical_cs()
236+
>>> op.inputs.mesh.connect(my_mesh)
237+
>>> # or
238+
>>> op.inputs.mesh(my_mesh)
239+
"""
240+
return self._mesh
241+
203242

204243
class OutputsRotateInCylindricalCs(_Outputs):
205244
"""Intermediate class used to get outputs from
@@ -210,29 +249,27 @@ class OutputsRotateInCylindricalCs(_Outputs):
210249
>>> from ansys.dpf import core as dpf
211250
>>> op = dpf.operators.geo.rotate_in_cylindrical_cs()
212251
>>> # Connect inputs : op.inputs. ...
213-
>>> result_fields_container = op.outputs.fields_container()
252+
>>> result_field = op.outputs.field()
214253
"""
215254

216255
def __init__(self, op: Operator):
217256
super().__init__(rotate_in_cylindrical_cs._spec().outputs, op)
218-
self._fields_container = Output(
219-
rotate_in_cylindrical_cs._spec().output_pin(0), 0, op
220-
)
221-
self._outputs.append(self._fields_container)
257+
self._field = Output(rotate_in_cylindrical_cs._spec().output_pin(0), 0, op)
258+
self._outputs.append(self._field)
222259

223260
@property
224-
def fields_container(self):
225-
"""Allows to get fields_container output of the operator
261+
def field(self):
262+
"""Allows to get field output of the operator
226263
227264
Returns
228265
----------
229-
my_fields_container : FieldsContainer
266+
my_field : Field
230267
231268
Examples
232269
--------
233270
>>> from ansys.dpf import core as dpf
234271
>>> op = dpf.operators.geo.rotate_in_cylindrical_cs()
235272
>>> # Connect inputs : op.inputs. ...
236-
>>> result_fields_container = op.outputs.fields_container()
273+
>>> result_field = op.outputs.field()
237274
""" # noqa: E501
238-
return self._fields_container
275+
return self._field

0 commit comments

Comments
 (0)