Skip to content

Commit 5ec81fe

Browse files
committed
enable methods in pyDPF
1 parent 59eb1b2 commit 5ec81fe

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed

src/ansys/dpf/core/cyclic_support.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
from ansys.dpf.core import server as server_module
3434
from ansys.dpf.core.scoping import Scoping
35+
from ansys.dpf.core import field, property_field
3536

3637

3738
class CyclicSupport:
@@ -304,6 +305,75 @@ def expand_element_id(self, element_id, sectors=None, stage_num=0):
304305
)
305306
return Scoping(scoping=expanded_ids, server=self._server)
306307

308+
def cs(self):
309+
"""Coordinate system of the cyclic support.
310+
311+
Examples
312+
--------
313+
>>> from ansys.dpf.core import Model
314+
>>> from ansys.dpf.core import examples
315+
>>> multi_stage = examples.download_multi_stage_cyclic_result()
316+
>>> cyc_support = Model(multi_stage).metadata.result_info.cyclic_support
317+
>>> cs = cyc_support.cs()
318+
>>> print(expanded_scoping.ids)
319+
[12]
320+
"""
321+
322+
cs = self._api.cyclic_support_get_cs(self)
323+
return field.Field(field=cs, server=self._server)
324+
325+
def low_high_map(self, stage_num=0):
326+
"""Retrieve a property field containing node map from low to high
327+
base sector of the given stage.
328+
329+
Parameters
330+
----------
331+
stage_num : int, optional
332+
Number of the stage required (from 0 to num_stages).
333+
334+
Returns
335+
-------
336+
low_high_map : PropertyField
337+
Node correspondance between low to high in the base sector of the given stage.
338+
339+
Examples
340+
--------
341+
>>> from ansys.dpf.core import Model
342+
>>> from ansys.dpf.core import examples
343+
>>> multi_stage = examples.download_multi_stage_cyclic_result()
344+
>>> cyc_support = Model(multi_stage).metadata.result_info.cyclic_support
345+
>>> low_high_map = cyc_support.low_high_map(0)
346+
347+
"""
348+
low_high_map = self._api.cyclic_support_get_low_high_map(self, stage_num)
349+
return property_field.PropertyField(property_field=low_high_map, server=self._server)
350+
351+
def high_low_map(self, stage_num=0):
352+
"""Retrieve a property field containing node map from high to low
353+
base sector of the given stage.
354+
355+
Parameters
356+
----------
357+
stage_num : int, optional
358+
Number of the stage required (from 0 to num_stages).
359+
360+
Returns
361+
-------
362+
low_high_map : PropertyField
363+
Node correspondance between high to low in the base sector of the given stage.
364+
365+
Examples
366+
--------
367+
>>> from ansys.dpf.core import Model
368+
>>> from ansys.dpf.core import examples
369+
>>> multi_stage = examples.download_multi_stage_cyclic_result()
370+
>>> cyc_support = Model(multi_stage).metadata.result_info.cyclic_support
371+
>>> high_low_map = cyc_support.high_low_map(0)
372+
373+
"""
374+
high_low_map = self._api.cyclic_support_get_high_low_map(self, stage_num)
375+
return property_field.PropertyField(property_field=high_low_map, server=self._server)
376+
307377
def __del__(self):
308378
try:
309379
self._deleter_func[0](self._deleter_func[1](self))

src/ansys/dpf/gate/cyclic_support_grpcapi.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ def cyclic_support_get_base_elements_scoping(support, i_stage):
7575
return getattr(CyclicSupportGRPCAPI.list(support),
7676
"base_elements_scoping_"+str(i_stage)).get_ownership()
7777

78+
@staticmethod
79+
def cyclic_support_get_low_high_map(support, i_stage):
80+
return getattr(CyclicSupportGRPCAPI.list(support),
81+
"low_high_map_"+str(i_stage)).get_ownership()
82+
83+
@staticmethod
84+
def cyclic_support_get_high_low_map(support, i_stage):
85+
return getattr(CyclicSupportGRPCAPI.list(support),
86+
"high_low_map_"+str(i_stage)).get_ownership()
87+
7888
@staticmethod
7989
def get_expanded_ids(support, request):
8090
return _get_stub(support._server).GetExpandedIds(request).expanded_ids
@@ -100,3 +110,19 @@ def cyclic_support_get_expanded_element_ids(support, baseElementId, i_stage, sec
100110
request = CyclicSupportGRPCAPI.init_get_expanded_ids(support, i_stage, sectorsScoping)
101111
request.element_id = baseElementId
102112
return CyclicSupportGRPCAPI.get_expanded_ids(support, request)
113+
114+
@staticmethod
115+
def get_cs(support, request):
116+
return _get_stub(support._server).GetCS(request).cs
117+
118+
@staticmethod
119+
def init_get_cs(support):
120+
from ansys.grpc.dpf import cyclic_support_pb2
121+
request = cyclic_support_pb2.GetCSRequest()
122+
request.support.CopyFrom(support._internal_obj)
123+
return request
124+
125+
@staticmethod
126+
def cyclic_support_get_cs(support):
127+
request = CyclicSupportGRPCAPI.init_get_cs(support)
128+
return CyclicSupportGRPCAPI.get_cs(support, request)

0 commit comments

Comments
 (0)