ansys-fluent-core 0.28.1__py3-none-any.whl → 0.29.0__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.

Files changed (223) hide show
  1. ansys/fluent/core/__init__.py +26 -1
  2. ansys/fluent/core/_stand_alone_datamodel_client/_datamodel_client.py +22 -0
  3. ansys/fluent/core/_version.py +24 -2
  4. ansys/fluent/core/codegen/__init__.py +22 -0
  5. ansys/fluent/core/codegen/allapigen.py +38 -5
  6. ansys/fluent/core/codegen/builtin_settingsgen.py +22 -0
  7. ansys/fluent/core/codegen/data/__init__.py +21 -0
  8. ansys/fluent/core/codegen/data/fluent_gui_help_patch.py +22 -0
  9. ansys/fluent/core/codegen/data/meshing_utilities_examples.py +22 -0
  10. ansys/fluent/core/codegen/datamodelgen.py +40 -4
  11. ansys/fluent/core/codegen/print_fluent_version.py +22 -0
  12. ansys/fluent/core/codegen/settingsgen.py +67 -4
  13. ansys/fluent/core/codegen/tuigen.py +44 -6
  14. ansys/fluent/core/codegen/walk_api.py +67 -18
  15. ansys/fluent/core/codegen/write_settings_yaml.py +22 -0
  16. ansys/fluent/core/data_model_cache.py +22 -0
  17. ansys/fluent/core/examples/__init__.py +22 -0
  18. ansys/fluent/core/examples/downloads.py +22 -0
  19. ansys/fluent/core/exceptions.py +22 -0
  20. ansys/fluent/core/file_session.py +22 -0
  21. ansys/fluent/core/filereader/__init__.py +21 -0
  22. ansys/fluent/core/filereader/case_file.py +22 -0
  23. ansys/fluent/core/filereader/casereader.py +22 -0
  24. ansys/fluent/core/filereader/data_file.py +22 -0
  25. ansys/fluent/core/filereader/lispy.py +22 -0
  26. ansys/fluent/core/fluent_connection.py +23 -1
  27. ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
  28. ansys/fluent/core/generated/datamodel_252/meshing.py +32 -0
  29. ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
  30. ansys/fluent/core/generated/fluent_version_252.py +3 -3
  31. ansys/fluent/core/generated/meshing/tui_252.py +395 -390
  32. ansys/fluent/core/generated/solver/settings_222.py +0 -72
  33. ansys/fluent/core/generated/solver/settings_222.pyi +0 -307
  34. ansys/fluent/core/generated/solver/settings_231.py +0 -574
  35. ansys/fluent/core/generated/solver/settings_231.pyi +0 -561
  36. ansys/fluent/core/generated/solver/settings_232.py +0 -527
  37. ansys/fluent/core/generated/solver/settings_232.pyi +0 -2803
  38. ansys/fluent/core/generated/solver/settings_241.py +0 -478
  39. ansys/fluent/core/generated/solver/settings_241.pyi +0 -522
  40. ansys/fluent/core/generated/solver/settings_242.py +0 -361
  41. ansys/fluent/core/generated/solver/settings_242.pyi +0 -591
  42. ansys/fluent/core/generated/solver/settings_251.py +0 -399
  43. ansys/fluent/core/generated/solver/settings_251.pyi +0 -629
  44. ansys/fluent/core/generated/solver/settings_252.py +8118 -4206
  45. ansys/fluent/core/generated/solver/settings_252.pyi +7229 -3259
  46. ansys/fluent/core/generated/solver/tui_252.py +4508 -3877
  47. ansys/fluent/core/get_build_details.py +22 -0
  48. ansys/fluent/core/journaling.py +38 -0
  49. ansys/fluent/core/launcher/__init__.py +22 -0
  50. ansys/fluent/core/launcher/container_launcher.py +65 -56
  51. ansys/fluent/core/launcher/error_handler.py +30 -0
  52. ansys/fluent/core/launcher/fluent_container.py +45 -20
  53. ansys/fluent/core/launcher/launcher.py +53 -5
  54. ansys/fluent/core/launcher/launcher_utils.py +22 -0
  55. ansys/fluent/core/launcher/pim_launcher.py +120 -86
  56. ansys/fluent/core/launcher/process_launch_string.py +22 -0
  57. ansys/fluent/core/launcher/pyfluent_enums.py +22 -0
  58. ansys/fluent/core/launcher/server_info.py +45 -3
  59. ansys/fluent/core/launcher/slurm_launcher.py +25 -3
  60. ansys/fluent/core/launcher/standalone_launcher.py +68 -63
  61. ansys/fluent/core/launcher/watchdog.py +22 -0
  62. ansys/fluent/core/logging.py +24 -0
  63. ansys/fluent/core/logging_config.yaml +3 -0
  64. ansys/fluent/core/meshing/meshing_workflow.py +22 -0
  65. ansys/fluent/core/parametric.py +22 -0
  66. ansys/fluent/core/post_objects/__init__.py +21 -0
  67. ansys/fluent/core/post_objects/check_in_notebook.py +22 -0
  68. ansys/fluent/core/post_objects/meta.py +22 -0
  69. ansys/fluent/core/post_objects/post_helper.py +22 -0
  70. ansys/fluent/core/post_objects/post_object_definitions.py +22 -0
  71. ansys/fluent/core/post_objects/post_objects_container.py +22 -0
  72. ansys/fluent/core/post_objects/singleton_meta.py +22 -0
  73. ansys/fluent/core/post_objects/timing_decorator.py +22 -0
  74. ansys/fluent/core/report.py +77 -0
  75. ansys/fluent/core/rpvars.py +22 -0
  76. ansys/fluent/core/scheduler/__init__.py +22 -0
  77. ansys/fluent/core/scheduler/load_machines.py +22 -0
  78. ansys/fluent/core/scheduler/machine_list.py +22 -0
  79. ansys/fluent/core/search.py +22 -0
  80. ansys/fluent/core/services/__init__.py +22 -0
  81. ansys/fluent/core/services/api_upgrade.py +22 -0
  82. ansys/fluent/core/services/app_utilities.py +38 -0
  83. ansys/fluent/core/services/batch_ops.py +22 -0
  84. ansys/fluent/core/services/datamodel_se.py +163 -61
  85. ansys/fluent/core/services/datamodel_tui.py +22 -0
  86. ansys/fluent/core/services/deprecated_field_data.py +23 -1
  87. ansys/fluent/core/services/events.py +22 -0
  88. ansys/fluent/core/services/field_data.py +285 -2
  89. ansys/fluent/core/services/health_check.py +22 -0
  90. ansys/fluent/core/services/interceptors.py +50 -2
  91. ansys/fluent/core/services/monitor.py +22 -0
  92. ansys/fluent/core/services/reduction.py +22 -0
  93. ansys/fluent/core/services/scheme_eval.py +22 -0
  94. ansys/fluent/core/services/settings.py +22 -0
  95. ansys/fluent/core/services/solution_variables.py +22 -0
  96. ansys/fluent/core/services/streaming.py +22 -0
  97. ansys/fluent/core/services/transcript.py +22 -0
  98. ansys/fluent/core/session.py +39 -2
  99. ansys/fluent/core/session_base_meshing.py +22 -0
  100. ansys/fluent/core/session_meshing.py +22 -0
  101. ansys/fluent/core/session_meshing.pyi +22 -0
  102. ansys/fluent/core/session_pure_meshing.py +22 -0
  103. ansys/fluent/core/session_pure_meshing.pyi +22 -0
  104. ansys/fluent/core/session_shared.py +22 -0
  105. ansys/fluent/core/session_solver.py +43 -0
  106. ansys/fluent/core/session_solver.pyi +22 -0
  107. ansys/fluent/core/session_solver_aero.py +22 -0
  108. ansys/fluent/core/session_solver_icing.py +22 -0
  109. ansys/fluent/core/session_solver_lite.py +22 -0
  110. ansys/fluent/core/solver/__init__.py +22 -0
  111. ansys/fluent/core/solver/error_message.py +22 -0
  112. ansys/fluent/core/solver/flobject.py +22 -0
  113. ansys/fluent/core/solver/flunits.py +22 -0
  114. ansys/fluent/core/solver/function/__init__.py +22 -0
  115. ansys/fluent/core/solver/function/reduction.py +22 -0
  116. ansys/fluent/core/solver/settings_builtin_bases.py +22 -0
  117. ansys/fluent/core/solver/settings_builtin_data.py +22 -0
  118. ansys/fluent/core/solver/settings_external.py +22 -0
  119. ansys/fluent/core/streaming_services/__init__.py +21 -0
  120. ansys/fluent/core/streaming_services/datamodel_event_streaming.py +34 -12
  121. ansys/fluent/core/streaming_services/datamodel_streaming.py +22 -0
  122. ansys/fluent/core/streaming_services/events_streaming.py +22 -0
  123. ansys/fluent/core/streaming_services/field_data_streaming.py +22 -0
  124. ansys/fluent/core/streaming_services/monitor_streaming.py +23 -1
  125. ansys/fluent/core/streaming_services/streaming.py +22 -0
  126. ansys/fluent/core/streaming_services/transcript_streaming.py +22 -0
  127. ansys/fluent/core/systemcoupling.py +22 -0
  128. ansys/fluent/core/utils/__init__.py +22 -0
  129. ansys/fluent/core/utils/data_transfer.py +22 -0
  130. ansys/fluent/core/utils/deprecate.py +24 -1
  131. ansys/fluent/core/utils/dictionary_operations.py +22 -0
  132. ansys/fluent/core/utils/dump_session_data.py +22 -0
  133. ansys/fluent/core/utils/event_loop.py +22 -0
  134. ansys/fluent/core/utils/execution.py +22 -0
  135. ansys/fluent/core/utils/file_transfer_service.py +22 -0
  136. ansys/fluent/core/utils/fix_doc.py +22 -0
  137. ansys/fluent/core/utils/fldoc.py +22 -0
  138. ansys/fluent/core/utils/fluent_version.py +22 -0
  139. ansys/fluent/core/utils/networking.py +22 -0
  140. ansys/fluent/core/utils/setup_for_fluent.py +22 -0
  141. ansys/fluent/core/warnings.py +22 -0
  142. ansys/fluent/core/workflow.py +22 -0
  143. {ansys_fluent_core-0.28.1.dist-info → ansys_fluent_core-0.29.0.dist-info}/LICENSE +8 -8
  144. {ansys_fluent_core-0.28.1.dist-info → ansys_fluent_core-0.29.0.dist-info}/METADATA +56 -33
  145. ansys_fluent_core-0.29.0.dist-info/RECORD +219 -0
  146. {ansys_fluent_core-0.28.1.dist-info → ansys_fluent_core-0.29.0.dist-info}/WHEEL +1 -1
  147. ansys/fluent/core/docs/README.rst +0 -155
  148. ansys/fluent/tests/conftest.py +0 -415
  149. ansys/fluent/tests/fluent_fixtures.py +0 -195
  150. ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
  151. ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
  152. ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
  153. ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
  154. ansys/fluent/tests/test_aero_session.py +0 -88
  155. ansys/fluent/tests/test_batch_ops.py +0 -39
  156. ansys/fluent/tests/test_builtin_settings.py +0 -761
  157. ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
  158. ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
  159. ansys/fluent/tests/test_casereader.py +0 -324
  160. ansys/fluent/tests/test_codegen.py +0 -783
  161. ansys/fluent/tests/test_creatable.py +0 -31
  162. ansys/fluent/tests/test_data_model_cache.py +0 -434
  163. ansys/fluent/tests/test_datamodel_api.py +0 -449
  164. ansys/fluent/tests/test_datamodel_service.py +0 -814
  165. ansys/fluent/tests/test_datareader.py +0 -103
  166. ansys/fluent/tests/test_error_handling.py +0 -24
  167. ansys/fluent/tests/test_events_manager.py +0 -214
  168. ansys/fluent/tests/test_field_data.py +0 -466
  169. ansys/fluent/tests/test_file_session.py +0 -355
  170. ansys/fluent/tests/test_file_transfer_service.py +0 -165
  171. ansys/fluent/tests/test_fix_doc.py +0 -29
  172. ansys/fluent/tests/test_flobject.py +0 -1235
  173. ansys/fluent/tests/test_fluent_fixes.py +0 -106
  174. ansys/fluent/tests/test_fluent_session.py +0 -270
  175. ansys/fluent/tests/test_fluent_version.py +0 -66
  176. ansys/fluent/tests/test_fluent_version_marker.py +0 -65
  177. ansys/fluent/tests/test_icing_session.py +0 -9
  178. ansys/fluent/tests/test_launcher.py +0 -529
  179. ansys/fluent/tests/test_launcher_remote.py +0 -272
  180. ansys/fluent/tests/test_lispy.py +0 -40
  181. ansys/fluent/tests/test_logging.py +0 -16
  182. ansys/fluent/tests/test_mapped_api.py +0 -774
  183. ansys/fluent/tests/test_meshing_utilities.py +0 -2436
  184. ansys/fluent/tests/test_meshing_workflow.py +0 -421
  185. ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
  186. ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
  187. ansys/fluent/tests/test_preferences.py +0 -89
  188. ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
  189. ansys/fluent/tests/test_reduction.py +0 -484
  190. ansys/fluent/tests/test_rp_vars.py +0 -77
  191. ansys/fluent/tests/test_scheduler.py +0 -471
  192. ansys/fluent/tests/test_scheme_eval_222.py +0 -338
  193. ansys/fluent/tests/test_scheme_eval_231.py +0 -243
  194. ansys/fluent/tests/test_search.py +0 -344
  195. ansys/fluent/tests/test_session.py +0 -594
  196. ansys/fluent/tests/test_settings_api.py +0 -606
  197. ansys/fluent/tests/test_settings_reader.py +0 -85
  198. ansys/fluent/tests/test_slurm_future.py +0 -67
  199. ansys/fluent/tests/test_solution_variables.py +0 -241
  200. ansys/fluent/tests/test_solver_monitors.py +0 -83
  201. ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
  202. ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
  203. ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
  204. ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
  205. ansys/fluent/tests/test_solvermode/test_general.py +0 -109
  206. ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
  207. ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
  208. ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
  209. ansys/fluent/tests/test_solvermode/test_models.py +0 -99
  210. ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
  211. ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
  212. ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
  213. ansys/fluent/tests/test_streaming_services.py +0 -52
  214. ansys/fluent/tests/test_systemcoupling.py +0 -44
  215. ansys/fluent/tests/test_topy.py +0 -179
  216. ansys/fluent/tests/test_tui_api.py +0 -70
  217. ansys/fluent/tests/test_type_stub.py +0 -37
  218. ansys/fluent/tests/test_utils.py +0 -82
  219. ansys/fluent/tests/util/__init__.py +0 -36
  220. ansys/fluent/tests/util/meshing_workflow.py +0 -33
  221. ansys/fluent/tests/util/solver.py +0 -72
  222. ansys_fluent_core-0.28.1.dist-info/AUTHORS +0 -12
  223. ansys_fluent_core-0.28.1.dist-info/RECORD +0 -294
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrappers over StateEngine based datamodel gRPC service of Fluent."""
2
24
 
3
25
  from enum import Enum
@@ -6,7 +28,7 @@ import itertools
6
28
  import logging
7
29
  import os
8
30
  from threading import RLock
9
- from typing import Any, Callable, Iterator, NoReturn, Sequence
31
+ from typing import Any, Callable, Iterator, NoReturn, Sequence, TypeVar
10
32
 
11
33
  from google.protobuf.json_format import MessageToDict, ParseDict
12
34
  import grpc
@@ -28,7 +50,8 @@ from ansys.fluent.core.solver.error_message import allowed_name_error_message
28
50
  from ansys.fluent.core.utils.fluent_version import FluentVersion
29
51
 
30
52
  Path = list[tuple[str, str]]
31
- _TValue = None | bool | int | float | str | Sequence["_TValue"] | dict[str, "_TValue"]
53
+ PyMenuT = TypeVar("PyMenuT", bound="PyMenu")
54
+ ValueT = None | bool | int | float | str | Sequence["ValueT"] | dict[str, "ValueT"]
32
55
  logger: logging.Logger = logging.getLogger("pyfluent.datamodel")
33
56
 
34
57
  member_specs_oneof_fields = [
@@ -175,6 +198,8 @@ class DatamodelServiceImpl:
175
198
  self._stub = DataModelGrpcModule.DataModelStub(intercept_channel)
176
199
  self._metadata = metadata
177
200
  self.file_transfer_service = file_transfer_service
201
+ if os.getenv("REMOTING_MAPPED_NEW_DM_API") == "1":
202
+ self._metadata.append(("mapped", "1"))
178
203
 
179
204
  # TODO: Remove it from the proto interface
180
205
  def initialize_datamodel(
@@ -301,7 +326,7 @@ class DatamodelServiceImpl:
301
326
  return self._stub.unsubscribeEvents(request, metadata=self._metadata)
302
327
 
303
328
 
304
- def _convert_value_to_variant(val: _TValue, var: Variant) -> None:
329
+ def _convert_value_to_variant(val: ValueT, var: Variant) -> None:
305
330
  """Convert a Python data type to Fluent's variant type."""
