Skip to content

Commit 1de6775

Browse files
fix: retro of result_coordinate_system for DPF < 251.1.pre1 (#2555)
Co-authored-by: PyAnsys CI Bot <[email protected]>
1 parent aff43d9 commit 1de6775

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/ansys/dpf/core/operators/build.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"NMISC": "mapdl::nmisc",
2424
"SMISC": "mapdl::smisc",
2525
"result_provider": "custom",
26+
"CS": "mapdl::rst::CS",
2627
}
2728

2829
def build_docstring(specification_description):

src/ansys/dpf/core/operators/operator.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class {{class_name}}(Operator):
9393
try:
9494
super().__init__(name="{{operator_name}}", config=config, server=server)
9595
except (KeyError, errors.DPFServerException) as e:
96-
if "doesn't exist in the registry" in str(e):
96+
if "doesn't exist" in str(e):
9797
super().__init__(name="{{internal_name_alias}}", config=config, server=server)
9898
else:
9999
raise e

src/ansys/dpf/core/operators/result/coordinate_system.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from __future__ import annotations
88

99
from warnings import warn
10+
from ansys.dpf.core.core import errors
1011
from ansys.dpf.core.dpf_operator import Operator
1112
from ansys.dpf.core.inputs import Input, _Inputs
1213
from ansys.dpf.core.outputs import Output, _Outputs
@@ -64,7 +65,13 @@ def __init__(
6465
config=None,
6566
server=None,
6667
):
67-
super().__init__(name="CS", config=config, server=server)
68+
try:
69+
super().__init__(name="CS", config=config, server=server)
70+
except (KeyError, errors.DPFServerException) as e:
71+
if "doesn't exist" in str(e):
72+
super().__init__(name="mapdl::rst::CS", config=config, server=server)
73+
else:
74+
raise e
6875
self._inputs = InputsCoordinateSystem(self)
6976
self._outputs = OutputsCoordinateSystem(self)
7077
if cs_id is not None:

tests/operators/test_coordinate_system.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,8 @@
3030

3131
def test_operator_coordinate_system_rst(server_type):
3232
model = dpf.Model(examples.download_hemisphere(server=server_type), server=server_type)
33-
if conftest.SERVERS_VERSION_GREATER_THAN_OR_EQUAL_TO_9_1:
34-
# Starting with DPF 2025.1.pre1
35-
cs = dpf.operators.result.coordinate_system(server=server_type)
36-
cs.inputs.data_sources.connect(model)
37-
else:
38-
# For previous DPF versions
39-
cs = model.operator(r"mapdl::rst::CS")
33+
cs = dpf.operators.result.coordinate_system(server=server_type)
34+
cs.inputs.data_sources.connect(model)
4035
cs.inputs.cs_id.connect(12)
4136
cs_rot_mat = cs.outputs.field().data
4237
ref = np.array(

0 commit comments

Comments
 (0)