ansys-systemcoupling-core 0.4.1__py3-none-any.whl → 0.6__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-systemcoupling-core might be problematic. Click here for more details.

Files changed (148) hide show
  1. ansys/systemcoupling/core/__init__.py +11 -5
  2. ansys/systemcoupling/core/adaptor/api_23_1/_clear_state.py +13 -0
  3. ansys/systemcoupling/core/adaptor/api_23_1/case_root.py +7 -1
  4. ansys/systemcoupling/core/adaptor/api_23_1/clear_state.py +4 -2
  5. ansys/systemcoupling/core/adaptor/api_23_1/show_plot.py +75 -0
  6. ansys/systemcoupling/core/adaptor/api_23_1/solution_root.py +7 -1
  7. ansys/systemcoupling/core/adaptor/api_23_2/_clear_state.py +13 -0
  8. ansys/systemcoupling/core/adaptor/api_23_2/case_root.py +7 -1
  9. ansys/systemcoupling/core/adaptor/api_23_2/clear_state.py +4 -2
  10. ansys/systemcoupling/core/adaptor/api_23_2/show_plot.py +75 -0
  11. ansys/systemcoupling/core/adaptor/api_23_2/solution_root.py +7 -1
  12. ansys/systemcoupling/core/adaptor/api_24_1/_clear_state.py +13 -0
  13. ansys/systemcoupling/core/adaptor/api_24_1/case_root.py +7 -1
  14. ansys/systemcoupling/core/adaptor/api_24_1/clear_state.py +4 -2
  15. ansys/systemcoupling/core/adaptor/api_24_1/show_plot.py +75 -0
  16. ansys/systemcoupling/core/adaptor/api_24_1/solution_root.py +7 -1
  17. ansys/systemcoupling/core/adaptor/api_24_2/_add_participant.py +80 -0
  18. ansys/systemcoupling/core/adaptor/api_24_2/_clear_state.py +13 -0
  19. ansys/systemcoupling/core/adaptor/api_24_2/_solve.py +13 -0
  20. ansys/systemcoupling/core/adaptor/api_24_2/abort.py +39 -0
  21. ansys/systemcoupling/core/adaptor/api_24_2/activate_hidden.py +46 -0
  22. ansys/systemcoupling/core/adaptor/api_24_2/add_aerodamping_data_transfers.py +43 -0
  23. ansys/systemcoupling/core/adaptor/api_24_2/add_data_transfer.py +190 -0
  24. ansys/systemcoupling/core/adaptor/api_24_2/add_data_transfer_by_display_names.py +191 -0
  25. ansys/systemcoupling/core/adaptor/api_24_2/add_expression_function.py +61 -0
  26. ansys/systemcoupling/core/adaptor/api_24_2/add_fsi_data_transfers.py +43 -0
  27. ansys/systemcoupling/core/adaptor/api_24_2/add_interface.py +77 -0
  28. ansys/systemcoupling/core/adaptor/api_24_2/add_interface_by_display_names.py +78 -0
  29. ansys/systemcoupling/core/adaptor/api_24_2/add_named_expression.py +42 -0
  30. ansys/systemcoupling/core/adaptor/api_24_2/add_ordered_data_transfers.py +32 -0
  31. ansys/systemcoupling/core/adaptor/api_24_2/add_participant.py +162 -0
  32. ansys/systemcoupling/core/adaptor/api_24_2/add_reference_frame.py +40 -0
  33. ansys/systemcoupling/core/adaptor/api_24_2/add_thermal_data_transfers.py +43 -0
  34. ansys/systemcoupling/core/adaptor/api_24_2/add_transformation.py +102 -0
  35. ansys/systemcoupling/core/adaptor/api_24_2/analysis_control.py +283 -0
  36. ansys/systemcoupling/core/adaptor/api_24_2/apip.py +33 -0
  37. ansys/systemcoupling/core/adaptor/api_24_2/ascii_output.py +44 -0
  38. ansys/systemcoupling/core/adaptor/api_24_2/attribute.py +20 -0
  39. ansys/systemcoupling/core/adaptor/api_24_2/attribute_child.py +54 -0
  40. ansys/systemcoupling/core/adaptor/api_24_2/automatic_alignment_options.py +46 -0
  41. ansys/systemcoupling/core/adaptor/api_24_2/available_ports.py +40 -0
  42. ansys/systemcoupling/core/adaptor/api_24_2/avoid_data_reconstruction.py +46 -0
  43. ansys/systemcoupling/core/adaptor/api_24_2/case_root.py +62 -0
  44. ansys/systemcoupling/core/adaptor/api_24_2/clear_state.py +18 -0
  45. ansys/systemcoupling/core/adaptor/api_24_2/connect_ensight_dvs.py +41 -0
  46. ansys/systemcoupling/core/adaptor/api_24_2/coupling_interface.py +20 -0
  47. ansys/systemcoupling/core/adaptor/api_24_2/coupling_interface_child.py +42 -0
  48. ansys/systemcoupling/core/adaptor/api_24_2/coupling_participant.py +23 -0
  49. ansys/systemcoupling/core/adaptor/api_24_2/coupling_participant_child.py +265 -0
  50. ansys/systemcoupling/core/adaptor/api_24_2/create_restart_point.py +29 -0
  51. ansys/systemcoupling/core/adaptor/api_24_2/data_transfer.py +20 -0
  52. ansys/systemcoupling/core/adaptor/api_24_2/data_transfer_child.py +187 -0
  53. ansys/systemcoupling/core/adaptor/api_24_2/delete_snapshot.py +28 -0
  54. ansys/systemcoupling/core/adaptor/api_24_2/delete_transformation.py +42 -0
  55. ansys/systemcoupling/core/adaptor/api_24_2/dimensionality.py +96 -0
  56. ansys/systemcoupling/core/adaptor/api_24_2/execution_control.py +246 -0
  57. ansys/systemcoupling/core/adaptor/api_24_2/execution_control_1.py +24 -0
  58. ansys/systemcoupling/core/adaptor/api_24_2/expression.py +20 -0
  59. ansys/systemcoupling/core/adaptor/api_24_2/expression_child.py +36 -0
  60. ansys/systemcoupling/core/adaptor/api_24_2/expression_function.py +20 -0
  61. ansys/systemcoupling/core/adaptor/api_24_2/expression_function_child.py +46 -0
  62. ansys/systemcoupling/core/adaptor/api_24_2/external_data_file.py +24 -0
  63. ansys/systemcoupling/core/adaptor/api_24_2/fluent_input.py +77 -0
  64. ansys/systemcoupling/core/adaptor/api_24_2/fmu_parameter.py +20 -0
  65. ansys/systemcoupling/core/adaptor/api_24_2/fmu_parameter_child.py +156 -0
  66. ansys/systemcoupling/core/adaptor/api_24_2/generate_input_file.py +41 -0
  67. ansys/systemcoupling/core/adaptor/api_24_2/get_add_data_transfer_group_commands.py +29 -0
  68. ansys/systemcoupling/core/adaptor/api_24_2/get_execution_command.py +30 -0
  69. ansys/systemcoupling/core/adaptor/api_24_2/get_machines.py +13 -0
  70. ansys/systemcoupling/core/adaptor/api_24_2/get_mode_shape_variables.py +29 -0
  71. ansys/systemcoupling/core/adaptor/api_24_2/get_region_names_for_participant.py +31 -0
  72. ansys/systemcoupling/core/adaptor/api_24_2/get_setup_summary.py +25 -0
  73. ansys/systemcoupling/core/adaptor/api_24_2/get_status_messages.py +52 -0
  74. ansys/systemcoupling/core/adaptor/api_24_2/get_supported_participant_types.py +13 -0
  75. ansys/systemcoupling/core/adaptor/api_24_2/get_thermal_data_transfer_options.py +32 -0
  76. ansys/systemcoupling/core/adaptor/api_24_2/get_transformation.py +43 -0
  77. ansys/systemcoupling/core/adaptor/api_24_2/global_stabilization.py +143 -0
  78. ansys/systemcoupling/core/adaptor/api_24_2/has_input_file_changed.py +36 -0
  79. ansys/systemcoupling/core/adaptor/api_24_2/import_system_coupling_input_file.py +36 -0
  80. ansys/systemcoupling/core/adaptor/api_24_2/initialize.py +27 -0
  81. ansys/systemcoupling/core/adaptor/api_24_2/instancing.py +23 -0
  82. ansys/systemcoupling/core/adaptor/api_24_2/instancing_child.py +62 -0
  83. ansys/systemcoupling/core/adaptor/api_24_2/interrupt.py +39 -0
  84. ansys/systemcoupling/core/adaptor/api_24_2/library.py +37 -0
  85. ansys/systemcoupling/core/adaptor/api_24_2/live_visualization.py +20 -0
  86. ansys/systemcoupling/core/adaptor/api_24_2/live_visualization_child.py +100 -0
  87. ansys/systemcoupling/core/adaptor/api_24_2/mapping_control.py +239 -0
  88. ansys/systemcoupling/core/adaptor/api_24_2/open.py +102 -0
  89. ansys/systemcoupling/core/adaptor/api_24_2/open_results_in_ensight.py +56 -0
  90. ansys/systemcoupling/core/adaptor/api_24_2/open_snapshot.py +37 -0
  91. ansys/systemcoupling/core/adaptor/api_24_2/output_control.py +134 -0
  92. ansys/systemcoupling/core/adaptor/api_24_2/parameter.py +20 -0
  93. ansys/systemcoupling/core/adaptor/api_24_2/parameter_child.py +56 -0
  94. ansys/systemcoupling/core/adaptor/api_24_2/partition_participants.py +138 -0
  95. ansys/systemcoupling/core/adaptor/api_24_2/properties.py +36 -0
  96. ansys/systemcoupling/core/adaptor/api_24_2/record_interactions.py +46 -0
  97. ansys/systemcoupling/core/adaptor/api_24_2/reference_frame.py +20 -0
  98. ansys/systemcoupling/core/adaptor/api_24_2/reference_frame_child.py +71 -0
  99. ansys/systemcoupling/core/adaptor/api_24_2/region.py +20 -0
  100. ansys/systemcoupling/core/adaptor/api_24_2/region_child.py +71 -0
  101. ansys/systemcoupling/core/adaptor/api_24_2/reload_expression_function_modules.py +14 -0
  102. ansys/systemcoupling/core/adaptor/api_24_2/results.py +89 -0
  103. ansys/systemcoupling/core/adaptor/api_24_2/save.py +51 -0
  104. ansys/systemcoupling/core/adaptor/api_24_2/save_snapshot.py +54 -0
  105. ansys/systemcoupling/core/adaptor/api_24_2/setup_root.py +251 -0
  106. ansys/systemcoupling/core/adaptor/api_24_2/show_plot.py +75 -0
  107. ansys/systemcoupling/core/adaptor/api_24_2/shutdown.py +25 -0
  108. ansys/systemcoupling/core/adaptor/api_24_2/side.py +20 -0
  109. ansys/systemcoupling/core/adaptor/api_24_2/side_child.py +56 -0
  110. ansys/systemcoupling/core/adaptor/api_24_2/solution_control.py +115 -0
  111. ansys/systemcoupling/core/adaptor/api_24_2/solution_root.py +122 -0
  112. ansys/systemcoupling/core/adaptor/api_24_2/solve.py +30 -0
  113. ansys/systemcoupling/core/adaptor/api_24_2/stabilization.py +157 -0
  114. ansys/systemcoupling/core/adaptor/api_24_2/start_participants.py +47 -0
  115. ansys/systemcoupling/core/adaptor/api_24_2/step.py +57 -0
  116. ansys/systemcoupling/core/adaptor/api_24_2/transformation.py +21 -0
  117. ansys/systemcoupling/core/adaptor/api_24_2/transformation_child.py +62 -0
  118. ansys/systemcoupling/core/adaptor/api_24_2/type.py +38 -0
  119. ansys/systemcoupling/core/adaptor/api_24_2/unmapped_value_options.py +158 -0
  120. ansys/systemcoupling/core/adaptor/api_24_2/update_control.py +43 -0
  121. ansys/systemcoupling/core/adaptor/api_24_2/update_participant.py +61 -0
  122. ansys/systemcoupling/core/adaptor/api_24_2/variable.py +20 -0
  123. ansys/systemcoupling/core/adaptor/api_24_2/variable_child.py +231 -0
  124. ansys/systemcoupling/core/adaptor/api_24_2/write_csv_chart_files.py +21 -0
  125. ansys/systemcoupling/core/adaptor/api_24_2/write_ensight.py +46 -0
  126. ansys/systemcoupling/core/adaptor/impl/injected_commands.py +228 -27
  127. ansys/systemcoupling/core/adaptor/impl/static_info.py +17 -0
  128. ansys/systemcoupling/core/adaptor/impl/syc_proxy.py +3 -0
  129. ansys/systemcoupling/core/adaptor/impl/syc_proxy_interface.py +4 -0
  130. ansys/systemcoupling/core/adaptor/impl/types.py +1 -1
  131. ansys/systemcoupling/core/charts/chart_datatypes.py +169 -0
  132. ansys/systemcoupling/core/charts/csv_chartdata.py +299 -0
  133. ansys/systemcoupling/core/charts/live_csv_datasource.py +87 -0
  134. ansys/systemcoupling/core/charts/message_dispatcher.py +84 -0
  135. ansys/systemcoupling/core/charts/plot_functions.py +92 -0
  136. ansys/systemcoupling/core/charts/plotdefinition_manager.py +303 -0
  137. ansys/systemcoupling/core/charts/plotter.py +343 -0
  138. ansys/systemcoupling/core/client/grpc_client.py +6 -1
  139. ansys/systemcoupling/core/participant/manager.py +25 -9
  140. ansys/systemcoupling/core/participant/protocol.py +1 -0
  141. ansys/systemcoupling/core/session.py +4 -4
  142. ansys/systemcoupling/core/syc_version.py +1 -1
  143. ansys/systemcoupling/core/util/file_transfer.py +4 -0
  144. ansys/systemcoupling/core/util/logging.py +1 -1
  145. {ansys_systemcoupling_core-0.4.1.dist-info → ansys_systemcoupling_core-0.6.dist-info}/METADATA +17 -16
  146. {ansys_systemcoupling_core-0.4.1.dist-info → ansys_systemcoupling_core-0.6.dist-info}/RECORD +148 -26
  147. {ansys_systemcoupling_core-0.4.1.dist-info → ansys_systemcoupling_core-0.6.dist-info}/LICENSE +0 -0
  148. {ansys_systemcoupling_core-0.4.1.dist-info → ansys_systemcoupling_core-0.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,231 @@
1
+ #
2
+ # This is an auto-generated file. DO NOT EDIT!
3
+ #
4
+
5
+ from ansys.systemcoupling.core.adaptor.impl.types import *
6
+
7
+ from .attribute import attribute
8
+
9
+
10
+ class variable_child(Container):
11
+ """
12
+ Configure a variable for the coupling participant.
13
+ """
14
+
15
+ syc_name = "child_object_type"
16
+
17
+ child_names = ["attribute"]
18
+
19
+ attribute: attribute = attribute
20
+ """
21
+ attribute child of variable_child.
22
+ """
23
+ property_names_types = [
24
+ ("quantity_type", "QuantityType", "str"),
25
+ ("location", "Location", "str"),
26
+ ("participant_display_name", "ParticipantDisplayName", "str"),
27
+ ("display_name", "DisplayName", "str"),
28
+ ("data_type", "DataType", "str"),
29
+ ("real_initial_value", "RealInitialValue", "RealType"),
30
+ ("integer_initial_value", "IntegerInitialValue", "int"),
31
+ ("logical_initial_value", "LogicalInitialValue", "bool"),
32
+ ("string_initial_value", "StringInitialValue", "str"),
33
+ ("enumeration_initial_value", "EnumerationInitialValue", "int"),
34
+ ("real_min", "RealMin", "RealType"),
35
+ ("real_max", "RealMax", "RealType"),
36
+ ("integer_min", "IntegerMin", "int"),
37
+ ("integer_max", "IntegerMax", "int"),
38
+ ("enumeration_min", "EnumerationMin", "int"),
39
+ ("enumeration_max", "EnumerationMax", "int"),
40
+ ("tensor_type", "TensorType", "str"),
41
+ ("is_extensive", "IsExtensive", "bool"),
42
+ ]
43
+
44
+ @property
45
+ def quantity_type(self) -> str:
46
+ """Quantity type of the variable.
47
+
48
+ Allowed values:
49
+
50
+ - \"Unspecified\"
51
+ - \"Force\"
52
+ - \"Incremental Displacement\"
53
+ - \"Temperature\"
54
+ - \"Heat Rate\"
55
+ - \"Heat Transfer Coefficient\"
56
+ - \"Convection Reference Temperature\"
57
+ - \"Mode Shape\"
58
+ - \"Electrical Conductivity\" """
59
+ return self.get_property_state("quantity_type")
60
+
61
+ @quantity_type.setter
62
+ def quantity_type(self, value: str):
63
+ self.set_property_state("quantity_type", value)
64
+
65
+ @property
66
+ def location(self) -> str:
67
+ """Data location of the variable (\"Node\" or \"Element\")."""
68
+ return self.get_property_state("location")
69
+
70
+ @location.setter
71
+ def location(self, value: str):
72
+ self.set_property_state("location", value)
73
+
74
+ @property
75
+ def participant_display_name(self) -> str:
76
+ """Variable's display name as defined by the participant solver."""
77
+ return self.get_property_state("participant_display_name")
78
+
79
+ @participant_display_name.setter
80
+ def participant_display_name(self, value: str):
81
+ self.set_property_state("participant_display_name", value)
82
+
83
+ @property
84
+ def display_name(self) -> str:
85
+ """Variable's display name as defined in System Coupling."""
86
+ return self.get_property_state("display_name")
87
+
88
+ @display_name.setter
89
+ def display_name(self, value: str):
90
+ self.set_property_state("display_name", value)
91
+
92
+ @property
93
+ def data_type(self) -> str:
94
+ """Variable's data type as reported by the participant.
95
+
96
+ Allowed values (non-FMU case):
97
+
98
+ - Real
99
+ - Complex
100
+
101
+ Allowed values (FMU):
102
+
103
+ - Real
104
+ - Integer
105
+ - Logical
106
+ - String
107
+ - Enumeration"""
108
+ return self.get_property_state("data_type")
109
+
110
+ @data_type.setter
111
+ def data_type(self, value: str):
112
+ self.set_property_state("data_type", value)
113
+
114
+ @property
115
+ def real_initial_value(self) -> RealType:
116
+ """Real data start value."""
117
+ return self.get_property_state("real_initial_value")
118
+
119
+ @real_initial_value.setter
120
+ def real_initial_value(self, value: RealType):
121
+ self.set_property_state("real_initial_value", value)
122
+
123
+ @property
124
+ def integer_initial_value(self) -> int:
125
+ """Integer data start value."""
126
+ return self.get_property_state("integer_initial_value")
127
+
128
+ @integer_initial_value.setter
129
+ def integer_initial_value(self, value: int):
130
+ self.set_property_state("integer_initial_value", value)
131
+
132
+ @property
133
+ def logical_initial_value(self) -> bool:
134
+ """Logical data start value."""
135
+ return self.get_property_state("logical_initial_value")
136
+
137
+ @logical_initial_value.setter
138
+ def logical_initial_value(self, value: bool):
139
+ self.set_property_state("logical_initial_value", value)
140
+
141
+ @property
142
+ def string_initial_value(self) -> str:
143
+ """String data start value."""
144
+ return self.get_property_state("string_initial_value")
145
+
146
+ @string_initial_value.setter
147
+ def string_initial_value(self, value: str):
148
+ self.set_property_state("string_initial_value", value)
149
+
150
+ @property
151
+ def enumeration_initial_value(self) -> int:
152
+ """Enumeration data start value."""
153
+ return self.get_property_state("enumeration_initial_value")
154
+
155
+ @enumeration_initial_value.setter
156
+ def enumeration_initial_value(self, value: int):
157
+ self.set_property_state("enumeration_initial_value", value)
158
+
159
+ @property
160
+ def real_min(self) -> RealType:
161
+ """Real data minimum value."""
162
+ return self.get_property_state("real_min")
163
+
164
+ @real_min.setter
165
+ def real_min(self, value: RealType):
166
+ self.set_property_state("real_min", value)
167
+
168
+ @property
169
+ def real_max(self) -> RealType:
170
+ """Real data maximum value."""
171
+ return self.get_property_state("real_max")
172
+
173
+ @real_max.setter
174
+ def real_max(self, value: RealType):
175
+ self.set_property_state("real_max", value)
176
+
177
+ @property
178
+ def integer_min(self) -> int:
179
+ """Integer data minimum value."""
180
+ return self.get_property_state("integer_min")
181
+
182
+ @integer_min.setter
183
+ def integer_min(self, value: int):
184
+ self.set_property_state("integer_min", value)
185
+
186
+ @property
187
+ def integer_max(self) -> int:
188
+ """Integer data maximum value."""
189
+ return self.get_property_state("integer_max")
190
+
191
+ @integer_max.setter
192
+ def integer_max(self, value: int):
193
+ self.set_property_state("integer_max", value)
194
+
195
+ @property
196
+ def enumeration_min(self) -> int:
197
+ """Enumeration data minimum value."""
198
+ return self.get_property_state("enumeration_min")
199
+
200
+ @enumeration_min.setter
201
+ def enumeration_min(self, value: int):
202
+ self.set_property_state("enumeration_min", value)
203
+
204
+ @property
205
+ def enumeration_max(self) -> int:
206
+ """Enumeration data maximum value."""
207
+ return self.get_property_state("enumeration_max")
208
+
209
+ @enumeration_max.setter
210
+ def enumeration_max(self, value: int):
211
+ self.set_property_state("enumeration_max", value)
212
+
213
+ @property
214
+ def tensor_type(self) -> str:
215
+ """Indicates the variable tensor type (\"Scalar\" or \"Vector\").
216
+
217
+ \"Vector\" is not supported for the FMU case."""
218
+ return self.get_property_state("tensor_type")
219
+
220
+ @tensor_type.setter
221
+ def tensor_type(self, value: str):
222
+ self.set_property_state("tensor_type", value)
223
+
224
+ @property
225
+ def is_extensive(self) -> bool:
226
+ """Indicates whether this is an extensive property."""
227
+ return self.get_property_state("is_extensive")
228
+
229
+ @is_extensive.setter
230
+ def is_extensive(self, value: bool):
231
+ self.set_property_state("is_extensive", value)
@@ -0,0 +1,21 @@
1
+ #
2
+ # This is an auto-generated file. DO NOT EDIT!
3
+ #
4
+
5
+ from ansys.systemcoupling.core.adaptor.impl.types import *
6
+
7
+
8
+ class write_csv_chart_files(Command):
9
+ """
10
+ For each coupling interface, exports a CSV file containing chart data
11
+ (convergence and source/target quantity transfer values) for
12
+ that interface.
13
+
14
+ Each file is named according to the convention ``<interface>.csv``, where
15
+ ``<interface>`` is the object name of the corresponding coupling interface.
16
+
17
+ This command will overwrite any CSV charting files that already exist,
18
+ including any that were written during the solution.
19
+ """
20
+
21
+ syc_name = "WriteCsvChartFiles"
@@ -0,0 +1,46 @@
1
+ #
2
+ # This is an auto-generated file. DO NOT EDIT!
3
+ #
4
+
5
+ from ansys.systemcoupling.core.adaptor.impl.types import *
6
+
7
+
8
+ class write_ensight(Command):
9
+ """
10
+ Write a file with mesh and results which can be loaded into Ensight for
11
+ post processing.
12
+
13
+ Parameters
14
+ ----------
15
+ file_name : str
16
+ Base name for Ensight files. It will generate <base>.encas file which
17
+ should be loaded into Ensight. Other files are generated for geometry
18
+ and variables.
19
+ binary : bool, optional
20
+ To control if file is to be written in binary format or ASCII. ASCII
21
+ slows down performance, but may be useful for debugging and seeing
22
+ raw data.
23
+
24
+ """
25
+
26
+ syc_name = "WriteEnSight"
27
+
28
+ argument_names = ["file_name", "binary"]
29
+
30
+ class file_name(String):
31
+ """
32
+ Base name for Ensight files. It will generate <base>.encas file which
33
+ should be loaded into Ensight. Other files are generated for geometry
34
+ and variables.
35
+ """
36
+
37
+ syc_name = "FileName"
38
+
39
+ class binary(Boolean):
40
+ """
41
+ To control if file is to be written in binary format or ASCII. ASCII
42
+ slows down performance, but may be useful for debugging and seeing
43
+ raw data.
44
+ """
45
+
46
+ syc_name = "Binary"
@@ -21,55 +21,108 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  from copy import deepcopy
24
- from typing import Callable, Dict
25
-
24
+ import os
25
+ import random
26
+ import time
27
+ from typing import Callable, Dict, Optional, Protocol
28
+
29
+ import ansys.platform.instancemanagement as pypim
30
+
31
+ from ansys.systemcoupling.core.charts.plot_functions import create_and_show_plot
32
+ from ansys.systemcoupling.core.charts.plotdefinition_manager import (
33
+ DataTransferSpec,
34
+ InterfaceSpec,
35
+ PlotSpec,
36
+ )
37
+ from ansys.systemcoupling.core.native_api import NativeApi
26
38
  from ansys.systemcoupling.core.participant.manager import ParticipantManager
27
39
  from ansys.systemcoupling.core.participant.mapdl import MapdlSystemCouplingInterface
28
- from ansys.systemcoupling.core.syc_version import compare_versions
29
40
  from ansys.systemcoupling.core.util.yaml_helper import yaml_load_from_string
30
41
 
31
42
  from .get_status_messages import get_status_messages
32
43
  from .types import Container
33
44
 
34
45
 
46
+ # We cannot import Session directly, so define a protocol for typing.
47
+ # We mainly use it as a means of accessing the "API roots".
48
+ class SessionProtocol(Protocol):
49
+ case: Container
50
+ setup: Container
51
+ solution: Container
52
+ _native_api: NativeApi
53
+
54
+ def download_file(
55
+ self, file_name: str, local_file_dir: str = ".", overwrite: bool = False
56
+ ) -> None: ...
57
+
58
+ def upload_file(
59
+ self,
60
+ file_name: str,
61
+ remote_file_name: Optional[str] = None,
62
+ overwrite: bool = False,
63
+ ) -> None: ...
64
+
65
+
35
66
  def get_injected_cmd_map(
36
- version: str,
37
67
  category: str,
38
- root_object: Container,
68
+ session: SessionProtocol,
39
69
  part_mgr: ParticipantManager,
40
70
  rpc,
41
71
  ) -> Dict[str, Callable]:
42
- """Gets a dictionary that maps names to functions that implement the injected command.
43
-
44
- The map returned pertains to the commands in the specified category.
72
+ """Get a dictionary mapping names to functions that implement injected commands
73
+ for the specified API category.
74
+
75
+ Whereas the set of commands that exists by default on the API represents a relatively
76
+ mechanical exposure of native System Coupling commands to PySystemCoupling, the
77
+ "injected commands" that are returned from here are either *additional* commands
78
+ that have no counterpart in System Coupling or *overrides* to existing commands
79
+ that provide modified or extended behavior.
45
80
  """
46
81
  ret = {}
47
82
 
48
83
  if category == "setup":
84
+ # ``get_injected_cmd_map`` needs to be called during initialisation, where
85
+ # the session API roots are not necessarily available yet. We therefore
86
+ # defer their access via the lambda.
87
+ get_setup_root_object = lambda: session.setup
49
88
  ret = {
50
89
  "get_setup_summary": lambda **kwargs: rpc.GetSetupSummary(**kwargs),
51
90
  "get_status_messages": lambda **kwargs: get_status_messages(
52
- rpc, root_object, **kwargs
91
+ rpc, get_setup_root_object(), **kwargs
53
92
  ),
54
93
  "add_participant": lambda **kwargs: _wrap_add_participant(
55
- version, root_object, part_mgr, **kwargs
94
+ session, part_mgr, **kwargs
56
95
  ),
57
96
  }
58
97
 
59
98
  if category == "solution":
99
+ get_solution_root_object = lambda: session.solution
100
+ get_setup_root_object = lambda: session.setup
60
101
  ret = {
61
- "solve": lambda **kwargs: _wrap_solve(root_object, part_mgr, **kwargs),
102
+ "solve": lambda **kwargs: _wrap_solve(
103
+ get_solution_root_object(), part_mgr, **kwargs
104
+ ),
62
105
  "interrupt": lambda **kwargs: rpc.interrupt(**kwargs),
63
106
  "abort": lambda **kwargs: rpc.abort(**kwargs),
107
+ "show_plot": lambda **kwargs: _show_plot(session, **kwargs),
108
+ }
109
+
110
+ if category == "case":
111
+ get_case_root_object = lambda: session.case
112
+ ret = {
113
+ "clear_state": lambda **kwargs: _wrap_clear_state(
114
+ get_case_root_object(), part_mgr, **kwargs
115
+ )
64
116
  }
65
117
 
66
118
  return ret
67
119
 
68
120
 
69
121
  def _wrap_add_participant(
70
- server_version: str, root_object: Container, part_mgr: ParticipantManager, **kwargs
122
+ session: SessionProtocol, part_mgr: ParticipantManager, **kwargs
71
123
  ) -> str:
72
- if session := kwargs.get("participant_session", None):
124
+ setup = session.setup
125
+ if participant_session := kwargs.get("participant_session", None):
73
126
  if len(kwargs) != 1:
74
127
  raise RuntimeError(
75
128
  "If a 'participant_session' argument is passed to "
@@ -78,39 +131,124 @@ def _wrap_add_participant(
78
131
  if part_mgr is None:
79
132
  raise RuntimeError("Internal error: participant manager is not available.")
80
133
 
81
- if compare_versions(server_version, "24.1") < 0:
82
- raise RuntimeError(
83
- f"System Coupling server version '{server_version}' is too low to"
84
- "support this form of 'add_participant'. Minimum version is '24.1'."
85
- )
86
-
87
134
  # special handling for mapdl session
88
- if "ansys.mapdl.core.mapdl_grpc.MapdlGrpc" in str(type(session)):
135
+ if "ansys.mapdl.core.mapdl_grpc.MapdlGrpc" in str(type(participant_session)):
89
136
  return part_mgr.add_participant(
90
- participant_session=MapdlSystemCouplingInterface(session)
137
+ participant_session=MapdlSystemCouplingInterface(participant_session)
91
138
  )
92
139
 
93
- if not hasattr(session, "system_coupling"):
140
+ if not hasattr(participant_session, "system_coupling"):
94
141
  raise RuntimeError(
95
142
  "The 'participant_session' parameter does not provide a "
96
143
  "'system_coupling' attribute and therefore cannot support this "
97
144
  "form of 'add_participant'."
98
145
  )
146
+ return part_mgr.add_participant(
147
+ participant_session=participant_session.system_coupling
148
+ )
149
+
150
+ if input_file := kwargs.get("input_file", None):
151
+ session.upload_file(input_file)
99
152
 
100
- return part_mgr.add_participant(participant_session=session.system_coupling)
153
+ return setup._add_participant(**kwargs)
101
154
 
102
- return root_object._add_participant(**kwargs)
103
155
 
156
+ def _wrap_clear_state(case: Container, part_mgr: ParticipantManager, **kwargs) -> None:
157
+ part_mgr.clear()
158
+ case._clear_state(**kwargs)
104
159
 
105
- def _wrap_solve(root_object: Container, part_mgr: ParticipantManager) -> None:
160
+
161
+ def _wrap_solve(solution: Container, part_mgr: ParticipantManager) -> None:
106
162
  if part_mgr is None:
107
- root_object._solve()
163
+ solution._solve()
108
164
  else:
109
165
  part_mgr.solve()
110
166
 
111
167
 
168
+ def _ensure_file_available(session: SessionProtocol, filepath: str) -> str:
169
+ """If we are in a "PIM" session, copies the file specified by ``filepath``
170
+ into the working directory, so that it is available for download.
171
+
172
+ A suffix is added to the name of the copy to make the name unique, and
173
+ the new name is returned.
174
+ """
175
+ # Note: it is a general issue with files in a PIM session that they can
176
+ # only be uploaded to/downloaded from the root working directory. We
177
+ # might want to consider integrating something like this directly into
178
+ # the file_transfer module later so that it is more seamless.
179
+
180
+ if not pypim.is_configured():
181
+ return filepath
182
+
183
+ # Copy file to a unique name in the working directory
184
+ file_name = os.path.basename(filepath)
185
+ root_name, _, ext = file_name.rpartition(".")
186
+ ext = f".{ext}" if ext else ""
187
+ new_name = f"{root_name}_{int(time.time())}_{random.randint(1, 10000000)}{ext}"
188
+
189
+ session._native_api.ExecPythonString(
190
+ PythonString=f"import shutil\nshutil.copy('{filepath}', '{new_name}')"
191
+ )
192
+
193
+ session.download_file(new_name, ".")
194
+ return new_name
195
+
196
+
197
+ def _show_plot(session: SessionProtocol, **kwargs):
198
+ setup = session.setup
199
+ working_dir = kwargs.pop("working_dir", ".")
200
+ interface_name = kwargs.pop("interface_name", None)
201
+ if interface_name is None:
202
+ interfaces = setup.coupling_interface.get_object_names()
203
+ if len(interfaces) == 0:
204
+ return
205
+ if len(interfaces) > 1:
206
+ raise RuntimeError(
207
+ "show_plot() currently only supports a single interface."
208
+ )
209
+ interface_name = interfaces[0]
210
+ interface_object = setup.coupling_interface[interface_name]
211
+ interface_disp_name = interface_object.display_name
212
+
213
+ if (transfer_names := kwargs.pop("transfer_names", None)) is None:
214
+ transfer_names = interface_object.data_transfer.get_object_names()
215
+
216
+ if len(transfer_names) == 0:
217
+ return None
218
+
219
+ transfer_disp_names = [
220
+ interface_object.data_transfer[trans_name].display_name
221
+ for trans_name in transfer_names
222
+ ]
223
+
224
+ show_convergence = kwargs.pop("show_convergence", True)
225
+ show_transfer_values = kwargs.pop("show_transfer_values", True)
226
+
227
+ # TODO : better way to do this?
228
+ is_transient = setup.solution_control.time_step_size is not None
229
+
230
+ file_path = _ensure_file_available(
231
+ session, os.path.join(working_dir, "SyC", f"{interface_name}.csv")
232
+ )
233
+
234
+ spec = PlotSpec()
235
+ intf_spec = InterfaceSpec(interface_name, interface_disp_name)
236
+ spec.interfaces.append(intf_spec)
237
+ for transfer in transfer_disp_names:
238
+ intf_spec.transfers.append(
239
+ DataTransferSpec(
240
+ display_name=transfer,
241
+ show_convergence=show_convergence,
242
+ show_transfer_values=show_transfer_values,
243
+ )
244
+ )
245
+ spec.plot_time = is_transient
246
+
247
+ return create_and_show_plot(spec, [file_path])
248
+
249
+
112
250
  def get_injected_cmd_data() -> list:
113
- """Gets a list of injected command data in the right form to insert
251
+ """Get a list of injected command data in the right form to insert
114
252
  at a convenient point in the current processing.
115
253
 
116
254
  Because the data returned data is always a new copy, it can be manipulated at will.
@@ -309,4 +447,67 @@ _cmd_yaml = """
309
447
  essentialArgNames: []
310
448
  optionalArgNames: []
311
449
  args: []
450
+ - name: ClearState
451
+ pyname: clear_state
452
+ isInjected: true
453
+ pysyc_internal_name: _clear_state
454
+ - name: show_plot
455
+ pyname: show_plot
456
+ exposure: solution
457
+ isInjected: true
458
+ isQuery: false
459
+ retType: <class 'NoneType'>
460
+ doc: |-
461
+ Shows plots of transfer values and convergence for data transfers
462
+ of a coupling interface.
463
+
464
+ essentialArgNames:
465
+ - interface_name
466
+ optionalArgNames:
467
+ - transfer_names
468
+ - working_dir
469
+ - show_convergence
470
+ - show_transfer_values
471
+ defaults:
472
+ - None
473
+ - "."
474
+ - True
475
+ - True
476
+ args:
477
+ - #!!python/tuple
478
+ - interface_name
479
+ - pyname: interface_name
480
+ Type: <class 'str'>
481
+ type: String
482
+ doc: |-
483
+ Specification of which interface to plot.
484
+ - #!!python/tuple
485
+ - transfer_names
486
+ - pyname: transfer_names
487
+ Type: <class 'list'>
488
+ type: String List
489
+ doc: |-
490
+ Specification of which data transfers to plot. Defaults
491
+ to ``None``, which means plot all data transfers.
492
+ - #!!python/tuple
493
+ - working_dir
494
+ - pyname: working_dir
495
+ Type: <class 'str'>
496
+ type: String
497
+ doc: |-
498
+ Working directory (defaults = ".").
499
+ - #!!python/tuple
500
+ - show_convergence
501
+ - pyname: show_convergence
502
+ Type: <class 'bool'>
503
+ type: Logical
504
+ doc: |-
505
+ Whether to show convergence plots (defaults to ``True``).
506
+ - #!!python/tuple
507
+ - show_transfer_values
508
+ - pyname: show_transfer_values
509
+ Type: <class 'bool'>
510
+ type: Logical
511
+ doc: |-
512
+ Whether to show transfer value plots (defaults to ``True``).
312
513
  """
@@ -23,6 +23,7 @@
23
23
  from copy import deepcopy
24
24
  from typing import Dict, List, Tuple
25
25
 
26
+ from ansys.systemcoupling.core.adaptor.impl.get_syc_version import get_syc_version
26
27
  from ansys.systemcoupling.core.adaptor.impl.injected_commands import (
27
28
  get_injected_cmd_data,
28
29
  )
@@ -310,6 +311,21 @@ def get_extended_cmd_metadata(api) -> list:
310
311
  Object providing access to the System Coupling *native API*.
311
312
  """
312
313
 
314
+ def fix_up_doc(cmd_metadata):
315
+ if get_syc_version(api) != "24.2":
316
+ return cmd_metadata
317
+
318
+ # There is a bug in doc text queried from 24.2 SyC. The "*" need
319
+ # to be escaped to avoid issues in Sphinx. This can be a surgical
320
+ # fix because 24.2 is frozen now.
321
+ for cmd in cmd_metadata:
322
+ if cmd["pyname"] == "add_participant":
323
+ add_part_cmd = cmd
324
+ for arg_name, arg_info in add_part_cmd["args"]:
325
+ if arg_name == "InputFile":
326
+ arg_info["doc"] = arg_info["doc"].replace("*", r"\*")
327
+ return cmd_metadata
328
+
313
329
  def find_item_by_name(items: List[Dict], name: str) -> dict:
314
330
  for item in items:
315
331
  if item["name"] == name:
@@ -400,4 +416,5 @@ def get_extended_cmd_metadata(api) -> list:
400
416
  cmd_metadata = get_cmd_metadata(api)
401
417
  injected_data = get_injected_cmd_data()
402
418
  merge_data(cmd_metadata, injected_data)
419
+ cmd_metadata = fix_up_doc(cmd_metadata)
403
420
  return cmd_metadata
@@ -89,6 +89,9 @@ class SycProxy(SycProxyInterface):
89
89
  return adapt_native_named_object_keys(state)
90
90
  return state
91
91
 
92
+ def get_property_state(self, path, property):
93
+ return self.__rpc.GetParameter(ObjectPath=path, Name=property)
94
+
92
95
  def delete(self, path):
93
96
  self.__rpc.DeleteObject(ObjectPath=path)
94
97
 
@@ -48,6 +48,10 @@ class SycProxyInterface(ABC): # pragma: no cover
48
48
  def get_state(self, path):
49
49
  pass
50
50
 
51
+ @abstractmethod
52
+ def get_property_state(self, path, name):
53
+ pass
54
+
51
55
  @abstractmethod
52
56
  def delete(self, path):
53
57
  pass