306
331
  if isinstance(val, bool):
307
332
  var.bool_state = val
@@ -322,7 +347,7 @@ def _convert_value_to_variant(val: _TValue, var: Variant) -> None:
322
347
  _convert_value_to_variant(v, var.variant_map_state.item[k])
323
348
 
324
349
 
325
- def _convert_variant_to_value(var: Variant) -> _TValue:
350
+ def _convert_variant_to_value(var: Variant) -> ValueT:
326
351
  """Convert Fluent's variant type to a Python data type."""
327
352
  if var.HasField("bool_state"):
328
353
  return var.bool_state
@@ -495,7 +520,7 @@ class DatamodelService(StreamingService):
495
520
  self.cache = DataModelCache() if pyfluent.DATAMODEL_USE_STATE_CACHE else None
496
521
  self.version = version
497
522
 
498
- def get_attribute_value(self, rules: str, path: str, attribute: str) -> _TValue:
523
+ def get_attribute_value(self, rules: str, path: str, attribute: str) -> ValueT:
499
524
  """Get attribute value."""
500
525
  request = DataModelProtoModule.GetAttributeValueRequest(
501
526
  rules=rules, path=path, attribute=attribute
@@ -503,7 +528,7 @@ class DatamodelService(StreamingService):
503
528
  response = self._impl.get_attribute_value(request)
504
529
  return _convert_variant_to_value(response.result)
505
530
 
506
- def get_state(self, rules: str, path: str) -> _TValue:
531
+ def get_state(self, rules: str, path: str) -> ValueT:
507
532
  """Get state."""
508
533
  request = DataModelProtoModule.GetStateRequest(rules=rules, path=path)
509
534
  response = self._impl.get_state(request)
@@ -568,7 +593,7 @@ class DatamodelService(StreamingService):
568
593
  version=self.version,
569
594
  )
