Skip to content

Commit 32d0e60

Browse files
authored
Revert changes to operators.mesh.meshes_provider due to an error server-side (#825)
1 parent 7ecefe5 commit 32d0e60

File tree

1 file changed

+153
-58
lines changed

1 file changed

+153
-58
lines changed

src/ansys/dpf/core/operators/mesh/meshes_provider.py

Lines changed: 153 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@
1111

1212

1313
class meshes_provider(Operator):
14-
"""Converts an Assembly Mesh into a DPF Meshes container
14+
"""Read meshes from result files. Meshes can be spatially or temporally
15+
varying.
1516
1617
Parameters
1718
----------
18-
assembly_mesh : AnsDispatchHolder or Struct Iansdispatch
19-
unit : str, optional
19+
time_scoping : Scoping or int, optional
20+
Time/freq set ids required in output
21+
streams_container : StreamsContainer, optional
22+
Result file container allowed to be kept open
23+
to cache data
24+
data_sources : DataSources
25+
Result file path container, used if no
26+
streams are set
27+
read_cyclic : int, optional
28+
If 1 cyclic symmetry is ignored, if 2 cyclic
29+
expansion is done (default is 1)
2030
2131
2232
Examples
@@ -27,54 +37,86 @@ class meshes_provider(Operator):
2737
>>> op = dpf.operators.mesh.meshes_provider()
2838
2939
>>> # Make input connections
30-
>>> my_assembly_mesh = dpf.AnsDispatchHolder()
31-
>>> op.inputs.assembly_mesh.connect(my_assembly_mesh)
32-
>>> my_unit = str()
33-
>>> op.inputs.unit.connect(my_unit)
40+
>>> my_time_scoping = dpf.Scoping()
41+
>>> op.inputs.time_scoping.connect(my_time_scoping)
42+
>>> my_streams_container = dpf.StreamsContainer()
43+
>>> op.inputs.streams_container.connect(my_streams_container)
44+
>>> my_data_sources = dpf.DataSources()
45+
>>> op.inputs.data_sources.connect(my_data_sources)
46+
>>> my_read_cyclic = int()
47+
>>> op.inputs.read_cyclic.connect(my_read_cyclic)
3448
3549
>>> # Instantiate operator and connect inputs in one line
3650
>>> op = dpf.operators.mesh.meshes_provider(
37-
... assembly_mesh=my_assembly_mesh,
38-
... unit=my_unit,
51+
... time_scoping=my_time_scoping,
52+
... streams_container=my_streams_container,
53+
... data_sources=my_data_sources,
54+
... read_cyclic=my_read_cyclic,
3955
... )
4056
4157
>>> # Get output data
42-
>>> result_meshes_container = op.outputs.meshes_container()
58+
>>> result_meshes = op.outputs.meshes()
4359
"""
4460

45-
def __init__(self, assembly_mesh=None, unit=None, config=None, server=None):
46-
super().__init__(
47-
name="acmo::acmo_live::meshes_provider", config=config, server=server
48-
)
61+
def __init__(
62+
self,
63+
time_scoping=None,
64+
streams_container=None,
65+
data_sources=None,
66+
read_cyclic=None,
67+
config=None,
68+
server=None,
69+
):
70+
super().__init__(name="meshes_provider", config=config, server=server)
4971
self._inputs = InputsMeshesProvider(self)
5072
self._outputs = OutputsMeshesProvider(self)
51-
if assembly_mesh is not None:
52-
self.inputs.assembly_mesh.connect(assembly_mesh)
53-
if unit is not None:
54-
self.inputs.unit.connect(unit)
73+
if time_scoping is not None:
74+
self.inputs.time_scoping.connect(time_scoping)
75+
if streams_container is not None:
76+
self.inputs.streams_container.connect(streams_container)
77+
if data_sources is not None:
78+
self.inputs.data_sources.connect(data_sources)
79+
if read_cyclic is not None:
80+
self.inputs.read_cyclic.connect(read_cyclic)
5581

5682
@staticmethod
5783
def _spec():
58-
description = """Converts an Assembly Mesh into a DPF Meshes container"""
84+
description = """Read meshes from result files. Meshes can be spatially or temporally
85+
varying."""
5986
spec = Specification(
6087
description=description,
6188
map_input_pin_spec={
6289
0: PinSpecification(
63-
name="assembly_mesh",
64-
type_names=["ans_dispatch_holder", "struct IAnsDispatch"],
90+
name="time_scoping",
91+
type_names=["scoping", "vector<int32>", "int32"],
92+
optional=True,
93+
document="""Time/freq set ids required in output""",
94+
),
95+
3: PinSpecification(
96+
name="streams_container",
97+
type_names=["streams_container"],
98+
optional=True,
99+
document="""Result file container allowed to be kept open
100+
to cache data""",
101+
),
102+
4: PinSpecification(
103+
name="data_sources",
104+
type_names=["data_sources"],
65105
optional=False,
66-
document="""""",
106+
document="""Result file path container, used if no
107+
streams are set""",
67108
),
68-
1: PinSpecification(
69-
name="unit",
70-
type_names=["string"],
109+
14: PinSpecification(
110+
name="read_cyclic",
111+
type_names=["enum dataProcessing::ECyclicReading", "int32"],
71112
optional=True,
72-
document="""""",
113+
document="""If 1 cyclic symmetry is ignored, if 2 cyclic
114+
expansion is done (default is 1)""",
73115
),
74116
},
75117
map_output_pin_spec={
76118
0: PinSpecification(
77-
name="meshes_container",
119+
name="meshes",
78120
type_names=["meshes_container"],
79121
optional=False,
80122
document="""""",
@@ -97,9 +139,7 @@ def default_config(server=None):
97139
Server with channel connected to the remote or local instance. When
98140
``None``, attempts to use the global server.
99141
"""
100-
return Operator.default_config(
101-
name="acmo::acmo_live::meshes_provider", server=server
102-
)
142+
return Operator.default_config(name="meshes_provider", server=server)
103143

104144
@property
105145
def inputs(self):
@@ -130,54 +170,109 @@ class InputsMeshesProvider(_Inputs):
130170
--------
131171
>>> from ansys.dpf import core as dpf
132172
>>> op = dpf.operators.mesh.meshes_provider()
133-
>>> my_assembly_mesh = dpf.AnsDispatchHolder()
134-
>>> op.inputs.assembly_mesh.connect(my_assembly_mesh)
135-
>>> my_unit = str()
136-
>>> op.inputs.unit.connect(my_unit)
173+
>>> my_time_scoping = dpf.Scoping()
174+
>>> op.inputs.time_scoping.connect(my_time_scoping)
175+
>>> my_streams_container = dpf.StreamsContainer()
176+
>>> op.inputs.streams_container.connect(my_streams_container)
177+
>>> my_data_sources = dpf.DataSources()
178+
>>> op.inputs.data_sources.connect(my_data_sources)
179+
>>> my_read_cyclic = int()
180+
>>> op.inputs.read_cyclic.connect(my_read_cyclic)
137181
"""
138182

139183
def __init__(self, op: Operator):
140184
super().__init__(meshes_provider._spec().inputs, op)
141-
self._assembly_mesh = Input(meshes_provider._spec().input_pin(0), 0, op, -1)
142-
self._inputs.append(self._assembly_mesh)
143-
self._unit = Input(meshes_provider._spec().input_pin(1), 1, op, -1)
144-
self._inputs.append(self._unit)
185+
self._time_scoping = Input(meshes_provider._spec().input_pin(0), 0, op, -1)
186+
self._inputs.append(self._time_scoping)
187+
self._streams_container = Input(meshes_provider._spec().input_pin(3), 3, op, -1)
188+
self._inputs.append(self._streams_container)
189+
self._data_sources = Input(meshes_provider._spec().input_pin(4), 4, op, -1)
190+
self._inputs.append(self._data_sources)
191+
self._read_cyclic = Input(meshes_provider._spec().input_pin(14), 14, op, -1)
192+
self._inputs.append(self._read_cyclic)
193+
194+
@property
195+
def time_scoping(self):
196+
"""Allows to connect time_scoping input to the operator.
197+
198+
Time/freq set ids required in output
199+
200+
Parameters
201+
----------
202+
my_time_scoping : Scoping or int
203+
204+
Examples
205+
--------
206+
>>> from ansys.dpf import core as dpf
207+
>>> op = dpf.operators.mesh.meshes_provider()
208+
>>> op.inputs.time_scoping.connect(my_time_scoping)
209+
>>> # or
210+
>>> op.inputs.time_scoping(my_time_scoping)
211+
"""
212+
return self._time_scoping
213+
214+
@property
215+
def streams_container(self):
216+
"""Allows to connect streams_container input to the operator.
217+
218+
Result file container allowed to be kept open
219+
to cache data
220+
221+
Parameters
222+
----------
223+
my_streams_container : StreamsContainer
224+
225+
Examples
226+
--------
227+
>>> from ansys.dpf import core as dpf
228+
>>> op = dpf.operators.mesh.meshes_provider()
229+
>>> op.inputs.streams_container.connect(my_streams_container)
230+
>>> # or
231+
>>> op.inputs.streams_container(my_streams_container)
232+
"""
233+
return self._streams_container
145234

146235
@property
147-
def assembly_mesh(self):
148-
"""Allows to connect assembly_mesh input to the operator.
236+
def data_sources(self):
237+
"""Allows to connect data_sources input to the operator.
238+
239+
Result file path container, used if no
240+
streams are set
149241
150242
Parameters
151243
----------
152-
my_assembly_mesh : AnsDispatchHolder or Struct Iansdispatch
244+
my_data_sources : DataSources
153245
154246
Examples
155247
--------
156248
>>> from ansys.dpf import core as dpf
157249
>>> op = dpf.operators.mesh.meshes_provider()
158-
>>> op.inputs.assembly_mesh.connect(my_assembly_mesh)
250+
>>> op.inputs.data_sources.connect(my_data_sources)
159251
>>> # or
160-
>>> op.inputs.assembly_mesh(my_assembly_mesh)
252+
>>> op.inputs.data_sources(my_data_sources)
161253
"""
162-
return self._assembly_mesh
254+
return self._data_sources
163255

164256
@property
165-
def unit(self):
166-
"""Allows to connect unit input to the operator.
257+
def read_cyclic(self):
258+
"""Allows to connect read_cyclic input to the operator.
259+
260+
If 1 cyclic symmetry is ignored, if 2 cyclic
261+
expansion is done (default is 1)
167262
168263
Parameters
169264
----------
170-
my_unit : str
265+
my_read_cyclic : int
171266
172267
Examples
173268
--------
174269
>>> from ansys.dpf import core as dpf
175270
>>> op = dpf.operators.mesh.meshes_provider()
176-
>>> op.inputs.unit.connect(my_unit)
271+
>>> op.inputs.read_cyclic.connect(my_read_cyclic)
177272
>>> # or
178-
>>> op.inputs.unit(my_unit)
273+
>>> op.inputs.read_cyclic(my_read_cyclic)
179274
"""
180-
return self._unit
275+
return self._read_cyclic
181276

182277

183278
class OutputsMeshesProvider(_Outputs):
@@ -189,27 +284,27 @@ class OutputsMeshesProvider(_Outputs):
189284
>>> from ansys.dpf import core as dpf
190285
>>> op = dpf.operators.mesh.meshes_provider()
191286
>>> # Connect inputs : op.inputs. ...
192-
>>> result_meshes_container = op.outputs.meshes_container()
287+
>>> result_meshes = op.outputs.meshes()
193288
"""
194289

195290
def __init__(self, op: Operator):
196291
super().__init__(meshes_provider._spec().outputs, op)
197-
self._meshes_container = Output(meshes_provider._spec().output_pin(0), 0, op)
198-
self._outputs.append(self._meshes_container)
292+
self._meshes = Output(meshes_provider._spec().output_pin(0), 0, op)
293+
self._outputs.append(self._meshes)
199294

200295
@property
201-
def meshes_container(self):
202-
"""Allows to get meshes_container output of the operator
296+
def meshes(self):
297+
"""Allows to get meshes output of the operator
203298
204299
Returns
205300
----------
206-
my_meshes_container : MeshesContainer
301+
my_meshes : MeshesContainer
207302
208303
Examples
209304
--------
210305
>>> from ansys.dpf import core as dpf
211306
>>> op = dpf.operators.mesh.meshes_provider()
212307
>>> # Connect inputs : op.inputs. ...
213-
>>> result_meshes_container = op.outputs.meshes_container()
308+
>>> result_meshes = op.outputs.meshes()
214309
""" # noqa: E501
215-
return self._meshes_container
310+
return self._meshes

0 commit comments

Comments
 (0)