ansys-speos-core 0.7.0__py3-none-any.whl → 0.7.2__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.
Files changed (47) hide show
  1. ansys/speos/core/__init__.py +1 -1
  2. ansys/speos/core/body.py +1 -1
  3. ansys/speos/core/bsdf.py +1 -1
  4. ansys/speos/core/face.py +1 -1
  5. ansys/speos/core/generic/constants.py +1 -1
  6. ansys/speos/core/generic/general_methods.py +1 -1
  7. ansys/speos/core/generic/visualization_methods.py +1 -1
  8. ansys/speos/core/geo_ref.py +1 -1
  9. ansys/speos/core/ground_plane.py +247 -0
  10. ansys/speos/core/intensity.py +1 -1
  11. ansys/speos/core/kernel/__init__.py +1 -1
  12. ansys/speos/core/kernel/body.py +1 -1
  13. ansys/speos/core/kernel/client.py +1 -1
  14. ansys/speos/core/kernel/crud.py +1 -1
  15. ansys/speos/core/kernel/face.py +1 -1
  16. ansys/speos/core/kernel/grpc/transport_options.py +1 -1
  17. ansys/speos/core/kernel/intensity_template.py +1 -1
  18. ansys/speos/core/kernel/job.py +1 -1
  19. ansys/speos/core/kernel/part.py +1 -1
  20. ansys/speos/core/kernel/proto_message_utils.py +1 -1
  21. ansys/speos/core/kernel/scene.py +1 -1
  22. ansys/speos/core/kernel/sensor_template.py +1 -1
  23. ansys/speos/core/kernel/simulation_template.py +1 -1
  24. ansys/speos/core/kernel/sop_template.py +1 -1
  25. ansys/speos/core/kernel/source_template.py +1 -1
  26. ansys/speos/core/kernel/spectrum.py +1 -1
  27. ansys/speos/core/kernel/vop_template.py +1 -1
  28. ansys/speos/core/launcher.py +5 -2
  29. ansys/speos/core/logger.py +1 -1
  30. ansys/speos/core/lxp.py +1 -1
  31. ansys/speos/core/opt_prop.py +1 -1
  32. ansys/speos/core/part.py +1 -1
  33. ansys/speos/core/project.py +98 -14
  34. ansys/speos/core/proto_message_utils.py +1 -1
  35. ansys/speos/core/sensor.py +1 -1
  36. ansys/speos/core/simulation.py +1394 -127
  37. ansys/speos/core/source.py +730 -2
  38. ansys/speos/core/spectrum.py +1 -1
  39. ansys/speos/core/speos.py +1 -1
  40. ansys/speos/core/workflow/__init__.py +1 -1
  41. ansys/speos/core/workflow/combine_speos.py +1 -1
  42. ansys/speos/core/workflow/open_result.py +1 -1
  43. {ansys_speos_core-0.7.0.dist-info → ansys_speos_core-0.7.2.dist-info}/METADATA +6 -6
  44. ansys_speos_core-0.7.2.dist-info/RECORD +47 -0
  45. {ansys_speos_core-0.7.0.dist-info → ansys_speos_core-0.7.2.dist-info}/licenses/LICENSE +1 -1
  46. ansys_speos_core-0.7.0.dist-info/RECORD +0 -46
  47. {ansys_speos_core-0.7.0.dist-info → ansys_speos_core-0.7.2.dist-info}/WHEEL +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