570
595
 
571
- def set_state(self, rules: str, path: str, state: _TValue) -> None:
596
+ def set_state(self, rules: str, path: str, state: ValueT) -> None:
572
597
  """Set state."""
573
598
  request = DataModelProtoModule.SetStateRequest(
574
599
  rules=rules, path=path, wait=True
@@ -601,7 +626,7 @@ class DatamodelService(StreamingService):
601
626
  self,
602
627
  rules: str,
603
628
  path: str,
604
- dict_state: dict[str, _TValue],
629
+ dict_state: dict[str, ValueT],
605
630
  recursive=False,
606
631
  ) -> None:
607
632
  """Update the dict."""
@@ -633,8 +658,8 @@ class DatamodelService(StreamingService):
633
658
  )
634
659
 
635
660
  def execute_command(
636
- self, rules: str, path: str, command: str, args: dict[str, _TValue]
637
- ) -> _TValue:
661
+ self, rules: str, path: str, command: str, args: dict[str, ValueT]
662
+ ) -> ValueT:
638
663
  """Execute the command."""
639
664
  request = DataModelProtoModule.ExecuteCommandRequest(
640
665
  rules=rules, path=path, command=command, wait=True
@@ -651,8 +676,8 @@ class DatamodelService(StreamingService):
651
676
  return _convert_variant_to_value(response.result)
652
677
 
653
678
  def execute_query(
654
- self, rules: str, path: str, query: str, args: dict[str, _TValue]
655
- ) -> _TValue:
679
+ self, rules: str, path: str, query: str, args: dict[str, ValueT]
680
+ ) -> ValueT:
656
681
  """Execute the query."""
