ansys-fluent-core 0.29.dev0__py3-none-any.whl → 0.29.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ansys-fluent-core might be problematic. Click here for more details.
- ansys/fluent/core/__init__.py +1 -1
- ansys/fluent/core/_version.py +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/walk_api.py +45 -18
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/meshing/tui_252.py +395 -390
- ansys/fluent/core/generated/solver/settings_252.py +782 -306
- ansys/fluent/core/generated/solver/settings_252.pyi +442 -133
- ansys/fluent/core/generated/solver/tui_252.py +4046 -3737
- ansys/fluent/core/launcher/container_launcher.py +4 -3
- ansys/fluent/core/launcher/fluent_container.py +22 -19
- ansys/fluent/core/launcher/launcher.py +2 -2
- ansys/fluent/core/launcher/pim_launcher.py +2 -2
- ansys/fluent/core/launcher/slurm_launcher.py +2 -2
- ansys/fluent/core/launcher/standalone_launcher.py +2 -2
- ansys/fluent/core/logging.py +2 -0
- ansys/fluent/core/logging_config.yaml +3 -0
- ansys/fluent/core/services/app_utilities.py +2 -1
- ansys/fluent/core/services/datamodel_se.py +141 -61
- ansys/fluent/core/services/field_data.py +252 -0
- ansys/fluent/core/services/interceptors.py +28 -2
- ansys/fluent/core/session.py +7 -2
- ansys/fluent/core/session_solver.py +21 -0
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +12 -12
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/LICENSE +1 -1
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/METADATA +53 -31
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/RECORD +65 -141
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/WHEEL +1 -1
- ansys/fluent/core/docs/README.rst +0 -155
- ansys/fluent/tests/conftest.py +0 -415
- ansys/fluent/tests/fluent_fixtures.py +0 -195
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
- ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
- ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
- ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
- ansys/fluent/tests/test_aero_session.py +0 -88
- ansys/fluent/tests/test_batch_ops.py +0 -39
- ansys/fluent/tests/test_builtin_settings.py +0 -761
- ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
- ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
- ansys/fluent/tests/test_casereader.py +0 -324
- ansys/fluent/tests/test_codegen.py +0 -783
- ansys/fluent/tests/test_creatable.py +0 -31
- ansys/fluent/tests/test_data_model_cache.py +0 -434
- ansys/fluent/tests/test_datamodel_api.py +0 -449
- ansys/fluent/tests/test_datamodel_service.py +0 -814
- ansys/fluent/tests/test_datareader.py +0 -103
- ansys/fluent/tests/test_error_handling.py +0 -24
- ansys/fluent/tests/test_events_manager.py +0 -214
- ansys/fluent/tests/test_field_data.py +0 -466
- ansys/fluent/tests/test_file_session.py +0 -355
- ansys/fluent/tests/test_file_transfer_service.py +0 -165
- ansys/fluent/tests/test_fix_doc.py +0 -29
- ansys/fluent/tests/test_flobject.py +0 -1235
- ansys/fluent/tests/test_fluent_fixes.py +0 -106
- ansys/fluent/tests/test_fluent_session.py +0 -270
- ansys/fluent/tests/test_fluent_version.py +0 -66
- ansys/fluent/tests/test_fluent_version_marker.py +0 -65
- ansys/fluent/tests/test_icing_session.py +0 -9
- ansys/fluent/tests/test_launcher.py +0 -529
- ansys/fluent/tests/test_launcher_remote.py +0 -272
- ansys/fluent/tests/test_lispy.py +0 -40
- ansys/fluent/tests/test_logging.py +0 -16
- ansys/fluent/tests/test_mapped_api.py +0 -774
- ansys/fluent/tests/test_meshing_utilities.py +0 -2436
- ansys/fluent/tests/test_meshing_workflow.py +0 -421
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
- ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
- ansys/fluent/tests/test_preferences.py +0 -89
- ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
- ansys/fluent/tests/test_reduction.py +0 -484
- ansys/fluent/tests/test_rp_vars.py +0 -77
- ansys/fluent/tests/test_scheduler.py +0 -471
- ansys/fluent/tests/test_scheme_eval_222.py +0 -338
- ansys/fluent/tests/test_scheme_eval_231.py +0 -243
- ansys/fluent/tests/test_search.py +0 -344
- ansys/fluent/tests/test_session.py +0 -594
- ansys/fluent/tests/test_settings_api.py +0 -606
- ansys/fluent/tests/test_settings_reader.py +0 -85
- ansys/fluent/tests/test_slurm_future.py +0 -67
- ansys/fluent/tests/test_solution_variables.py +0 -241
- ansys/fluent/tests/test_solver_monitors.py +0 -83
- ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
- ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
- ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
- ansys/fluent/tests/test_solvermode/test_general.py +0 -109
- ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
- ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
- ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
- ansys/fluent/tests/test_solvermode/test_models.py +0 -99
- ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
- ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
- ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
- ansys/fluent/tests/test_streaming_services.py +0 -52
- ansys/fluent/tests/test_systemcoupling.py +0 -44
- ansys/fluent/tests/test_topy.py +0 -179
- ansys/fluent/tests/test_tui_api.py +0 -70
- ansys/fluent/tests/test_type_stub.py +0 -37
- ansys/fluent/tests/test_utils.py +0 -82
- ansys/fluent/tests/util/__init__.py +0 -36
- ansys/fluent/tests/util/meshing_workflow.py +0 -33
- ansys/fluent/tests/util/solver.py +0 -72
- ansys_fluent_core-0.29.dev0.dist-info/AUTHORS +0 -12
|
@@ -1,814 +0,0 @@
|
|
|
1
|
-
import gc
|
|
2
|
-
from time import sleep
|
|
3
|
-
|
|
4
|
-
from google.protobuf.json_format import MessageToDict
|
|
5
|
-
import pytest
|
|
6
|
-
from util import create_datamodel_root_in_server, create_root_using_datamodelgen
|
|
7
|
-
|
|
8
|
-
from ansys.api.fluent.v0 import datamodel_se_pb2
|
|
9
|
-
from ansys.api.fluent.v0.variant_pb2 import Variant
|
|
10
|
-
import ansys.fluent.core as pyfluent
|
|
11
|
-
from ansys.fluent.core import examples
|
|
12
|
-
from ansys.fluent.core.services.datamodel_se import (
|
|
13
|
-
PyMenuGeneric,
|
|
14
|
-
ReadOnlyObjectError,
|
|
15
|
-
_convert_value_to_variant,
|
|
16
|
-
_convert_variant_to_value,
|
|
17
|
-
convert_path_to_se_path,
|
|
18
|
-
)
|
|
19
|
-
from ansys.fluent.core.streaming_services.datamodel_streaming import DatamodelStream
|
|
20
|
-
from ansys.fluent.core.utils.execution import timeout_loop
|
|
21
|
-
from ansys.fluent.core.utils.fluent_version import FluentVersion
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@pytest.mark.parametrize(
|
|
25
|
-
"value,expected",
|
|
26
|
-
[
|
|
27
|
-
(None, None),
|
|
28
|
-
(False, False),
|
|
29
|
-
(True, True),
|
|
30
|
-
(1, 1),
|
|
31
|
-
(1.0, 1.0),
|
|
32
|
-
("abc", "abc"),
|
|
33
|
-
((1, 2, 3), [1, 2, 3]),
|
|
34
|
-
([1, 2, 3], [1, 2, 3]),
|
|
35
|
-
({"a": 5}, {"a": 5}),
|
|
36
|
-
({"a": [1, 2, 3]}, {"a": [1, 2, 3]}),
|
|
37
|
-
({"a": {"b": 5}}, {"a": {"b": 5}}),
|
|
38
|
-
],
|
|
39
|
-
)
|
|
40
|
-
def test_convert_value_to_variant_to_value(value, expected):
|
|
41
|
-
variant = Variant()
|
|
42
|
-
_convert_value_to_variant(value, variant)
|
|
43
|
-
assert expected == _convert_variant_to_value(variant)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
47
|
-
@pytest.mark.codegen_required
|
|
48
|
-
def test_event_subscription(new_meshing_session):
|
|
49
|
-
session = new_meshing_session
|
|
50
|
-
session.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
51
|
-
tags = [
|
|
52
|
-
"/workflow/created/TaskObject",
|
|
53
|
-
"/workflow/modified/TaskObject:TaskObject1/Arguments",
|
|
54
|
-
"/workflow/deleted/TaskObject:TaskObject1",
|
|
55
|
-
"/workflow/affected/TaskObject:TaskObject1",
|
|
56
|
-
"/workflow/affected/TaskObject",
|
|
57
|
-
"/workflow/attribute_changed/TaskObject:TaskObject1/TaskList/isActive",
|
|
58
|
-
"/workflow/command_attribute_changed/InitializeWorkflow/arguments",
|
|
59
|
-
]
|
|
60
|
-
version = session.get_fluent_version()
|
|
61
|
-
if version < FluentVersion.v252:
|
|
62
|
-
tags.append("/workflow/command_executed/InitializeWorkflow")
|
|
63
|
-
else:
|
|
64
|
-
# TODO: path should be appended to the tag
|
|
65
|
-
tags.append("/workflow/command_executed")
|
|
66
|
-
request = datamodel_se_pb2.SubscribeEventsRequest()
|
|
67
|
-
e1 = request.eventrequest.add(rules="workflow")
|
|
68
|
-
e1.createdEventRequest.parentpath = ""
|
|
69
|
-
e1.createdEventRequest.childtype = "TaskObject"
|
|
70
|
-
e2 = request.eventrequest.add(rules="workflow")
|
|
71
|
-
e2.modifiedEventRequest.path = "TaskObject:TaskObject1/Arguments"
|
|
72
|
-
e3 = request.eventrequest.add(rules="workflow")
|
|
73
|
-
e3.deletedEventRequest.path = "TaskObject:TaskObject1"
|
|
74
|
-
e4 = request.eventrequest.add(rules="workflow")
|
|
75
|
-
e4.affectedEventRequest.path = "TaskObject:TaskObject1"
|
|
76
|
-
e5 = request.eventrequest.add(rules="workflow")
|
|
77
|
-
e5.affectedEventRequest.path = ""
|
|
78
|
-
e5.affectedEventRequest.subtype = "TaskObject"
|
|
79
|
-
e6 = request.eventrequest.add(rules="workflow")
|
|
80
|
-
e6.attributeChangedEventRequest.path = "TaskObject:TaskObject1/TaskList"
|
|
81
|
-
e6.attributeChangedEventRequest.attribute = "isActive"
|
|
82
|
-
e7 = request.eventrequest.add(rules="workflow")
|
|
83
|
-
e7.commandAttributeChangedEventRequest.path = ""
|
|
84
|
-
e7.commandAttributeChangedEventRequest.command = "InitializeWorkflow"
|
|
85
|
-
e7.commandAttributeChangedEventRequest.attribute = "arguments"
|
|
86
|
-
e8 = request.eventrequest.add(rules="workflow")
|
|
87
|
-
e8.commandExecutedEventRequest.path = ""
|
|
88
|
-
e8.commandExecutedEventRequest.command = "InitializeWorkflow"
|
|
89
|
-
response = session._datamodel_service_se.subscribe_events(MessageToDict(request))
|
|
90
|
-
assert all(
|
|
91
|
-
[
|
|
92
|
-
r["status"] == datamodel_se_pb2.STATUS_SUBSCRIBED and r["tag"] == t
|
|
93
|
-
for r, t in zip(response, tags)
|
|
94
|
-
]
|
|
95
|
-
)
|
|
96
|
-
response = session._datamodel_service_se.unsubscribe_events(tags)
|
|
97
|
-
assert all(
|
|
98
|
-
[
|
|
99
|
-
r["status"] == datamodel_se_pb2.STATUS_UNSUBSCRIBED and r["tag"] == t
|
|
100
|
-
for r, t in zip(response, tags)
|
|
101
|
-
]
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
106
|
-
@pytest.mark.codegen_required
|
|
107
|
-
def test_add_on_child_created(new_meshing_session):
|
|
108
|
-
meshing = new_meshing_session
|
|
109
|
-
child_paths = []
|
|
110
|
-
subscription = meshing.workflow.add_on_child_created(
|
|
111
|
-
"TaskObject", lambda obj: child_paths.append(convert_path_to_se_path(obj.path))
|
|
112
|
-
)
|
|
113
|
-
assert child_paths == []
|
|
114
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
115
|
-
sleep(5)
|
|
116
|
-
assert len(child_paths) > 0
|
|
117
|
-
child_paths.clear()
|
|
118
|
-
subscription.unsubscribe()
|
|
119
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing")
|
|
120
|
-
sleep(5)
|
|
121
|
-
assert child_paths == []
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
125
|
-
@pytest.mark.codegen_required
|
|
126
|
-
def test_add_on_deleted(new_meshing_session):
|
|
127
|
-
meshing = new_meshing_session
|
|
128
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
129
|
-
data = []
|
|
130
|
-
_ = meshing.workflow.TaskObject["Import Geometry"].add_on_deleted(
|
|
131
|
-
lambda: data.append(True)
|
|
132
|
-
)
|
|
133
|
-
assert data == []
|
|
134
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing")
|
|
135
|
-
sleep(5)
|
|
136
|
-
assert len(data) > 0
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
140
|
-
@pytest.mark.codegen_required
|
|
141
|
-
def test_add_on_changed(new_meshing_session):
|
|
142
|
-
meshing = new_meshing_session
|
|
143
|
-
task_list = meshing.workflow.Workflow.TaskList
|
|
144
|
-
assert isinstance(task_list(), list)
|
|
145
|
-
assert len(task_list()) == 0
|
|
146
|
-
data = []
|
|
147
|
-
subscription = task_list.add_on_changed(lambda obj: data.append(True))
|
|
148
|
-
assert data == []
|
|
149
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
150
|
-
sleep(5)
|
|
151
|
-
assert len(data) > 0
|
|
152
|
-
assert len(task_list()) > 0
|
|
153
|
-
data.clear()
|
|
154
|
-
subscription.unsubscribe()
|
|
155
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing")
|
|
156
|
-
sleep(5)
|
|
157
|
-
assert data == []
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
161
|
-
@pytest.mark.codegen_required
|
|
162
|
-
def test_add_on_affected(new_meshing_session):
|
|
163
|
-
meshing = new_meshing_session
|
|
164
|
-
data = []
|
|
165
|
-
subscription = meshing.workflow.Workflow.add_on_affected(
|
|
166
|
-
lambda obj: data.append(True)
|
|
167
|
-
)
|
|
168
|
-
assert data == []
|
|
169
|
-
wt = meshing.watertight()
|
|
170
|
-
sleep(5)
|
|
171
|
-
assert len(data) > 0
|
|
172
|
-
assert data[0]
|
|
173
|
-
|
|
174
|
-
calls = []
|
|
175
|
-
subscription2 = meshing.workflow.add_on_affected(lambda obj: calls.append(True))
|
|
176
|
-
geom = examples.download_file(
|
|
177
|
-
file_name="mixing_elbow.pmdb", directory="pyfluent/mixing_elbow"
|
|
178
|
-
)
|
|
179
|
-
import_geom = meshing.workflow.TaskObject["Import Geometry"]
|
|
180
|
-
assert "FileName" not in import_geom.Arguments()
|
|
181
|
-
assert wt.import_geometry.command_arguments()["FileName"] is None
|
|
182
|
-
import_geom.Arguments = {"FileName": geom}
|
|
183
|
-
assert import_geom.Arguments()["FileName"] == geom
|
|
184
|
-
assert wt.import_geometry.command_arguments()["FileName"] == geom
|
|
185
|
-
sleep(1)
|
|
186
|
-
assert calls == [True]
|
|
187
|
-
import_geom.Arguments = {"FileName": "dummy"}
|
|
188
|
-
sleep(1)
|
|
189
|
-
assert calls == 2 * [True]
|
|
190
|
-
import_geom.Arguments = {"FileName": geom}
|
|
191
|
-
sleep(1)
|
|
192
|
-
assert calls == 3 * [True]
|
|
193
|
-
execute_state = [meshing.workflow()]
|
|
194
|
-
import_geom.Execute()
|
|
195
|
-
calls_after_execute = []
|
|
196
|
-
loop_count = 10
|
|
197
|
-
for i in range(loop_count):
|
|
198
|
-
sleep(5)
|
|
199
|
-
calls_after_execute.append(list(calls))
|
|
200
|
-
execute_state.append(meshing.workflow())
|
|
201
|
-
assert all(state == execute_state[1] for state in execute_state[2:])
|
|
202
|
-
call_count = sum(map(len, calls_after_execute))
|
|
203
|
-
assert call_count == 6 * loop_count
|
|
204
|
-
assert calls_after_execute == loop_count * [6 * [True]]
|
|
205
|
-
subscription2.unsubscribe()
|
|
206
|
-
|
|
207
|
-
data.clear()
|
|
208
|
-
subscription.unsubscribe()
|
|
209
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing")
|
|
210
|
-
sleep(5)
|
|
211
|
-
assert data == []
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
215
|
-
@pytest.mark.codegen_required
|
|
216
|
-
def test_add_on_affected_at_type_path(new_meshing_session):
|
|
217
|
-
meshing = new_meshing_session
|
|
218
|
-
data = []
|
|
219
|
-
subscription = meshing.workflow.add_on_affected_at_type_path(
|
|
220
|
-
"TaskObject", lambda obj: data.append(True)
|
|
221
|
-
)
|
|
222
|
-
assert data == []
|
|
223
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
224
|
-
sleep(5)
|
|
225
|
-
assert len(data) > 0
|
|
226
|
-
assert data[0]
|
|
227
|
-
data.clear()
|
|
228
|
-
subscription.unsubscribe()
|
|
229
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Fault-tolerant Meshing")
|
|
230
|
-
sleep(5)
|
|
231
|
-
assert data == []
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
235
|
-
@pytest.mark.codegen_required
|
|
236
|
-
def test_add_on_command_executed(new_meshing_session):
|
|
237
|
-
meshing = new_meshing_session
|
|
238
|
-
data = []
|
|
239
|
-
version = meshing.get_fluent_version()
|
|
240
|
-
if version < FluentVersion.v252:
|
|
241
|
-
subscription = meshing.meshing.add_on_command_executed_old(
|
|
242
|
-
"ImportGeometry", lambda obj, command, args: data.append(True)
|
|
243
|
-
)
|
|
244
|
-
else:
|
|
245
|
-
subscription = meshing.meshing.add_on_command_executed(
|
|
246
|
-
lambda obj, command, args: data.append(True)
|
|
247
|
-
)
|
|
248
|
-
assert data == []
|
|
249
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
250
|
-
import_file_name = examples.download_file(
|
|
251
|
-
"mixing_elbow.pmdb", "pyfluent/mixing_elbow"
|
|
252
|
-
)
|
|
253
|
-
meshing.meshing.ImportGeometry(FileName=import_file_name)
|
|
254
|
-
sleep(5)
|
|
255
|
-
assert len(data) > 0
|
|
256
|
-
assert data[0]
|
|
257
|
-
data.clear()
|
|
258
|
-
subscription.unsubscribe()
|
|
259
|
-
meshing.meshing.ImportGeometry(FileName=import_file_name)
|
|
260
|
-
sleep(5)
|
|
261
|
-
assert data == []
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
@pytest.mark.skip("https://github.com/ansys/pyfluent/issues/2999")
|
|
265
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
266
|
-
@pytest.mark.codegen_required
|
|
267
|
-
def test_datamodel_streaming_full_diff_state(
|
|
268
|
-
disable_datamodel_cache, new_meshing_session
|
|
269
|
-
):
|
|
270
|
-
meshing = new_meshing_session
|
|
271
|
-
datamodel_service_se = meshing._datamodel_service_se
|
|
272
|
-
stream = DatamodelStream(datamodel_service_se)
|
|
273
|
-
stream.start(rules="meshing", no_commands_diff_state=False)
|
|
274
|
-
|
|
275
|
-
def cb(state, deleted_paths):
|
|
276
|
-
if state:
|
|
277
|
-
state = _convert_variant_to_value(state)
|
|
278
|
-
cb.states.append(state)
|
|
279
|
-
|
|
280
|
-
cb.states = []
|
|
281
|
-
|
|
282
|
-
stream.register_callback(cb)
|
|
283
|
-
|
|
284
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
285
|
-
import_file_name = examples.download_file(
|
|
286
|
-
"mixing_elbow.pmdb", "pyfluent/mixing_elbow"
|
|
287
|
-
)
|
|
288
|
-
meshing.meshing.ImportGeometry(FileName=import_file_name)
|
|
289
|
-
sleep(5)
|
|
290
|
-
assert "ImportGeometry:ImportGeometry1" in (y for x in cb.states for y in x)
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
294
|
-
@pytest.mark.codegen_required
|
|
295
|
-
def test_datamodel_streaming_no_commands_diff_state(
|
|
296
|
-
disable_datamodel_cache, new_meshing_session
|
|
297
|
-
):
|
|
298
|
-
meshing = new_meshing_session
|
|
299
|
-
datamodel_service_se = meshing._datamodel_service_se
|
|
300
|
-
stream = DatamodelStream(datamodel_service_se)
|
|
301
|
-
stream.start(rules="meshing", no_commands_diff_state=True)
|
|
302
|
-
|
|
303
|
-
def cb(state, deleted_paths):
|
|
304
|
-
if state:
|
|
305
|
-
state = _convert_variant_to_value(state)
|
|
306
|
-
cb.states.append(state)
|
|
307
|
-
|
|
308
|
-
cb.states = []
|
|
309
|
-
|
|
310
|
-
stream.register_callback(cb)
|
|
311
|
-
|
|
312
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
313
|
-
import_file_name = examples.download_file(
|
|
314
|
-
"mixing_elbow.pmdb", "pyfluent/mixing_elbow"
|
|
315
|
-
)
|
|
316
|
-
meshing.meshing.ImportGeometry(FileName=import_file_name)
|
|
317
|
-
sleep(5)
|
|
318
|
-
assert "ImportGeometry:ImportGeometry1" not in (y for x in cb.states for y in x)
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
322
|
-
@pytest.mark.codegen_required
|
|
323
|
-
def test_get_object_names_wtm(new_meshing_session):
|
|
324
|
-
meshing = new_meshing_session
|
|
325
|
-
|
|
326
|
-
assert not meshing.workflow.TaskObject.get_object_names()
|
|
327
|
-
|
|
328
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
329
|
-
|
|
330
|
-
child_object_names = [
|
|
331
|
-
"Import Geometry",
|
|
332
|
-
"Add Local Sizing",
|
|
333
|
-
"Generate the Surface Mesh",
|
|
334
|
-
"Describe Geometry",
|
|
335
|
-
"Apply Share Topology",
|
|
336
|
-
"Enclose Fluid Regions (Capping)",
|
|
337
|
-
"Update Boundaries",
|
|
338
|
-
"Create Regions",
|
|
339
|
-
"Update Regions",
|
|
340
|
-
"Add Boundary Layers",
|
|
341
|
-
"Generate the Volume Mesh",
|
|
342
|
-
]
|
|
343
|
-
|
|
344
|
-
assert meshing.workflow.TaskObject.get_object_names() == child_object_names
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
348
|
-
@pytest.mark.codegen_required
|
|
349
|
-
def test_get_and_set_state_for_command_arg_instance(new_meshing_session):
|
|
350
|
-
meshing = new_meshing_session
|
|
351
|
-
|
|
352
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
353
|
-
|
|
354
|
-
x = meshing.meshing.ImportGeometry.create_instance()
|
|
355
|
-
|
|
356
|
-
assert x.LengthUnit() == "mm"
|
|
357
|
-
|
|
358
|
-
assert x.LengthUnit.allowed_values() == ["m", "cm", "mm", "in", "ft", "um", "nm"]
|
|
359
|
-
|
|
360
|
-
x.LengthUnit.set_state("ft")
|
|
361
|
-
|
|
362
|
-
assert x.LengthUnit.get_state() == "ft"
|
|
363
|
-
|
|
364
|
-
assert x.CadImportOptions.ExtractFeatures()
|
|
365
|
-
|
|
366
|
-
x.CadImportOptions.ExtractFeatures.set_state(False)
|
|
367
|
-
|
|
368
|
-
assert not x.CadImportOptions.ExtractFeatures()
|
|
369
|
-
|
|
370
|
-
x.set_state({"FileName": "dummy_file_name.dummy_extn"})
|
|
371
|
-
|
|
372
|
-
assert x.FileName() == "dummy_file_name.dummy_extn"
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
def _is_internal_name(name: str, prefix: str) -> bool:
|
|
376
|
-
return name.startswith(prefix) and name.removeprefix(prefix).isdigit()
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
@pytest.mark.codegen_required
|
|
380
|
-
def test_task_object_keys_are_display_names(new_meshing_session):
|
|
381
|
-
meshing = new_meshing_session
|
|
382
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
383
|
-
task_object_state = meshing.workflow.TaskObject()
|
|
384
|
-
assert len(task_object_state) > 0
|
|
385
|
-
assert not any(_is_internal_name(x, "TaskObject:") for x in task_object_state)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
def test_generic_datamodel(new_solver_session):
|
|
389
|
-
solver = new_solver_session
|
|
390
|
-
solver.scheme_eval.scheme_eval("(init-flserver)")
|
|
391
|
-
flserver = PyMenuGeneric(solver._datamodel_service_se, "flserver")
|
|
392
|
-
assert flserver.Case.Solution.Calculation.TimeStepSize() == 1.0
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
396
|
-
def test_named_object_specific_methods_using_flserver(new_solver_session):
|
|
397
|
-
import_file_name = examples.download_file(
|
|
398
|
-
"mixing_elbow.cas.h5", "pyfluent/mixing_elbow"
|
|
399
|
-
)
|
|
400
|
-
solver = new_solver_session
|
|
401
|
-
solver.file.read(file_type="case", file_name=import_file_name)
|
|
402
|
-
solver.solution.initialization.hybrid_initialize()
|
|
403
|
-
solver.solution.run_calculation.iterate(iter_count=10)
|
|
404
|
-
solver.tui.display.objects.create(
|
|
405
|
-
"contour",
|
|
406
|
-
"contour-z1",
|
|
407
|
-
"field",
|
|
408
|
-
"velocity-magnitude",
|
|
409
|
-
"surfaces-list",
|
|
410
|
-
"cold-inlet",
|
|
411
|
-
)
|
|
412
|
-
solver.tui.display.objects.create(
|
|
413
|
-
"contour",
|
|
414
|
-
"contour-z2",
|
|
415
|
-
"field",
|
|
416
|
-
"velocity-magnitude",
|
|
417
|
-
"surfaces-list",
|
|
418
|
-
"hot-inlet",
|
|
419
|
-
)
|
|
420
|
-
solver.tui.display.objects.create(
|
|
421
|
-
"contour",
|
|
422
|
-
"contour-z3",
|
|
423
|
-
"field",
|
|
424
|
-
"velocity-magnitude",
|
|
425
|
-
"surfaces-list",
|
|
426
|
-
"outlet",
|
|
427
|
-
)
|
|
428
|
-
solver.tui.display.objects.create(
|
|
429
|
-
"contour",
|
|
430
|
-
"contour-z4",
|
|
431
|
-
"field",
|
|
432
|
-
"velocity-magnitude",
|
|
433
|
-
"surfaces-list",
|
|
434
|
-
"wall-elbow",
|
|
435
|
-
)
|
|
436
|
-
solver.tui.display.objects.create(
|
|
437
|
-
"contour",
|
|
438
|
-
"contour-z5",
|
|
439
|
-
"field",
|
|
440
|
-
"velocity-magnitude",
|
|
441
|
-
"surfaces-list",
|
|
442
|
-
"wall-inlet",
|
|
443
|
-
)
|
|
444
|
-
|
|
445
|
-
flserver = PyMenuGeneric(solver._datamodel_service_se, "flserver")
|
|
446
|
-
|
|
447
|
-
assert set(flserver.Case.Results.Graphics.Contour.get_object_names()) == {
|
|
448
|
-
"contour-z1",
|
|
449
|
-
"contour-z2",
|
|
450
|
-
"contour-z3",
|
|
451
|
-
"contour-z4",
|
|
452
|
-
"contour-z5",
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
assert "contour-x1" not in flserver.Case.Results.Graphics.Contour.get_object_names()
|
|
456
|
-
|
|
457
|
-
flserver.Case.Results.Graphics.Contour["contour-z1"].rename("contour-x1")
|
|
458
|
-
|
|
459
|
-
assert "contour-x1" in flserver.Case.Results.Graphics.Contour.get_object_names()
|
|
460
|
-
|
|
461
|
-
flserver.Case.Results.Graphics.delete_child_objects(
|
|
462
|
-
"Contour", ["contour-x1", "contour-z2"]
|
|
463
|
-
)
|
|
464
|
-
|
|
465
|
-
assert set(flserver.Case.Results.Graphics.Contour.get_object_names()) == {
|
|
466
|
-
"contour-z3",
|
|
467
|
-
"contour-z4",
|
|
468
|
-
"contour-z5",
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
flserver.Case.Results.Graphics.delete_all_child_objects("Contour")
|
|
472
|
-
|
|
473
|
-
assert not flserver.Case.Results.Graphics.Contour.get_object_names()
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
477
|
-
def test_named_object_specific_methods(new_meshing_session):
|
|
478
|
-
meshing = new_meshing_session
|
|
479
|
-
meshing.workflow.InitializeWorkflow(WorkflowType="Watertight Geometry")
|
|
480
|
-
|
|
481
|
-
assert set(meshing.workflow.TaskObject.get_object_names()) == {
|
|
482
|
-
"Import Geometry",
|
|
483
|
-
"Add Local Sizing",
|
|
484
|
-
"Generate the Surface Mesh",
|
|
485
|
-
"Describe Geometry",
|
|
486
|
-
"Apply Share Topology",
|
|
487
|
-
"Enclose Fluid Regions (Capping)",
|
|
488
|
-
"Update Boundaries",
|
|
489
|
-
"Create Regions",
|
|
490
|
-
"Update Regions",
|
|
491
|
-
"Add Boundary Layers",
|
|
492
|
-
"Generate the Volume Mesh",
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
assert "xyz" not in meshing.workflow.TaskObject.get_object_names()
|
|
496
|
-
|
|
497
|
-
meshing.workflow.TaskObject["Import Geometry"].rename("xyz")
|
|
498
|
-
|
|
499
|
-
assert "xyz" in meshing.workflow.TaskObject.get_object_names()
|
|
500
|
-
|
|
501
|
-
meshing.workflow.delete_all_child_objects("TaskObject")
|
|
502
|
-
|
|
503
|
-
assert not meshing.workflow.TaskObject.get_object_names()
|
|
504
|
-
|
|
505
|
-
# test availability of different ways to get container state:
|
|
506
|
-
TaskObject = meshing.workflow.TaskObject
|
|
507
|
-
assert TaskObject.get_state() == TaskObject.getState() == TaskObject()
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
@pytest.mark.codegen_required
|
|
511
|
-
@pytest.mark.fluent_version(">=24.1")
|
|
512
|
-
def test_command_creation_inside_singleton(new_meshing_session):
|
|
513
|
-
meshing = new_meshing_session
|
|
514
|
-
read_mesh = meshing.meshing.File.ReadMesh.create_instance()
|
|
515
|
-
assert read_mesh.FileName is not None
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
@pytest.mark.codegen_required
|
|
519
|
-
def test_read_only_set_state(new_meshing_session):
|
|
520
|
-
meshing = new_meshing_session
|
|
521
|
-
meshing.preferences.MeshingWorkflow.SaveCheckpointFiles = True
|
|
522
|
-
assert meshing.preferences.MeshingWorkflow.CheckpointingOption.is_read_only()
|
|
523
|
-
with pytest.raises(ReadOnlyObjectError):
|
|
524
|
-
meshing.preferences.MeshingWorkflow.CheckpointingOption = "Write into memory"
|
|
525
|
-
|
|
526
|
-
assert "set_state" not in dir(
|
|
527
|
-
meshing.preferences.MeshingWorkflow.CheckpointingOption
|
|
528
|
-
)
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
test_rules = (
|
|
532
|
-
"RULES:\n"
|
|
533
|
-
" SINGLETON: ROOT\n"
|
|
534
|
-
" members = A\n"
|
|
535
|
-
" OBJECT: A\n"
|
|
536
|
-
" members = B, X\n"
|
|
537
|
-
" commands = C\n"
|
|
538
|
-
" isABC = $./X == ABC\n"
|
|
539
|
-
" OBJECT: B\n"
|
|
540
|
-
" END\n"
|
|
541
|
-
" STRING: X\n"
|
|
542
|
-
" default = IJK\n"
|
|
543
|
-
" END\n"
|
|
544
|
-
" COMMAND: C\n"
|
|
545
|
-
" returnType = Logical\n"
|
|
546
|
-
" functionName = S_C\n"
|
|
547
|
-
" isABC = $../X == ABC\n"
|
|
548
|
-
" END\n"
|
|
549
|
-
" END\n"
|
|
550
|
-
" END\n"
|
|
551
|
-
"END\n"
|
|
552
|
-
)
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
556
|
-
def test_on_child_created_lifetime(new_solver_session):
|
|
557
|
-
solver = new_solver_session
|
|
558
|
-
app_name = "test"
|
|
559
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
560
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
561
|
-
root.A["A1"] = {}
|
|
562
|
-
data = []
|
|
563
|
-
_ = root.A["A1"].add_on_child_created("B", lambda _: data.append(1))
|
|
564
|
-
root.A["A1"].add_on_child_created("B", lambda _: data.append(2))
|
|
565
|
-
gc.collect()
|
|
566
|
-
assert "/test/created/A:A1/B" in solver._se_service.subscriptions
|
|
567
|
-
assert "/test/created/A:A1/B-1" in solver._se_service.subscriptions
|
|
568
|
-
root.A["A1"].B["B1"] = {}
|
|
569
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
570
|
-
del root.A["A1"]
|
|
571
|
-
assert "/test/created/A:A1/B" not in solver._se_service.subscriptions
|
|
572
|
-
assert "/test/created/A:A1/B-1" not in solver._se_service.subscriptions
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
576
|
-
def test_on_deleted_lifetime(new_solver_session):
|
|
577
|
-
solver = new_solver_session
|
|
578
|
-
app_name = "test"
|
|
579
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
580
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
581
|
-
root.A["A1"] = {}
|
|
582
|
-
data = []
|
|
583
|
-
_ = root.A["A1"].add_on_deleted(lambda: data.append(1))
|
|
584
|
-
root.A["A1"].add_on_deleted(lambda: data.append(2))
|
|
585
|
-
gc.collect()
|
|
586
|
-
assert "/test/deleted/A:A1" in solver._se_service.subscriptions
|
|
587
|
-
assert "/test/deleted/A:A1-1" in solver._se_service.subscriptions
|
|
588
|
-
del root.A["A1"]
|
|
589
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
590
|
-
assert timeout_loop(
|
|
591
|
-
lambda: "/test/deleted/A:A1" not in solver._se_service.subscriptions, 5
|
|
592
|
-
)
|
|
593
|
-
assert timeout_loop(
|
|
594
|
-
lambda: "/test/deleted/A:A1-1" not in solver._se_service.subscriptions, 5
|
|
595
|
-
)
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
599
|
-
def test_on_changed_lifetime(new_solver_session):
|
|
600
|
-
solver = new_solver_session
|
|
601
|
-
app_name = "test"
|
|
602
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
603
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
604
|
-
root.A["A1"] = {}
|
|
605
|
-
data = []
|
|
606
|
-
_ = root.A["A1"].X.add_on_changed(lambda _: data.append(1))
|
|
607
|
-
root.A["A1"].X.add_on_changed(lambda _: data.append(2))
|
|
608
|
-
gc.collect()
|
|
609
|
-
assert "/test/modified/A:A1/X" in solver._se_service.subscriptions
|
|
610
|
-
assert "/test/modified/A:A1/X-1" in solver._se_service.subscriptions
|
|
611
|
-
root.A["A1"].X = "ABC"
|
|
612
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
613
|
-
del root.A["A1"]
|
|
614
|
-
assert "/test/modified/A:A1/X" not in solver._se_service.subscriptions
|
|
615
|
-
assert "/test/modified/A:A1/X-1" not in solver._se_service.subscriptions
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
619
|
-
def test_on_affected_lifetime(new_solver_session):
|
|
620
|
-
solver = new_solver_session
|
|
621
|
-
app_name = "test"
|
|
622
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
623
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
624
|
-
root.A["A1"] = {}
|
|
625
|
-
data = []
|
|
626
|
-
_ = root.A["A1"].add_on_affected(lambda _: data.append(1))
|
|
627
|
-
root.A["A1"].add_on_affected(lambda _: data.append(2))
|
|
628
|
-
gc.collect()
|
|
629
|
-
assert "/test/affected/A:A1" in solver._se_service.subscriptions
|
|
630
|
-
assert "/test/affected/A:A1-1" in solver._se_service.subscriptions
|
|
631
|
-
root.A["A1"].X = "ABC"
|
|
632
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
633
|
-
del root.A["A1"]
|
|
634
|
-
assert "/test/affected/A:A1" not in solver._se_service.subscriptions
|
|
635
|
-
assert "/test/affected/A:A1-1" not in solver._se_service.subscriptions
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
639
|
-
def test_on_affected_at_type_path_lifetime(new_solver_session):
|
|
640
|
-
solver = new_solver_session
|
|
641
|
-
app_name = "test"
|
|
642
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
643
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
644
|
-
root.A["A1"] = {}
|
|
645
|
-
data = []
|
|
646
|
-
_ = root.A["A1"].add_on_affected_at_type_path("B", lambda _: data.append(1))
|
|
647
|
-
root.A["A1"].add_on_affected_at_type_path("B", lambda _: data.append(2))
|
|
648
|
-
gc.collect()
|
|
649
|
-
assert "/test/affected/A:A1/B" in solver._se_service.subscriptions
|
|
650
|
-
assert "/test/affected/A:A1/B-1" in solver._se_service.subscriptions
|
|
651
|
-
root.A["A1"].B["B1"] = {}
|
|
652
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
653
|
-
del root.A["A1"]
|
|
654
|
-
assert "/test/affected/A:A1/B" not in solver._se_service.subscriptions
|
|
655
|
-
assert "/test/affected/A:A1/B-1" not in solver._se_service.subscriptions
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
659
|
-
def test_on_command_executed_lifetime(new_solver_session):
|
|
660
|
-
solver = new_solver_session
|
|
661
|
-
app_name = "test"
|
|
662
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
663
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
664
|
-
root.A["A1"] = {}
|
|
665
|
-
data = []
|
|
666
|
-
version = solver.get_fluent_version()
|
|
667
|
-
if version < FluentVersion.v252:
|
|
668
|
-
_ = root.A["A1"].add_on_command_executed_old("C", lambda *args: data.append(1))
|
|
669
|
-
root.A["A1"].add_on_command_executed_old("C", lambda *args: data.append(2))
|
|
670
|
-
tags = ["/test/command_executed/A:A1/C", "/test/command_executed/A:A1/C-1"]
|
|
671
|
-
else:
|
|
672
|
-
_ = root.A["A1"].add_on_command_executed(lambda *args: data.append(1))
|
|
673
|
-
root.A["A1"].add_on_command_executed(lambda *args: data.append(2))
|
|
674
|
-
# TODO: path should be appended to the tag
|
|
675
|
-
tags = ["/test/command_executed", "/test/command_executed-1"]
|
|
676
|
-
gc.collect()
|
|
677
|
-
for tag in tags:
|
|
678
|
-
assert tag in solver._se_service.subscriptions
|
|
679
|
-
root.A["A1"].C()
|
|
680
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
681
|
-
del root.A["A1"]
|
|
682
|
-
for tag in tags:
|
|
683
|
-
assert tag not in solver._se_service.subscriptions
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
687
|
-
def test_on_attribute_changed_lifetime(new_solver_session):
|
|
688
|
-
solver = new_solver_session
|
|
689
|
-
app_name = "test"
|
|
690
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
691
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
692
|
-
root.A["A1"] = {}
|
|
693
|
-
data = []
|
|
694
|
-
_ = root.A["A1"].add_on_attribute_changed("isABC", lambda _: data.append(1))
|
|
695
|
-
root.A["A1"].add_on_attribute_changed("isABC", lambda _: data.append(2))
|
|
696
|
-
gc.collect()
|
|
697
|
-
assert "/test/attribute_changed/A:A1/isABC" in solver._se_service.subscriptions
|
|
698
|
-
assert "/test/attribute_changed/A:A1/isABC-1" in solver._se_service.subscriptions
|
|
699
|
-
root.A["A1"].X = "ABC"
|
|
700
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
701
|
-
del root.A["A1"]
|
|
702
|
-
assert "/test/attribute_changed/A:A1/isABC" not in solver._se_service.subscriptions
|
|
703
|
-
assert (
|
|
704
|
-
"/test/attribute_changed/A:A1/isABC-1" not in solver._se_service.subscriptions
|
|
705
|
-
)
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
709
|
-
def test_on_command_attribute_changed_lifetime(new_solver_session):
|
|
710
|
-
solver = new_solver_session
|
|
711
|
-
app_name = "test"
|
|
712
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
713
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
714
|
-
root.A["A1"] = {}
|
|
715
|
-
data = []
|
|
716
|
-
_ = root.A["A1"].add_on_command_attribute_changed(
|
|
717
|
-
"C", "isABC", lambda _: data.append(1)
|
|
718
|
-
)
|
|
719
|
-
root.A["A1"].add_on_command_attribute_changed(
|
|
720
|
-
"C", "isABC", lambda _: data.append(2)
|
|
721
|
-
)
|
|
722
|
-
gc.collect()
|
|
723
|
-
assert (
|
|
724
|
-
"/test/command_attribute_changed/A:A1/C/isABC"
|
|
725
|
-
in solver._se_service.subscriptions
|
|
726
|
-
)
|
|
727
|
-
assert (
|
|
728
|
-
"/test/command_attribute_changed/A:A1/C/isABC-1"
|
|
729
|
-
in solver._se_service.subscriptions
|
|
730
|
-
)
|
|
731
|
-
root.A["A1"].X = "ABC"
|
|
732
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
733
|
-
del root.A["A1"]
|
|
734
|
-
assert (
|
|
735
|
-
"/test/command_attribute_changed/A:A1/C/isABC"
|
|
736
|
-
not in solver._se_service.subscriptions
|
|
737
|
-
)
|
|
738
|
-
assert (
|
|
739
|
-
"/test/command_attribute_changed/A:A1/C/isABC-1"
|
|
740
|
-
not in solver._se_service.subscriptions
|
|
741
|
-
)
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
745
|
-
def test_on_affected_lifetime_with_delete_child_objects(new_solver_session):
|
|
746
|
-
solver = new_solver_session
|
|
747
|
-
app_name = "test"
|
|
748
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
749
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
750
|
-
pyfluent.logging.enable()
|
|
751
|
-
root.A["A1"] = {}
|
|
752
|
-
data = []
|
|
753
|
-
_ = root.A["A1"].add_on_affected(lambda _: data.append(1))
|
|
754
|
-
root.A["A1"].add_on_affected(lambda _: data.append(2))
|
|
755
|
-
gc.collect()
|
|
756
|
-
assert "/test/affected/A:A1" in solver._se_service.subscriptions
|
|
757
|
-
assert "/test/affected/A:A1-1" in solver._se_service.subscriptions
|
|
758
|
-
root.A["A1"].X = "ABC"
|
|
759
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
760
|
-
root.delete_child_objects("A", ["A1"])
|
|
761
|
-
assert "/test/affected/A:A1" not in solver._se_service.subscriptions
|
|
762
|
-
assert "/test/affected/A:A1-1" not in solver._se_service.subscriptions
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
@pytest.mark.fluent_version(">=24.2")
|
|
766
|
-
def test_on_affected_lifetime_with_delete_all_child_objects(new_solver_session):
|
|
767
|
-
solver = new_solver_session
|
|
768
|
-
app_name = "test"
|
|
769
|
-
create_datamodel_root_in_server(solver, test_rules, app_name)
|
|
770
|
-
root = create_root_using_datamodelgen(solver._se_service, app_name)
|
|
771
|
-
pyfluent.logging.enable()
|
|
772
|
-
root.A["A1"] = {}
|
|
773
|
-
data = []
|
|
774
|
-
_ = root.A["A1"].add_on_affected(lambda _: data.append(1))
|
|
775
|
-
root.A["A1"].add_on_affected(lambda _: data.append(2))
|
|
776
|
-
gc.collect()
|
|
777
|
-
assert "/test/affected/A:A1" in solver._se_service.subscriptions
|
|
778
|
-
assert "/test/affected/A:A1-1" in solver._se_service.subscriptions
|
|
779
|
-
root.A["A1"].X = "ABC"
|
|
780
|
-
assert timeout_loop(lambda: data == [1, 2], 5)
|
|
781
|
-
root.delete_all_child_objects("A")
|
|
782
|
-
assert "/test/affected/A:A1" not in solver._se_service.subscriptions
|
|
783
|
-
assert "/test/affected/A:A1-1" not in solver._se_service.subscriptions
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
@pytest.mark.fluent_version(">=23.2")
|
|
787
|
-
def test_set_command_args_and_sub_args(new_meshing_session):
|
|
788
|
-
meshing = new_meshing_session
|
|
789
|
-
ig = meshing.meshing.ImportGeometry.create_instance()
|
|
790
|
-
|
|
791
|
-
# Command Arguments
|
|
792
|
-
assert ig.MeshUnit() == "m"
|
|
793
|
-
ig.MeshUnit = "mm"
|
|
794
|
-
assert ig.MeshUnit() == "mm"
|
|
795
|
-
|
|
796
|
-
# Command Arguments SubItem
|
|
797
|
-
assert ig.CadImportOptions.OneZonePer() == "body"
|
|
798
|
-
ig.CadImportOptions.OneZonePer = "face"
|
|
799
|
-
assert ig.CadImportOptions.OneZonePer() == "face"
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
@pytest.mark.fluent_version(">=24.1")
|
|
803
|
-
def test_dynamic_dependency(new_meshing_session):
|
|
804
|
-
meshing = new_meshing_session
|
|
805
|
-
ic = meshing.meshing.LoadCADGeometry.create_instance()
|
|
806
|
-
|
|
807
|
-
d = ic.Refaceting.Deviation.get_state()
|
|
808
|
-
cd = ic.Refaceting.CustomDeviation.get_state()
|
|
809
|
-
assert d == cd
|
|
810
|
-
|
|
811
|
-
ic.Refaceting.Deviation.set_state(1.2)
|
|
812
|
-
d = ic.Refaceting.Deviation.get_state()
|
|
813
|
-
cd = ic.Refaceting.CustomDeviation.get_state()
|
|
814
|
-
assert d == cd
|