ansys/speos/core/body.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
ansys/speos/core/bsdf.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
ansys/speos/core/face.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -0,0 +1,247 @@
1
+ # Copyright (C) 2021 - 2026 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
+ """Provides a way to interact with Speos feature: ground plane."""
23
+
24
+ from __future__ import annotations
25
+
26
+ from difflib import SequenceMatcher
27
+ from typing import List, Optional
28
+
29
+ from ansys.speos.core.kernel.scene import ProtoScene
30
+ import ansys.speos.core.project as project
31
+ import ansys.speos.core.proto_message_utils as proto_message_utils
32
+
33
+
34
+ class GroundPlane:
35
+ """Speos feature: ground plane.
36
+
37
+ Only usable when there is at least one Ambient Environment Source in the project.
38
+
39
+ Parameters
40
+ ----------
41
+ project : project.Project
42
+ Project that will own the feature.
43
+ """
44
+
45
+ def __init__(self, project: project.Project, ground: Optional[ProtoScene.GroundPlane] = None):
46
+ self._project = project
47
+ self._name = ""
48
+
49
+ if ground is None:
50
+ # Create local ground
51
+ self._ground = ProtoScene.GroundPlane()
52
+ self.ground_origin = [0.0, 0.0, 0.0]
53
+ self.ground_zenith = [0.0, 0.0, 1.0]
54
+ self.ground_height = 1000.0
55
+ self._committed = False
56
+ else:
57
+ # Retrieve ground from input
58
+ self._committed = True
59
+ self._ground = ground
60
+
61
+ @property
62
+ def ground_origin(self) -> List[float]:
63
+ """Ground origin.
64
+
65
+ This property gets and sets the origin of the ground plane.
66
+ Default as [0, 0, 0]
67
+
68
+ Parameters
69
+ ----------
70
+ value: List[float]
71
+ Ground origin.
72
+
73
+ Returns
74
+ -------
75
+ List[float]
76
+ Ground origin.
77
+ """
78
+ return self._ground.ground_origin
79
+
80
+ @ground_origin.setter
81
+ def ground_origin(self, value: List[float]) -> None:
82
+ self._ground.ground_origin[:] = value
83
+
84
+ @property
85
+ def ground_zenith(self) -> List[float]:
86
+ """Zenith direction.
87
+
88
+ This property gets and sets the zenith direction of the ground plane.
89
+ Default as [0, 0, 1]
90
+
91
+ Parameters
92
+ ----------
93
+ value: List[float]
94
+ Zenith direction.
95
+
96
+ Returns
97
+ -------
98
+ List[float]
99
+ Zenith direction.
100
+ """
101
+ return self._ground.zenith_direction
102
+
103
+ @ground_zenith.setter
104
+ def ground_zenith(self, value: List[float]) -> None:
105
+ self._ground.zenith_direction[:] = value
106
+
107
+ @property
108
+ def ground_height(self) -> float:
109
+ """Ground height.
110
+
111
+ This property gets and sets the height of the ground plane.
112
+ Default as 1000.0
113
+
114
+ Parameters
115
+ ----------
116
+ value: float
117
+ Ground height.
118
+
119
+ Returns
120
+ -------
121
+ float
122
+ Ground height.
123
+ """
124
+ return self._ground.ground_height
125
+
126
+ @ground_height.setter
127
+ def ground_height(self, value: float) -> None:
128
+ self._ground.ground_height = value
129
+
130
+ def _to_dict(self) -> dict:
131
+ out_dict = {}
132
+
133
+ if self._project.scene_link:
134
+ scene_data = self._project.scene_link.get()
135
+
136
+ if self._committed:
137
+ out_dict = proto_message_utils._replace_guids(
138
+ speos_client=self._project.client, message=scene_data.ground
139
+ )
140
+ else:
141
+ out_dict = proto_message_utils._replace_guids(
142
+ speos_client=self._project.client, message=self._ground
143
+ )
144
+ else:
145
+ out_dict = proto_message_utils._replace_guids(
146
+ speos_client=self._project.client, message=self._ground
147
+ )
148
+
149
+ proto_message_utils._replace_properties(json_dict=out_dict)
150
+
151
+ return out_dict
152
+
153
+ def get(self, key: str = "") -> str | dict:
154
+ """Get dictionary corresponding to the ground plane - read only.
155
+
156
+ Parameters
157
+ ----------
158
+ key: str
159
+
160
+ Returns
161
+ -------
162
+ str | dict
163
+ """
164
+ if key == "":
165
+ return self._to_dict()
166
+ info = proto_message_utils._value_finder_key_startswith(dict_var=self._to_dict(), key=key)
167
+ content = list(info)
168
+ if len(content) != 0:
169
+ content.sort(
170
+ key=lambda x: SequenceMatcher(None, x[0], key).ratio(),
171
+ reverse=True,
172
+ )
173
+ return content[0][1]
174
+ info = proto_message_utils._flatten_dict(dict_var=self._to_dict())
175
+ print("Used key: {} not found in key list: {}.".format(key, info.keys()))
176
+
177
+ def __str__(self):
178
+ """Return the string representation of the ground plane property."""
179
+ out_str = ""
180
+
181
+ if self._project.scene_link:
182
+ if not self._committed:
183
+ out_str += "local: "
184
+ else:
185
+ out_str += "local: "
186
+
187
+ out_str += proto_message_utils.dict_to_str(dict=self._to_dict())
188
+ return out_str
189
+
190
+ def commit(self) -> GroundPlane:
191
+ """Save feature: send the local data to the speos server database.
192
+
193
+ Returns
194
+ -------
195
+ ansys.speos.core.ground_plane.GroundPlane
196
+ Ground plane feature.
197
+ """
198
+ # This boolean allows to keep track if the ground plane is committed
199
+ self._committed = True
200
+
201
+ # Update the scene with the ground plane
202
+ if self._project.scene_link:
203
+ scene_data = self._project.scene_link.get() # retrieve scene data
204
+
205
+ # In case the ground is different from what is stored on server -> update
206
+ if scene_data.ground != self._ground:
207
+ scene_data.ground.CopyFrom(self._ground)
208
+ self._project.scene_link.set(data=scene_data) # update scene data
209
+
210
+ return self
211
+
212
+ def reset(self) -> GroundPlane:
213
+ """Reset feature: override local data by the one from the speos server database.
214
+
215
+ Returns
216
+ -------
217
+ ansys.speos.core.ground_plane.GroundPlane
218
+ Ground plane feature.
219
+ """
220
+ # Reset ground plane
221
+ if self._project.scene_link is not None:
222
+ scene_data = self._project.scene_link.get() # retrieve scene data
223
+ self._ground = scene_data.ground # store locally the ground from server data
224
+
225
+ return self
226
+
227
+ def delete(self) -> GroundPlane:
228
+ """Delete feature: delete data from the speos server database.
229
+
230
+ The local data are still available
231
+
232
+ Returns
233
+ -------
234
+ ansys.speos.core.ground_plane.GroundPlane
235
+ Ground plane feature.
236
+ """
237
+ # Remove the ground from the scene
238
+ scene_data = self._project.scene_link.get() # retrieve scene data
239
+
240
+ if scene_data.HasField("ground"):
241
+ scene_data.ClearField("ground")
242
+ self._project.scene_link.set(data=scene_data) # update scene data
243
+
244
+ # _committed to false -> this feature is no longer committed
245
+ self._committed = False
246
+
247
+ return self
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -101,7 +101,10 @@ def launch_remote_speos(
101
101
  pim = pypim.connect()
102
102
  instance = pim.create_instance(product_name="speos", product_version=version)
103
103
  instance.wait_for_ready()
104
- channel = instance.build_grpc_channel()
104
+ # build_grpc_channel() returns an grpc._interceptor._Channel
105
+ # As we need a grpc.Channel in Speos object -> build_grpc_channel()._channel
106
+ # Not doing that was leading to issue when trying to find the target() of the channel.
107
+ channel = instance.build_grpc_channel()._channel
105
108
  return Speos(channel=channel, remote_instance=instance)
106
109
 
107
110
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
ansys/speos/core/lxp.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #
ansys/speos/core/part.py CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2021 - 2025 ANSYS, Inc. and/or its affiliates.
1
+ # Copyright (C) 2021 - 2026 ANSYS, Inc. and/or its affiliates.
2
2
  # SPDX-License-Identifier: MIT
3
3
  #
4
4
  #