657
682
  request = DataModelProtoModule.ExecuteQueryRequest(
658
683
  rules=rules, path=path, query=query
@@ -722,7 +747,7 @@ class DatamodelService(StreamingService):
722
747
  self.subscriptions.unsubscribe_all()
723
748
 
724
749
  def add_on_child_created(
725
- self, rules: str, path: str, child_type: str, obj, cb: Callable
750
+ self, rules: str, path: str, child_type: str, cb: Callable[[str], None]
726
751
  ) -> EventSubscription:
727
752
  """Add on child created."""
728
753
  request_dict = {
@@ -737,11 +762,18 @@ class DatamodelService(StreamingService):
737
762
  ]
738
763
  }
739
764
  subscription = EventSubscription(self, path, request_dict)
740
- self.event_streaming.register_callback(subscription.tag, obj, cb)
765
+
766
+ def cb_grpc(child_type: str, child_name: str):
767
+ ppath = convert_se_path_to_path(path)
768
+ ppath.append((child_type, child_name))
769
+ child_path = convert_path_to_se_path(ppath)
770
+ cb(child_path)
771
+
772
+ self.event_streaming.register_callback(subscription.tag, cb_grpc)
741
773
  return subscription
742
774
 
743
775
  def add_on_deleted(
744
- self, rules: str, path: str, obj, cb: Callable
776
+ self, rules: str, path: str, cb: Callable[[], None]
745
777
  ) -> EventSubscription:
