ansys-fluent-core 0.27.dev1__py3-none-any.whl → 0.28.dev0__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 +22 -9
- ansys/fluent/core/_version.py +5 -2
- ansys/fluent/core/codegen/__init__.py +0 -3
- ansys/fluent/core/codegen/allapigen.py +1 -5
- ansys/fluent/core/codegen/builtin_settingsgen.py +44 -10
- ansys/fluent/core/codegen/datamodelgen.py +53 -12
- ansys/fluent/core/codegen/settingsgen.py +21 -12
- ansys/fluent/core/codegen/settingsgen_old.py +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/write_settings_yaml.py +3 -4
- ansys/fluent/core/data_model_cache.py +132 -70
- ansys/fluent/core/docs/README.rst +2 -2
- ansys/fluent/core/examples/downloads.py +3 -5
- ansys/fluent/core/exceptions.py +1 -0
- ansys/fluent/core/file_session.py +59 -131
- ansys/fluent/core/filereader/case_file.py +17 -17
- ansys/fluent/core/filereader/casereader.py +2 -1
- ansys/fluent/core/filereader/data_file.py +7 -7
- ansys/fluent/core/filereader/lispy.py +6 -1
- ansys/fluent/core/fluent_connection.py +35 -7
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_222/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_222/PartManagement.py +28 -28
- ansys/fluent/core/generated/datamodel_222/meshing.py +301 -301
- ansys/fluent/core/generated/datamodel_222/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_231/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_231/PartManagement.py +55 -55
- ansys/fluent/core/generated/datamodel_231/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_231/meshing.py +317 -317
- ansys/fluent/core/generated/datamodel_231/solverworkflow.py +51 -51
- ansys/fluent/core/generated/datamodel_231/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_232/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_232/PartManagement.py +55 -55
- ansys/fluent/core/generated/datamodel_232/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_232/meshing.py +335 -335
- ansys/fluent/core/generated/datamodel_232/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_232/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_241/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_241/PartManagement.py +57 -57
- ansys/fluent/core/generated/datamodel_241/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_241/meshing.py +361 -361
- ansys/fluent/core/generated/datamodel_241/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_241/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_242/MeshingUtilities.py +240 -240
- ansys/fluent/core/generated/datamodel_242/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_242/PartManagement.py +60 -60
- ansys/fluent/core/generated/datamodel_242/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_242/meshing.py +371 -371
- ansys/fluent/core/generated/datamodel_242/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_242/workflow.py +9 -9
- ansys/fluent/core/generated/datamodel_251/MeshingUtilities.py +244 -244
- ansys/fluent/core/generated/datamodel_251/PMFileManagement.py +2 -2
- ansys/fluent/core/generated/datamodel_251/PartManagement.py +60 -60
- ansys/fluent/core/generated/datamodel_251/flicing.py +51 -51
- ansys/fluent/core/generated/datamodel_251/meshing.py +384 -382
- ansys/fluent/core/generated/datamodel_251/preferences.py +7 -0
- ansys/fluent/core/generated/datamodel_251/solverworkflow.py +58 -58
- ansys/fluent/core/generated/datamodel_251/workflow.py +10 -10
- ansys/fluent/core/generated/datamodel_252/MeshingUtilities.py +3664 -0
- ansys/fluent/core/generated/datamodel_252/PMFileManagement.py +288 -0
- ansys/fluent/core/generated/datamodel_252/PartManagement.py +2588 -0
- ansys/fluent/core/generated/datamodel_252/flicing.py +7972 -0
- ansys/fluent/core/generated/datamodel_252/meshing.py +2644 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +2760 -0
- ansys/fluent/core/generated/datamodel_252/solverworkflow.py +479 -0
- ansys/fluent/core/generated/datamodel_252/workflow.py +466 -0
- ansys/fluent/core/generated/fluent_version_251.py +4 -4
- ansys/fluent/core/generated/fluent_version_252.py +5 -0
- ansys/fluent/core/generated/meshing/tui_251.py +1139 -1179
- ansys/fluent/core/generated/meshing/tui_252.py +10181 -0
- ansys/fluent/core/generated/solver/settings_222.py +3 -3
- ansys/fluent/core/generated/solver/settings_231.py +4 -4
- ansys/fluent/core/generated/solver/settings_232.py +5 -5
- ansys/fluent/core/generated/solver/settings_241.py +5 -5
- ansys/fluent/core/generated/solver/settings_242.py +1185 -1185
- ansys/fluent/core/generated/solver/settings_251.py +1847 -1652
- ansys/fluent/core/generated/solver/settings_251.pyi +237 -211
- ansys/fluent/core/generated/solver/settings_252.py +90369 -0
- ansys/fluent/core/generated/solver/settings_252.pyi +63778 -0
- ansys/fluent/core/generated/solver/settings_builtin.py +612 -1
- ansys/fluent/core/generated/solver/settings_builtin.pyi +235 -0
- ansys/fluent/core/generated/solver/tui_251.py +2283 -2103
- ansys/fluent/core/generated/solver/tui_252.py +37720 -0
- ansys/fluent/core/journaling.py +1 -1
- ansys/fluent/core/launcher/error_handler.py +3 -0
- ansys/fluent/core/launcher/fluent_container.py +5 -0
- ansys/fluent/core/launcher/launcher.py +1 -2
- ansys/fluent/core/launcher/launcher_utils.py +17 -6
- ansys/fluent/core/launcher/process_launch_string.py +3 -3
- ansys/fluent/core/launcher/pyfluent_enums.py +1 -1
- ansys/fluent/core/launcher/slurm_launcher.py +2 -1
- ansys/fluent/core/launcher/standalone_launcher.py +11 -5
- ansys/fluent/core/launcher/watchdog.py +1 -1
- ansys/fluent/core/launcher/watchdog_exec +6 -3
- ansys/fluent/core/logging.py +1 -5
- ansys/fluent/core/parametric.py +6 -3
- ansys/fluent/core/post_objects/meta.py +1 -39
- ansys/fluent/core/post_objects/post_helper.py +4 -3
- ansys/fluent/core/post_objects/post_object_definitions.py +12 -7
- ansys/fluent/core/post_objects/post_objects_container.py +39 -2
- ansys/fluent/core/rpvars.py +2 -1
- ansys/fluent/core/scheduler/machine_list.py +3 -1
- ansys/fluent/core/search.py +109 -262
- ansys/fluent/core/services/__init__.py +3 -0
- ansys/fluent/core/services/api_upgrade.py +1 -0
- ansys/fluent/core/services/batch_ops.py +3 -1
- ansys/fluent/core/services/datamodel_se.py +37 -30
- ansys/fluent/core/services/datamodel_tui.py +8 -3
- ansys/fluent/core/services/deprecated_field_data.py +691 -0
- ansys/fluent/core/services/field_data.py +67 -357
- ansys/fluent/core/services/interceptors.py +6 -4
- ansys/fluent/core/services/reduction.py +1 -2
- ansys/fluent/core/services/scheme_eval.py +2 -3
- ansys/fluent/core/services/solution_variables.py +46 -48
- ansys/fluent/core/session.py +6 -4
- ansys/fluent/core/session_meshing.pyi +5 -0
- ansys/fluent/core/session_pure_meshing.pyi +4 -1
- ansys/fluent/core/session_solver_lite.py +2 -1
- ansys/fluent/core/solver/flobject.py +179 -207
- ansys/fluent/core/solver/flunits.py +65 -56
- ansys/fluent/core/solver/function/reduction.py +9 -29
- ansys/fluent/core/solver/settings_builtin_bases.py +28 -22
- ansys/fluent/core/solver/settings_builtin_data.py +105 -1
- ansys/fluent/core/solver/settings_external.py +0 -28
- ansys/fluent/core/streaming_services/field_data_streaming.py +1 -0
- ansys/fluent/core/streaming_services/monitor_streaming.py +0 -1
- ansys/fluent/core/systemcoupling.py +145 -14
- ansys/fluent/core/utils/__init__.py +18 -2
- ansys/fluent/core/utils/dump_session_data.py +7 -4
- ansys/fluent/core/utils/execution.py +2 -2
- ansys/fluent/core/utils/file_transfer_service.py +37 -42
- ansys/fluent/core/utils/fluent_version.py +20 -2
- ansys/fluent/core/utils/networking.py +39 -1
- ansys/fluent/core/workflow.py +3 -15
- ansys/fluent/tests/conftest.py +89 -7
- ansys/fluent/tests/fluent/test_version/test.py +2 -0
- ansys/fluent/tests/fluent_fixtures.py +195 -0
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +7 -7
- ansys/fluent/tests/parametric/test_parametric_workflow.py +14 -4
- ansys/fluent/tests/test_builtin_settings.py +28 -0
- ansys/fluent/tests/test_cad_to_post_ftm.py +1 -3
- ansys/fluent/tests/test_cad_to_post_wtm.py +1 -1
- ansys/fluent/tests/test_casereader.py +1 -1
- ansys/fluent/tests/test_codegen.py +116 -6
- ansys/fluent/tests/test_data_model_cache.py +1 -1
- ansys/fluent/tests/test_datamodel_service.py +14 -19
- ansys/fluent/tests/test_field_data.py +93 -45
- ansys/fluent/tests/test_file_session.py +32 -29
- ansys/fluent/tests/test_flobject.py +16 -58
- ansys/fluent/tests/test_fluent_fixes.py +5 -5
- ansys/fluent/tests/test_fluent_session.py +11 -8
- ansys/fluent/tests/test_fluent_version.py +1 -1
- ansys/fluent/tests/test_launcher.py +22 -5
- ansys/fluent/tests/test_launcher_remote.py +80 -4
- ansys/fluent/tests/test_meshing_utilities.py +93 -44
- ansys/fluent/tests/test_meshing_workflow.py +6 -6
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +1 -1
- ansys/fluent/tests/test_new_meshing_workflow.py +42 -3
- ansys/fluent/tests/test_preferences.py +6 -6
- ansys/fluent/tests/test_reduction.py +61 -30
- ansys/fluent/tests/test_rp_vars.py +1 -1
- ansys/fluent/tests/test_search.py +53 -200
- ansys/fluent/tests/test_session.py +18 -13
- ansys/fluent/tests/test_settings_api.py +93 -29
- ansys/fluent/tests/test_settings_reader.py +1 -1
- ansys/fluent/tests/test_solver_monitors.py +1 -1
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +4 -4
- ansys/fluent/tests/test_solvermode/test_controls.py +3 -3
- ansys/fluent/tests/test_solvermode/test_methods.py +1 -1
- ansys/fluent/tests/test_solvermode/test_models.py +3 -3
- ansys/fluent/tests/test_systemcoupling.py +33 -5
- ansys/fluent/tests/test_topy.py +2 -2
- ansys/fluent/tests/test_tui_api.py +5 -5
- ansys/fluent/tests/test_utils.py +1 -1
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/METADATA +6 -17
- ansys_fluent_core-0.28.dev0.dist-info/RECORD +291 -0
- ansys/fluent/core/generated/api_tree_222.pickle +0 -0
- ansys/fluent/core/generated/api_tree_231.pickle +0 -0
- ansys/fluent/core/generated/api_tree_232.pickle +0 -0
- ansys/fluent/core/generated/api_tree_241.pickle +0 -0
- ansys/fluent/core/generated/api_tree_242.pickle +0 -0
- ansys/fluent/core/generated/api_tree_251.pickle +0 -0
- ansys/fluent/tests/test_tests_util.py +0 -47
- ansys/fluent/tests/util/__init__.py +0 -38
- ansys_fluent_core-0.27.dev1.dist-info/RECORD +0 -283
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/AUTHORS +0 -0
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/LICENSE +0 -0
- {ansys_fluent_core-0.27.dev1.dist-info → ansys_fluent_core-0.28.dev0.dist-info}/WHEEL +0 -0
ansys/fluent/core/search.py
CHANGED
|
@@ -8,25 +8,17 @@ import os
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
import pickle
|
|
10
10
|
import re
|
|
11
|
-
import sys
|
|
12
|
-
from typing import Any
|
|
13
11
|
import warnings
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
import ansys.fluent.core as pyfluent
|
|
16
14
|
from ansys.fluent.core.solver.error_message import closest_allowed_names
|
|
17
15
|
from ansys.fluent.core.utils.fluent_version import (
|
|
18
16
|
FluentVersion,
|
|
19
17
|
get_version_for_file_name,
|
|
20
18
|
)
|
|
21
|
-
from ansys.fluent.core.workflow import (
|
|
22
|
-
BaseTask,
|
|
23
|
-
ClassicWorkflow,
|
|
24
|
-
TaskContainer,
|
|
25
|
-
Workflow,
|
|
26
|
-
)
|
|
27
19
|
|
|
28
20
|
|
|
29
|
-
def
|
|
21
|
+
def _get_api_tree_data_file_path():
|
|
30
22
|
"""Get API tree data file."""
|
|
31
23
|
from ansys.fluent.core import CODEGEN_OUTDIR
|
|
32
24
|
|
|
@@ -62,142 +54,24 @@ def _remove_suffix(input: str, suffix):
|
|
|
62
54
|
_meshing_rules = ["workflow", "meshing", "PartManagement", "PMFileManagement"]
|
|
63
55
|
|
|
64
56
|
|
|
65
|
-
def
|
|
66
|
-
from ansys.fluent.core.services.datamodel_se import PyMenu, PyNamedObjectContainer
|
|
67
|
-
from ansys.fluent.core.services.datamodel_tui import TUIMenu
|
|
68
|
-
from ansys.fluent.core.session_pure_meshing import PureMeshing
|
|
69
|
-
from ansys.fluent.core.session_solver import Solver
|
|
70
|
-
|
|
71
|
-
path = None
|
|
72
|
-
version = None
|
|
73
|
-
prefix = None
|
|
74
|
-
if isinstance(obj, PureMeshing):
|
|
75
|
-
path = ["<meshing_session>"]
|
|
76
|
-
version = get_version_for_file_name(obj.get_fluent_version().value)
|
|
77
|
-
prefix = "<search_root>"
|
|
78
|
-
elif isinstance(obj, Solver):
|
|
79
|
-
path = ["<solver_session>"]
|
|
80
|
-
version = get_version_for_file_name(obj.get_fluent_version().value)
|
|
81
|
-
prefix = "<search_root>"
|
|
82
|
-
elif isinstance(obj, TUIMenu):
|
|
83
|
-
module = obj.__class__.__module__
|
|
84
|
-
path = [
|
|
85
|
-
(
|
|
86
|
-
"<meshing_session>"
|
|
87
|
-
if module.startswith("meshing")
|
|
88
|
-
else "<solver_session>"
|
|
89
|
-
),
|
|
90
|
-
"tui",
|
|
91
|
-
]
|
|
92
|
-
path.extend(obj._path)
|
|
93
|
-
version = module.rsplit("_", 1)[-1]
|
|
94
|
-
prefix = "<search_root>"
|
|
95
|
-
elif isinstance(obj, (ClassicWorkflow, Workflow)):
|
|
96
|
-
path = ["<meshing_session>", obj.rules]
|
|
97
|
-
module = obj._workflow.__class__.__module__
|
|
98
|
-
version = module.rsplit("_", 1)[-1]
|
|
99
|
-
prefix = "<search_root>"
|
|
100
|
-
elif isinstance(obj, BaseTask):
|
|
101
|
-
path = ["<meshing_session>", obj.rules]
|
|
102
|
-
path.extend([f"{k[0]}:<name>" if k[1] else k[0] for k in obj.path])
|
|
103
|
-
module = obj._workflow.__class__.__module__
|
|
104
|
-
version = module.rsplit("_", 1)[-1]
|
|
105
|
-
prefix = "<search_root>"
|
|
106
|
-
elif isinstance(obj, TaskContainer):
|
|
107
|
-
path = ["<meshing_session>", obj.rules]
|
|
108
|
-
path.extend([f"{k[0]}:<name>" if k[1] else k[0] for k in obj.path])
|
|
109
|
-
path[-1] = f"{path[-1]}:<name>"
|
|
110
|
-
module = obj._container._workflow.__class__.__module__
|
|
111
|
-
version = module.rsplit("_", 1)[-1]
|
|
112
|
-
prefix = '<search_root>["<name>"]'
|
|
113
|
-
elif isinstance(obj, PyMenu):
|
|
114
|
-
rules = obj.rules
|
|
115
|
-
path = ["<meshing_session>" if rules in _meshing_rules else "<solver_session>"]
|
|
116
|
-
path.append(rules)
|
|
117
|
-
path.extend([f"{k[0]}:<name>" if k[1] else k[0] for k in obj.path])
|
|
118
|
-
module = obj.__class__.__module__
|
|
119
|
-
version = module.rsplit("_", 1)[-1]
|
|
120
|
-
prefix = "<search_root>"
|
|
121
|
-
elif isinstance(obj, PyNamedObjectContainer):
|
|
122
|
-
rules = obj.rules
|
|
123
|
-
path = ["<meshing_session>" if rules in _meshing_rules else "<solver_session>"]
|
|
124
|
-
path.append(rules)
|
|
125
|
-
path.extend([f"{k[0]}:<name>" if k[1] else k[0] for k in obj.path])
|
|
126
|
-
path[-1] = f"{path[-1]}:<name>"
|
|
127
|
-
module = obj.__class__.__module__
|
|
128
|
-
version = module.rsplit("_", 1)[-1]
|
|
129
|
-
prefix = '<search_root>["<name>"]'
|
|
130
|
-
elif isinstance(obj, flobject.Group):
|
|
131
|
-
module = obj.__class__.__module__
|
|
132
|
-
version = module.rsplit("_", 1)[-1]
|
|
133
|
-
prefix = "<search_root>"
|
|
134
|
-
path = ["<solver_session>"]
|
|
135
|
-
# Cannot deduce the whole path without api_tree
|
|
136
|
-
elif isinstance(obj, flobject.NamedObject):
|
|
137
|
-
module = obj.__class__.__module__
|
|
138
|
-
version = module.rsplit("_", 1)[-1]
|
|
139
|
-
prefix = '<search_root>["<name>"]'
|
|
140
|
-
path = ["<solver_session>"]
|
|
141
|
-
# Cannot deduce the whole path without api_tree
|
|
142
|
-
return version, path, prefix
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
def _search(
|
|
146
|
-
word: str,
|
|
147
|
-
match_whole_word: bool = False,
|
|
148
|
-
match_case: bool = False,
|
|
57
|
+
def _generate_api_data(
|
|
149
58
|
version: str | None = None,
|
|
150
|
-
search_root: Any | None = None,
|
|
151
|
-
write_api_tree_data: bool | None = False,
|
|
152
59
|
):
|
|
153
|
-
"""
|
|
60
|
+
"""Generate API tree data.
|
|
154
61
|
|
|
155
62
|
Parameters
|
|
156
63
|
----------
|
|
157
|
-
word : str
|
|
158
|
-
Word to search for.
|
|
159
|
-
match_whole_word : bool, optional
|
|
160
|
-
Whether to match whole word, by default False
|
|
161
|
-
match_case : bool, optional
|
|
162
|
-
Whether to match case, by default False
|
|
163
64
|
version : str, optional
|
|
164
65
|
Fluent version to search in. The default is ``None``. If ``None``,
|
|
165
66
|
it searches in the latest version for which codegen was run.
|
|
166
|
-
search_root : Any, optional
|
|
167
|
-
The root object within which the search is performed.
|
|
168
|
-
It can be a session object or any API object within a session.
|
|
169
|
-
The default is ``None``. If ``None``, it searches everything.
|
|
170
67
|
write_api_tree_data: bool, optional
|
|
171
68
|
Whether to write the API tree data.
|
|
172
|
-
|
|
173
|
-
Examples
|
|
174
|
-
--------
|
|
175
|
-
>>> import ansys.fluent.core as pyfluent
|
|
176
|
-
>>> pyfluent.search("geometry")
|
|
177
|
-
<meshing_session>.tui.file.import_.cad_geometry (Command)
|
|
178
|
-
<meshing_session>.tui.display.update_scene.select_geometry (Command)
|
|
179
|
-
<meshing_session>.meshing.ImportGeometry (Command)
|
|
180
|
-
<meshing_session>.meshing.LoadCADGeometry (Command)
|
|
181
|
-
<solver_session>.tui.solve.initialize.compute_defaults.geometry (Command)
|
|
182
|
-
<solver_session>.tui.report.reference_values.compute.geometry (Command)
|
|
183
|
-
<solver_session>.tui.define.geometry (Command)
|
|
184
|
-
<solver_session>.tui.mesh.geometry (Object)
|
|
185
|
-
<solver_session>.setup.boundary_conditions.geometry["<name>"] (Object)
|
|
186
|
-
<solver_session>.setup.geometry (Object)
|
|
187
|
-
<solver_session>.solution.report_definitions.surface["<name>"].geometry (Parameter)
|
|
188
|
-
<solver_session>.solution.report_definitions.volume["<name>"].geometry (Parameter)
|
|
189
|
-
<solver_session>.results.graphics.mesh["<name>"].geometry (Parameter)
|
|
190
|
-
<solver_session>.results.graphics.contour["<name>"].geometry (Parameter)
|
|
191
69
|
"""
|
|
192
|
-
api_objects =
|
|
193
|
-
api_tui_objects =
|
|
194
|
-
api_object_names =
|
|
195
|
-
results = []
|
|
70
|
+
api_objects = set()
|
|
71
|
+
api_tui_objects = set()
|
|
72
|
+
api_object_names = set()
|
|
196
73
|
if version:
|
|
197
74
|
version = get_version_for_file_name(version)
|
|
198
|
-
root_version, root_path, prefix = _get_version_path_prefix_from_obj(search_root)
|
|
199
|
-
if search_root and not prefix:
|
|
200
|
-
return
|
|
201
75
|
if not version:
|
|
202
76
|
for fluent_version in FluentVersion:
|
|
203
77
|
version = get_version_for_file_name(fluent_version.value)
|
|
@@ -207,35 +81,7 @@ def _search(
|
|
|
207
81
|
with open(api_tree_file, "rb") as f:
|
|
208
82
|
api_tree = pickle.load(f)
|
|
209
83
|
|
|
210
|
-
|
|
211
|
-
path = root_path + [
|
|
212
|
-
flobject.to_python_name(x) for x in search_root.path.split("/")
|
|
213
|
-
]
|
|
214
|
-
root_path = []
|
|
215
|
-
tree = api_tree
|
|
216
|
-
while path:
|
|
217
|
-
p = path.pop(0)
|
|
218
|
-
if p in tree:
|
|
219
|
-
tree = tree[p]
|
|
220
|
-
root_path.append(p)
|
|
221
|
-
elif f"{p}:<name>" in tree:
|
|
222
|
-
tree = tree[f"{p}:<name>"]
|
|
223
|
-
root_path.append(f"{p}:<name>")
|
|
224
|
-
if path:
|
|
225
|
-
path.pop(0)
|
|
226
|
-
else:
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
def inner(tree, path, root_path):
|
|
230
|
-
if root_path:
|
|
231
|
-
path = prefix
|
|
232
|
-
while root_path:
|
|
233
|
-
p = root_path.pop(0)
|
|
234
|
-
if p in tree:
|
|
235
|
-
tree = tree[p]
|
|
236
|
-
else:
|
|
237
|
-
return
|
|
238
|
-
|
|
84
|
+
def inner(tree, path):
|
|
239
85
|
for k, v in tree.items():
|
|
240
86
|
if k in ("<meshing_session>", "<solver_session>"):
|
|
241
87
|
next_path = k
|
|
@@ -249,21 +95,20 @@ def _search(
|
|
|
249
95
|
else:
|
|
250
96
|
next_path = f"{path}.{k}"
|
|
251
97
|
type_ = "Object" if isinstance(v, Mapping) else v
|
|
252
|
-
api_object_names.
|
|
98
|
+
api_object_names.add(k)
|
|
253
99
|
if "tui" in next_path:
|
|
254
|
-
api_tui_objects.
|
|
100
|
+
api_tui_objects.add(f"{next_path} ({type_})")
|
|
255
101
|
else:
|
|
256
|
-
api_objects.
|
|
257
|
-
if _match(k, word, match_whole_word, match_case):
|
|
258
|
-
results.append(f"{next_path} ({type_})")
|
|
102
|
+
api_objects.add(f"{next_path} ({type_})")
|
|
259
103
|
if isinstance(v, Mapping):
|
|
260
|
-
inner(v, next_path
|
|
104
|
+
inner(v, next_path)
|
|
261
105
|
|
|
262
|
-
inner(api_tree, ""
|
|
106
|
+
inner(api_tree, "")
|
|
263
107
|
|
|
264
108
|
api_tree_data = dict()
|
|
265
|
-
api_tree_data["api_objects"] = sorted(api_objects)
|
|
266
|
-
api_tree_data["api_tui_objects"] = sorted(api_tui_objects)
|
|
109
|
+
api_tree_data["api_objects"] = sorted(list(api_objects))
|
|
110
|
+
api_tree_data["api_tui_objects"] = sorted(list(api_tui_objects))
|
|
111
|
+
api_tree_data["all_api_object_names"] = sorted(list(api_object_names))
|
|
267
112
|
|
|
268
113
|
def _write_api_tree_file(api_tree_data: dict, api_object_names: list):
|
|
269
114
|
from nltk.corpus import wordnet as wn
|
|
@@ -276,35 +121,31 @@ def _search(
|
|
|
276
121
|
|
|
277
122
|
all_api_object_name_synsets = dict()
|
|
278
123
|
for name in api_object_names:
|
|
279
|
-
api_object_name_synsets = (
|
|
280
|
-
|
|
281
|
-
if sys.version_info[0] < 3
|
|
282
|
-
else wn.synsets(name, lang="eng")
|
|
283
|
-
)
|
|
284
|
-
synset_names = []
|
|
124
|
+
api_object_name_synsets = wn.synsets(name, lang="eng")
|
|
125
|
+
synset_names = set()
|
|
285
126
|
for api_object_name_synset in api_object_name_synsets:
|
|
286
|
-
synset_names.
|
|
287
|
-
|
|
127
|
+
synset_names.add(api_object_name_synset.name())
|
|
128
|
+
if synset_names:
|
|
129
|
+
all_api_object_name_synsets[name] = sorted(list(synset_names))
|
|
288
130
|
api_tree_data["all_api_object_name_synsets"] = all_api_object_name_synsets
|
|
289
131
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
with open(
|
|
132
|
+
api_tree_file_path = _get_api_tree_data_file_path()
|
|
133
|
+
api_tree_file_path.touch()
|
|
134
|
+
with open(api_tree_file_path, "w") as json_file:
|
|
293
135
|
json.dump(api_tree_data, json_file)
|
|
294
136
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
return results
|
|
137
|
+
_write_api_tree_file(
|
|
138
|
+
api_tree_data=api_tree_data, api_object_names=list(api_object_names)
|
|
139
|
+
)
|
|
140
|
+
api_tree_file.unlink()
|
|
300
141
|
|
|
301
142
|
|
|
302
143
|
@functools.cache
|
|
303
144
|
def _get_api_tree_data():
|
|
304
145
|
"""Get API tree data."""
|
|
305
|
-
|
|
306
|
-
if
|
|
307
|
-
json_file = open(
|
|
146
|
+
api_tree_data_file_path = _get_api_tree_data_file_path()
|
|
147
|
+
if api_tree_data_file_path.exists():
|
|
148
|
+
json_file = open(api_tree_data_file_path, "r")
|
|
308
149
|
api_tree_data = json.load(json_file)
|
|
309
150
|
return api_tree_data
|
|
310
151
|
|
|
@@ -319,13 +160,32 @@ def _print_search_results(queries: list, api_tree_data: dict):
|
|
|
319
160
|
api_tree_data: dict
|
|
320
161
|
All API object data.
|
|
321
162
|
"""
|
|
163
|
+
results = []
|
|
322
164
|
api_tree_data = api_tree_data if api_tree_data else _get_api_tree_data()
|
|
323
165
|
api_tree_datas = [api_tree_data["api_objects"], api_tree_data["api_tui_objects"]]
|
|
324
|
-
|
|
166
|
+
|
|
167
|
+
def _get_results(api_tree_data):
|
|
168
|
+
results = []
|
|
325
169
|
for query in queries:
|
|
326
170
|
for api_object in api_tree_data:
|
|
327
|
-
if query
|
|
328
|
-
|
|
171
|
+
if api_object.split()[0].endswith(query):
|
|
172
|
+
results.append(api_object)
|
|
173
|
+
return results
|
|
174
|
+
|
|
175
|
+
settings_results = _get_results(api_tree_datas[0])
|
|
176
|
+
tui_results = _get_results(api_tree_datas[1])
|
|
177
|
+
|
|
178
|
+
settings_results.sort()
|
|
179
|
+
tui_results.sort()
|
|
180
|
+
|
|
181
|
+
results.extend(settings_results)
|
|
182
|
+
results.extend(tui_results)
|
|
183
|
+
|
|
184
|
+
if pyfluent.PRINT_SEARCH_RESULTS:
|
|
185
|
+
for result in results:
|
|
186
|
+
print(result)
|
|
187
|
+
elif results:
|
|
188
|
+
return results
|
|
329
189
|
|
|
330
190
|
|
|
331
191
|
def _get_wildcard_matches_for_word_from_names(word: str, names: list):
|
|
@@ -364,10 +224,10 @@ def _search_wildcard(search_string: str, api_tree_data: dict):
|
|
|
364
224
|
"""
|
|
365
225
|
api_tree_data = api_tree_data if api_tree_data else _get_api_tree_data()
|
|
366
226
|
queries = _get_wildcard_matches_for_word_from_names(
|
|
367
|
-
search_string, names=
|
|
227
|
+
search_string, names=api_tree_data["all_api_object_names"]
|
|
368
228
|
)
|
|
369
229
|
if queries:
|
|
370
|
-
_print_search_results(queries, api_tree_data=api_tree_data)
|
|
230
|
+
return _print_search_results(queries, api_tree_data=api_tree_data)
|
|
371
231
|
|
|
372
232
|
|
|
373
233
|
def _get_exact_match_for_word_from_names(
|
|
@@ -387,7 +247,7 @@ def _get_exact_match_for_word_from_names(
|
|
|
387
247
|
-------
|
|
388
248
|
List of exact match.
|
|
389
249
|
"""
|
|
390
|
-
return
|
|
250
|
+
return list({name for name in names if word == name or word in name})
|
|
391
251
|
|
|
392
252
|
|
|
393
253
|
def _get_capitalize_match_for_word_from_names(
|
|
@@ -459,7 +319,7 @@ def _get_close_matches_for_word_from_names(
|
|
|
459
319
|
def _search_whole_word(
|
|
460
320
|
search_string: str,
|
|
461
321
|
match_case: bool = False,
|
|
462
|
-
match_whole_word: bool =
|
|
322
|
+
match_whole_word: bool = True,
|
|
463
323
|
api_tree_data: dict = None,
|
|
464
324
|
):
|
|
465
325
|
"""Perform exact search for a word through the Fluent's object hierarchy.
|
|
@@ -483,43 +343,43 @@ def _search_whole_word(
|
|
|
483
343
|
"""
|
|
484
344
|
api_tree_data = api_tree_data if api_tree_data else _get_api_tree_data()
|
|
485
345
|
queries = []
|
|
486
|
-
if match_case and match_whole_word:
|
|
346
|
+
if not match_case and not match_whole_word:
|
|
487
347
|
queries.extend(
|
|
488
|
-
|
|
348
|
+
_get_capitalize_match_for_word_from_names(
|
|
489
349
|
search_string,
|
|
490
|
-
names=
|
|
350
|
+
names=api_tree_data["all_api_object_names"],
|
|
491
351
|
)
|
|
492
352
|
)
|
|
493
|
-
elif match_case:
|
|
494
353
|
queries.extend(
|
|
495
354
|
_get_match_case_for_word_from_names(
|
|
496
355
|
search_string,
|
|
497
|
-
names=
|
|
356
|
+
names=api_tree_data["all_api_object_names"],
|
|
498
357
|
)
|
|
499
358
|
)
|
|
500
|
-
elif match_whole_word:
|
|
501
|
-
for word in [search_string, search_string.capitalize()]:
|
|
502
|
-
queries.extend(
|
|
503
|
-
_get_exact_match_for_word_from_names(
|
|
504
|
-
word,
|
|
505
|
-
names=list(api_tree_data["all_api_object_name_synsets"].keys()),
|
|
506
|
-
)
|
|
507
|
-
)
|
|
508
|
-
elif not match_case and not match_whole_word:
|
|
359
|
+
elif match_case and match_whole_word:
|
|
509
360
|
queries.extend(
|
|
510
|
-
|
|
361
|
+
_get_exact_match_for_word_from_names(
|
|
511
362
|
search_string,
|
|
512
|
-
names=
|
|
363
|
+
names=api_tree_data["all_api_object_names"],
|
|
513
364
|
)
|
|
514
365
|
)
|
|
366
|
+
elif match_case:
|
|
515
367
|
queries.extend(
|
|
516
368
|
_get_match_case_for_word_from_names(
|
|
517
369
|
search_string,
|
|
518
|
-
names=
|
|
370
|
+
names=api_tree_data["all_api_object_names"],
|
|
519
371
|
)
|
|
520
372
|
)
|
|
373
|
+
elif match_whole_word:
|
|
374
|
+
for word in [search_string, search_string.capitalize()]:
|
|
375
|
+
queries.extend(
|
|
376
|
+
_get_exact_match_for_word_from_names(
|
|
377
|
+
word,
|
|
378
|
+
names=api_tree_data["all_api_object_names"],
|
|
379
|
+
)
|
|
380
|
+
)
|
|
521
381
|
if queries:
|
|
522
|
-
_print_search_results(queries, api_tree_data=api_tree_data)
|
|
382
|
+
return _print_search_results(queries, api_tree_data=api_tree_data)
|
|
523
383
|
|
|
524
384
|
|
|
525
385
|
def _download_nltk_data():
|
|
@@ -540,7 +400,7 @@ def _download_nltk_data():
|
|
|
540
400
|
nltk.download(
|
|
541
401
|
package,
|
|
542
402
|
quiet=True,
|
|
543
|
-
|
|
403
|
+
halt_on_error=False,
|
|
544
404
|
)
|
|
545
405
|
|
|
546
406
|
|
|
@@ -567,32 +427,31 @@ def _search_semantic(search_string: str, language: str, api_tree_data: dict):
|
|
|
567
427
|
|
|
568
428
|
api_tree_data = api_tree_data if api_tree_data else _get_api_tree_data()
|
|
569
429
|
similar_keys = set()
|
|
570
|
-
search_string_synsets = (
|
|
571
|
-
wn.synsets(search_string.decode("utf-8"), lang=language)
|
|
572
|
-
if sys.version_info[0] < 3
|
|
573
|
-
else wn.synsets(search_string, lang=language)
|
|
574
|
-
)
|
|
430
|
+
search_string_synsets = set(wn.synsets(search_string, lang=language))
|
|
575
431
|
for api_object_name, api_object_synset_names in list(
|
|
576
432
|
api_tree_data["all_api_object_name_synsets"].items()
|
|
577
433
|
):
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
):
|
|
585
|
-
similar_keys.add(api_object_synset_name + "*")
|
|
434
|
+
api_object_synsets = {
|
|
435
|
+
wn.synset(api_object_synset_name)
|
|
436
|
+
for api_object_synset_name in api_object_synset_names
|
|
437
|
+
}
|
|
438
|
+
if search_string_synsets & api_object_synsets:
|
|
439
|
+
similar_keys.add(api_object_name + "*")
|
|
586
440
|
if similar_keys:
|
|
441
|
+
results = []
|
|
587
442
|
for key in similar_keys:
|
|
588
|
-
_search_wildcard(key, api_tree_data)
|
|
443
|
+
result = _search_wildcard(key, api_tree_data)
|
|
444
|
+
if result:
|
|
445
|
+
results.extend(result)
|
|
446
|
+
if results:
|
|
447
|
+
return results
|
|
589
448
|
else:
|
|
590
449
|
queries = _get_close_matches_for_word_from_names(
|
|
591
450
|
search_string,
|
|
592
|
-
names=
|
|
451
|
+
names=api_tree_data["all_api_object_names"],
|
|
593
452
|
)
|
|
594
453
|
if queries:
|
|
595
|
-
_print_search_results(queries, api_tree_data=api_tree_data)
|
|
454
|
+
return _print_search_results(queries, api_tree_data=api_tree_data)
|
|
596
455
|
|
|
597
456
|
|
|
598
457
|
def search(
|
|
@@ -646,47 +505,35 @@ def search(
|
|
|
646
505
|
"``wildcard=True`` matches wildcard pattern.",
|
|
647
506
|
UserWarning,
|
|
648
507
|
)
|
|
649
|
-
elif language and match_whole_word:
|
|
650
|
-
warnings.warn(
|
|
651
|
-
"``match_whole_word=True`` matches the whole word (case insensitive).",
|
|
652
|
-
UserWarning,
|
|
653
|
-
)
|
|
654
|
-
elif match_whole_word:
|
|
655
|
-
warnings.warn(
|
|
656
|
-
"``match_whole_word=True`` matches the whole word (case insensitive).",
|
|
657
|
-
UserWarning,
|
|
658
|
-
)
|
|
659
|
-
elif match_case:
|
|
660
|
-
warnings.warn(
|
|
661
|
-
"``match_case=True`` matches the whole word (case sensitive).",
|
|
662
|
-
UserWarning,
|
|
663
|
-
)
|
|
664
508
|
|
|
665
509
|
api_tree_data = _get_api_tree_data()
|
|
666
510
|
|
|
667
|
-
try:
|
|
668
|
-
_search_semantic(search_string, language, api_tree_data=api_tree_data)
|
|
669
|
-
except ModuleNotFoundError:
|
|
670
|
-
pass
|
|
671
|
-
except LookupError:
|
|
672
|
-
_download_nltk_data()
|
|
673
|
-
_search_semantic(search_string, language, api_tree_data=api_tree_data)
|
|
674
|
-
|
|
675
511
|
if wildcard:
|
|
676
|
-
_search_wildcard(
|
|
512
|
+
return _search_wildcard(
|
|
677
513
|
search_string,
|
|
678
514
|
api_tree_data=api_tree_data,
|
|
679
515
|
)
|
|
680
516
|
elif match_whole_word:
|
|
681
517
|
if not match_case:
|
|
682
|
-
_search_whole_word(
|
|
518
|
+
return _search_whole_word(
|
|
683
519
|
search_string, match_whole_word=True, api_tree_data=api_tree_data
|
|
684
520
|
)
|
|
685
521
|
else:
|
|
686
|
-
_search_whole_word(
|
|
687
|
-
search_string,
|
|
522
|
+
return _search_whole_word(
|
|
523
|
+
search_string,
|
|
524
|
+
match_case=True,
|
|
525
|
+
match_whole_word=True,
|
|
526
|
+
api_tree_data=api_tree_data,
|
|
688
527
|
)
|
|
689
528
|
else:
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
529
|
+
try:
|
|
530
|
+
return _search_semantic(
|
|
531
|
+
search_string, language, api_tree_data=api_tree_data
|
|
532
|
+
)
|
|
533
|
+
except ModuleNotFoundError:
|
|
534
|
+
pass
|
|
535
|
+
except LookupError:
|
|
536
|
+
_download_nltk_data()
|
|
537
|
+
return _search_semantic(
|
|
538
|
+
search_string, language, api_tree_data=api_tree_data
|
|
539
|
+
)
|
|
@@ -7,6 +7,7 @@ from ansys.fluent.core.services.datamodel_se import (
|
|
|
7
7
|
from ansys.fluent.core.services.datamodel_tui import (
|
|
8
8
|
DatamodelService as DatamodelService_TUI,
|
|
9
9
|
)
|
|
10
|
+
from ansys.fluent.core.services.deprecated_field_data import DeprecatedFieldData
|
|
10
11
|
from ansys.fluent.core.services.events import EventsService
|
|
11
12
|
from ansys.fluent.core.services.field_data import FieldData, FieldInfo
|
|
12
13
|
from ansys.fluent.core.services.health_check import HealthCheckService
|
|
@@ -28,6 +29,7 @@ _service_cls_by_name = {
|
|
|
28
29
|
"scheme_eval": SchemeEval,
|
|
29
30
|
"events": EventsService,
|
|
30
31
|
"field_data": FieldData,
|
|
32
|
+
"field_data_old": DeprecatedFieldData,
|
|
31
33
|
"field_info": FieldInfo,
|
|
32
34
|
"monitors": MonitorsService,
|
|
33
35
|
"reduction": Reduction,
|
|
@@ -42,6 +44,7 @@ class service_creator:
|
|
|
42
44
|
"""A gRPC service creator."""
|
|
43
45
|
|
|
44
46
|
def __init__(self, service_name: str):
|
|
47
|
+
"""Initialize service_creator."""
|
|
45
48
|
self._service_cls = _service_cls_by_name[service_name]
|
|
46
49
|
|
|
47
50
|
def create(self, *args, **kwargs):
|
|
@@ -13,6 +13,7 @@ class ApiUpgradeAdvisor:
|
|
|
13
13
|
"""API upgrade advisor."""
|
|
14
14
|
|
|
15
15
|
def __init__(self, scheme_eval: SchemeEval, version: str, mode: str) -> None:
|
|
16
|
+
"""Initialize ApiUpgradeAdvisor."""
|
|
16
17
|
self._scheme_eval = scheme_eval.scheme_eval
|
|
17
18
|
self._version = version
|
|
18
19
|
self._mode = mode
|