746
778
  """Add on deleted."""
747
779
  request_dict = {
@@ -753,11 +785,11 @@ class DatamodelService(StreamingService):
753
785
  ]
754
786
  }
755
787
  subscription = EventSubscription(self, path, request_dict)
756
- self.event_streaming.register_callback(subscription.tag, obj, cb)
788
+ self.event_streaming.register_callback(subscription.tag, cb)
757
789
  return subscription
758
790
 
759
791
  def add_on_changed(
760
- self, rules: str, path: str, obj, cb: Callable
792
+ self, rules: str, path: str, cb: Callable[[ValueT], None]
761
793
  ) -> EventSubscription:
762
794
  """Add on changed."""
763
795
  request_dict = {
@@ -769,11 +801,11 @@ class DatamodelService(StreamingService):
769
801
  ]
770
802
  }
771
803
  subscription = EventSubscription(self, path, request_dict)
772
- self.event_streaming.register_callback(subscription.tag, obj, cb)
804
+ self.event_streaming.register_callback(subscription.tag, cb)
773
805
  return subscription
774
806
 
775
807
  def add_on_affected(
776
- self, rules: str, path: str, obj, cb: Callable
808
+ self, rules: str, path: str, cb: Callable[[], None]
777
809
  ) -> EventSubscription:
778
810
  """Add on affected."""
779
811
  request_dict = {
@@ -785,11 +817,11 @@ class DatamodelService(StreamingService):
785
817
  ]
786
818
  }
787
819
  subscription = EventSubscription(self, path, request_dict)
788
- self.event_streaming.register_callback(subscription.tag, obj, cb)
820
+ self.event_streaming.register_callback(subscription.tag, cb)
789
821
  return subscription
790
822
 
791
823
  def add_on_affected_at_type_path(
792
- self, rules: str, path: str, child_type: str, obj, cb: Callable
824
+ self, rules: str, path: str, child_type: str, cb: Callable[[], None]
793
825
  ) -> EventSubscription:
794
826
  """Add on affected at type path."""
795
827
  request_dict = {
@@ -804,11 +836,16 @@ class DatamodelService(StreamingService):
804
836
  ]
805
837
  }
806
838
  subscription = EventSubscription(self, path, request_dict)
807
- self.event_streaming.register_callback(subscription.tag, obj, cb)
839
+ self.event_streaming.register_callback(subscription.tag, cb)
808
840
  return subscription
809
841
 
810
842
  def add_on_command_executed_old(
811
- self, rules: str, path: str, command: str, obj, cb: Callable
843
+ self,
844
+ rules: str,
845
+ path: str,
846
+ command: str,
847
+ obj,
848
+ cb: Callable[[str, ValueT], None],
812
849
  ) -> EventSubscription:
813
850
  """Add on command executed."""
814
851
  request_dict = {
@@ -823,11 +860,11 @@ class DatamodelService(StreamingService):
823
860
  ]
824
861
  }
825
862
  subscription = EventSubscription(self, path, request_dict)
826
- self.event_streaming.register_callback(subscription.tag, obj, cb)
863
+ self.event_streaming.register_callback(subscription.tag, cb)
827
864
  return subscription
828
865
 
829
866
  def add_on_command_executed(
830
- self, rules: str, path: str, obj, cb: Callable
867
+ self, rules: str, path: str, cb: Callable[[str, ValueT], None]
831
868
  ) -> EventSubscription:
832
869
  """Add on command executed."""
833
870
  request_dict = {
@@ -841,11 +878,11 @@ class DatamodelService(StreamingService):
841
878
  ]
842
879
  }
843
880
  subscription = EventSubscription(self, path, request_dict)
844
- self.event_streaming.register_callback(subscription.tag, obj, cb)
881
+ self.event_streaming.register_callback(subscription.tag, cb)
845
882
  return subscription
846
883
 
847
884
  def add_on_attribute_changed(
848
- self, rules: str, path: str, attribute: str, obj, cb: Callable
885
+ self, rules: str, path: str, attribute: str, cb: Callable[[ValueT], None]
849
886
  ) -> EventSubscription:
850
887
  """Add on attribute changed."""
851
888
  request_dict = {
@@ -860,11 +897,16 @@ class DatamodelService(StreamingService):
860
897
  ]
861
898
  }
862
899
  subscription = EventSubscription(self, path, request_dict)
863
- self.event_streaming.register_callback(subscription.tag, obj, cb)
900
+ self.event_streaming.register_callback(subscription.tag, cb)
864
901
  return subscription
865
902
 
866
903
  def add_on_command_attribute_changed(
867
- self, rules: str, path: str, command: str, attribute: str, obj, cb: Callable
904
+ self,
905
+ rules: str,
906
+ path: str,
907
+ command: str,
908
+ attribute: str,
909
+ cb: Callable[[ValueT], None],
868
910
  ) -> EventSubscription:
869
911
  """Add on command attribute changed."""
870
912
  request_dict = {
@@ -880,7 +922,7 @@ class DatamodelService(StreamingService):
880
922
  ]
881
923
  }
882
924
  subscription = EventSubscription(self, path, request_dict)
883
- self.event_streaming.register_callback(subscription.tag, obj, cb)
925
+ self.event_streaming.register_callback(subscription.tag, cb)
884
926
  return subscription
885
927
 
886
928
 
@@ -905,6 +947,30 @@ def convert_path_to_se_path(path: Path) -> str:
905
947
  return se_path
906
948
 
907
949
 
950
+ def convert_se_path_to_path(se_path: str) -> Path:
951
+ """Convert a StateEngine path to a path structure.
952
+
953
+ Parameters
954
+ ----------
955
+ se_path : str
956
+ StateEngine path.
957
+
958
+ Returns
959
+ -------
960
+ Path
961
+ path structure
962
+ """
963
+ path = []
964
+ for comp in se_path.split("/"):
965
+ if comp:
966
+ if ":" in comp:
967
+ name, value = comp.split(":")
968
+ else:
969
+ name, value = comp, ""
970
+ path.append((name, value))
971
+ return path
972
+
973
+
908
974
  class PyCallableStateObject:
909
975
  """Any object which can be called to get its state.
910
976
 
@@ -1066,7 +1132,7 @@ class PyStateContainer(PyCallableStateObject):
1066
1132
  return self.get_state()
1067
1133
 
1068
1134
  def add_on_attribute_changed(
1069
- self, attribute: str, cb: Callable
1135
+ self, attribute: str, cb: Callable[[ValueT], None]
1070
1136
  ) -> EventSubscription:
1071
1137
  """Register a callback for when an attribute is changed.
1072
1138
 
@@ -1074,7 +1140,7 @@ class PyStateContainer(PyCallableStateObject):
1074
1140
  ----------
1075
1141
  attribute : str
1076
1142
  attribute name
1077
- cb : Callable
1143
+ cb : Callable[[ValueT], None]
1078
1144
  Callback function
1079
1145
 
1080
1146
  Returns
@@ -1083,11 +1149,11 @@ class PyStateContainer(PyCallableStateObject):
1083
1149
  EventSubscription instance which can be used to unregister the callback
1084
1150
  """
1085
1151
  return self.service.add_on_attribute_changed(
1086
- self.rules, convert_path_to_se_path(self.path), attribute, self, cb
1152
+ self.rules, convert_path_to_se_path(self.path), attribute, cb
1087
1153
  )
1088
1154
 
1089
1155
  def add_on_command_attribute_changed(
1090
- self, command: str, attribute: str, cb: Callable
1156
+ self, command: str, attribute: str, cb: Callable[[ValueT], None]
1091
1157
  ) -> EventSubscription:
1092
1158
  """Register a callback for when an attribute is changed.
1093
1159
 
@@ -1097,7 +1163,7 @@ class PyStateContainer(PyCallableStateObject):
1097
1163
  command name
1098
1164
  attribute : str
1099
1165
  attribute name
1100
- cb : Callable
1166
+ cb : Callable[[ValueT], None]
1101
1167
  Callback function
1102
1168
 
1103
1169
  Returns
@@ -1106,7 +1172,7 @@ class PyStateContainer(PyCallableStateObject):
1106
1172
  EventSubscription instance which can be used to unregister the callback
1107
1173
  """
1108
1174
  return self.service.add_on_command_attribute_changed(
1109
- self.rules, convert_path_to_se_path(self.path), command, attribute, self, cb
1175
+ self.rules, convert_path_to_se_path(self.path), command, attribute, cb
1110
1176
  )
1111
1177
 
1112
1178
  def __dir__(self):
@@ -1253,14 +1319,16 @@ class PyMenu(PyStateContainer):
1253
1319
  self.rules, convert_path_to_se_path(self.path), command
1254
1320
  )
1255
1321
 
1256
- def add_on_child_created(self, child_type: str, cb: Callable) -> EventSubscription:
1322
+ def add_on_child_created(
1323
+ self, child_type: str, cb: Callable[[PyMenuT], None]
1324
+ ) -> EventSubscription:
1257
1325
  """Register a callback for when a child object is created.
1258
1326
 
1259
1327
  Parameters
1260
1328
  ----------
1261
1329
  child_type : str
1262
1330
  Type of the child object
1263
- cb : Callable
1331
+ cb : Callable[[PyMenuT], None]
1264
1332
  Callback function
1265
1333
 
1266
1334
  Returns
@@ -1268,16 +1336,23 @@ class PyMenu(PyStateContainer):
1268
1336
  EventSubscription
1269
1337
  EventSubscription instance which can be used to unregister the callback
1270
1338
  """
1339
+
1340
+ def cb_service(child_path: str):
1341
+ child_path = convert_se_path_to_path(child_path)
1342
+ child_type, child_name = child_path[-1]
1343
+ child = getattr(self, child_type)[child_name]
1344
+ cb(child)
1345
+
1271
1346
  return self.service.add_on_child_created(
1272
- self.rules, convert_path_to_se_path(self.path), child_type, self, cb
1347
+ self.rules, convert_path_to_se_path(self.path), child_type, cb_service
1273
1348
  )
1274
1349
 
1275
- def add_on_deleted(self, cb: Callable) -> EventSubscription:
1350
+ def add_on_deleted(self, cb: Callable[[], None]) -> EventSubscription:
1276
1351
  """Register a callback for when the object is deleted.
1277
1352
 
1278
1353
  Parameters
1279
1354
  ----------
1280
- cb : Callable
1355
+ cb : Callable[[], None]
1281
1356
  Callback function
1282
1357
 
1283
1358
  Returns
@@ -1286,15 +1361,15 @@ class PyMenu(PyStateContainer):
1286
1361
  EventSubscription instance which can be used to unregister the callback
1287
1362
  """
1288
1363
  return self.service.add_on_deleted(
1289
- self.rules, convert_path_to_se_path(self.path), self, cb
1364
+ self.rules, convert_path_to_se_path(self.path), cb
1290
1365
  )
1291
1366
 
1292
- def add_on_changed(self, cb: Callable) -> EventSubscription:
1367
+ def add_on_changed(self, cb: Callable[[PyMenuT], None]) -> EventSubscription:
1293
1368
  """Register a callback for when the object is modified.
1294
1369
 
1295
1370
  Parameters
1296
1371
  ----------
1297
- cb : Callable
1372
+ cb : Callable[[PyMenuT], None]
1298
1373
  Callback function
1299
1374
 
1300
1375
  Returns
@@ -1302,16 +1377,20 @@ class PyMenu(PyStateContainer):
1302
1377
  EventSubscription
1303
1378
  EventSubscription instance which can be used to unregister the callback
1304
1379
  """
1380
+
1381
+ def cb_service(value: ValueT):
1382
+ cb(self)
1383
+
1305
1384
  return self.service.add_on_changed(
1306
- self.rules, convert_path_to_se_path(self.path), self, cb
1385
+ self.rules, convert_path_to_se_path(self.path), cb_service
1307
1386
  )
1308
1387
 
1309
- def add_on_affected(self, cb: Callable) -> EventSubscription:
1388
+ def add_on_affected(self, cb: Callable[[PyMenuT], None]) -> EventSubscription:
1310
1389
  """Register a callback for when the object is affected.
1311
1390
 
1312
1391
  Parameters
1313
1392
  ----------
1314
- cb : Callable
1393
+ cb : Callable[[PyMenuT], None]
1315
1394
  Callback function
1316
1395
 
1317
1396
  Returns
@@ -1319,12 +1398,16 @@ class PyMenu(PyStateContainer):
1319
1398
  EventSubscription
1320
1399
  EventSubscription instance which can be used to unregister the callback
1321
1400
  """
1401
+
1402
+ def cb_service():
1403
+ cb(self)
1404
+
1322
1405
  return self.service.add_on_affected(
1323
- self.rules, convert_path_to_se_path(self.path), self, cb
1406
+ self.rules, convert_path_to_se_path(self.path), cb_service
1324
1407
  )
1325
1408
 
1326
1409
  def add_on_affected_at_type_path(
1327
- self, child_type: str, cb: Callable
1410
+ self, child_type: str, cb: Callable[[PyMenuT], None]
1328
1411
  ) -> EventSubscription:
1329
1412
  """Register a callback for when the object is affected at child type.
1330
1413
 
@@ -1332,7 +1415,7 @@ class PyMenu(PyStateContainer):
1332
1415
  ----------
1333
1416
  child_type : str
1334
1417
  child type
1335
- cb : Callable
1418
+ cb : Callable[[PyMenuT], None]
1336
1419
  Callback function
1337
1420
 
1338
1421
  Returns
@@ -1340,12 +1423,16 @@ class PyMenu(PyStateContainer):
1340
1423
  EventSubscription
1341
1424
  EventSubscription instance which can be used to unregister the callback
1342
1425
  """
1426
+
1427
+ def cb_service():
1428
+ cb(self)
1429
+
1343
1430
  return self.service.add_on_affected_at_type_path(
1344
- self.rules, convert_path_to_se_path(self.path), child_type, self, cb
1431
+ self.rules, convert_path_to_se_path(self.path), child_type, cb_service
1345
1432
  )
1346
1433
 
1347
1434
  def add_on_command_executed_old(
1348
- self, command: str, cb: Callable
1435
+ self, command: str, cb: Callable[[PyMenuT, str, ValueT], None]
1349
1436
  ) -> EventSubscription:
1350
1437
  """Register a callback for when a command is executed.
1351
1438
 
@@ -1353,7 +1440,7 @@ class PyMenu(PyStateContainer):
1353
1440
  ----------
1354
1441
  command : str
1355
1442
  Command name
1356
- cb : Callable
1443
+ cb : Callable[[PyMenuT, str, ValueT], None]
1357
1444
  Callback function
1358
1445
 
1359
1446
  Returns
@@ -1361,16 +1448,22 @@ class PyMenu(PyStateContainer):
1361
1448
  EventSubscription
1362
1449
  EventSubscription instance which can be used to unregister the callback
1363
1450
  """
1451
+
1452
+ def cb_service(command: str, args: ValueT):
1453
+ cb(self, command, args)
1454
+
1364
1455
  return self.service.add_on_command_executed_old(
1365
- self.rules, convert_path_to_se_path(self.path), command, self, cb
1456
+ self.rules, convert_path_to_se_path(self.path), command, self, cb_service
1366
1457
  )
1367
1458
 
1368
- def add_on_command_executed(self, cb: Callable) -> EventSubscription:
1459
+ def add_on_command_executed(
1460
+ self, cb: Callable[[PyMenuT, str, ValueT], None]
1461
+ ) -> EventSubscription:
1369
1462
  """Register a callback for when a command is executed.
1370
1463
 
1371
1464
  Parameters
1372
1465
  ----------
1373
- cb : Callable
1466
+ cb : Callable[[PyMenuT, str, ValueT], None]
1374
1467
  Callback function
1375
1468
 
1376
1469
  Returns
@@ -1378,8 +1471,12 @@ class PyMenu(PyStateContainer):
1378
1471
  EventSubscription
1379
1472
  EventSubscription instance which can be used to unregister the callback
1380
1473
  """
1474
+
1475
+ def cb_service(command: str, args: ValueT):
1476
+ cb(self, command, args)
1477
+
1381
1478
  return self.service.add_on_command_executed(
1382
- self.rules, convert_path_to_se_path(self.path), self, cb
1479
+ self.rules, convert_path_to_se_path(self.path), cb_service
1383
1480
  )
1384
1481
 
1385
1482
 
@@ -1393,12 +1490,12 @@ class PyParameter(PyStateContainer):
1393
1490
  """Get default value of the parameter."""
1394
1491
  return self.get_attr(Attribute.DEFAULT.value)
1395
1492
 
1396
- def add_on_changed(self, cb: Callable) -> EventSubscription:
1493
+ def add_on_changed(self, cb: Callable[[PyMenuT], None]) -> EventSubscription:
1397
1494
  """Register a callback for when the object is modified.
1398
1495
 
1399
1496
  Parameters
1400
1497
  ----------
1401
- cb : Callable
1498
+ cb : Callable[[PyMenuT], None]
1402
1499
  Callback function
1403
1500
 
1404
1501
  Returns
@@ -1406,8 +1503,12 @@ class PyParameter(PyStateContainer):
1406
1503
  EventSubscription
1407
1504
  EventSubscription instance which can be used to unregister the callback
1408
1505
  """
1506
+
1507
+ def cb_service(value: ValueT):
1508
+ cb(self)
1509
+
1409
1510
  return self.service.add_on_changed(
1410
- self.rules, convert_path_to_se_path(self.path), self, cb
1511
+ self.rules, convert_path_to_se_path(self.path), cb_service
1411
1512
  )
1412
1513
 
1413
1514
 
@@ -1892,7 +1993,8 @@ class PyCommand:
1892
1993
  id,
1893
1994
  static_info.get("args"),
1894
1995
  )
1895
- except RuntimeError:
1996
+ # Possible error thrown from the grpc layer
1997
+ except (RuntimeError, ValueError):
1896
1998
  logger.warning(
1897
1999
  "Create command arguments object is available from 23.1 onwards"
1898
2000
  )
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrappers over TUI-based datamodel gRPC service of Fluent."""
2
24
 
3
25
  import keyword
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Deprecated wrappers over FieldData gRPC service of Fluent."""
2
24
 
3
25
  from typing import Callable, Dict, List
@@ -571,7 +593,7 @@ class DeprecatedFieldData:
571
593
  self,
572
594
  field_name: str,
573
595
  surfaces: List[int | str],
574
- additional_field_name: str | None = "",
596
+ additional_field_name: str = "",
575
597
  provide_particle_time_field: bool | None = False,
576
598
  node_value: bool | None = True,
577
599
  steps: int | None = 500,
@@ -1,3 +1,25 @@
1
+ # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
2
+ # SPDX-License-Identifier: MIT
3
+ #
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
1
23
  """Wrapper over the events gRPC service of Fluent."""
2
24
 
3
25
  from typing import List, Tuple