Skip to content
Merged
70 changes: 70 additions & 0 deletions src/ansys/dpf/core/cyclic_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

from ansys.dpf.core import server as server_module
from ansys.dpf.core.scoping import Scoping
from ansys.dpf.core import field, property_field


class CyclicSupport:
Expand Down Expand Up @@ -304,6 +305,75 @@
)
return Scoping(scoping=expanded_ids, server=self._server)

def cs(self):
"""Coordinate system of the cyclic support.
Examples
--------
>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> multi_stage = examples.download_multi_stage_cyclic_result()
>>> cyc_support = Model(multi_stage).metadata.result_info.cyclic_support
>>> cs = cyc_support.cs()
>>> print(expanded_scoping.ids)
[12]
"""

cs = self._api.cyclic_support_get_cs(self)
return field.Field(field=cs, server=self._server)

Check warning on line 323 in src/ansys/dpf/core/cyclic_support.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/cyclic_support.py#L322-L323

Added lines #L322 - L323 were not covered by tests

def low_high_map(self, stage_num=0):
"""Retrieve a property field containing node map from low to high
base sector of the given stage.
Parameters
----------
stage_num : int, optional
Number of the stage required (from 0 to num_stages).
Returns
-------
low_high_map : PropertyField
Node correspondence between low to high in the base sector of the given stage.
Examples
--------
>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> multi_stage = examples.download_multi_stage_cyclic_result()
>>> cyc_support = Model(multi_stage).metadata.result_info.cyclic_support
>>> low_high_map = cyc_support.low_high_map(0)
"""
low_high_map = self._api.cyclic_support_get_low_high_map(self, stage_num)
return property_field.PropertyField(property_field=low_high_map, server=self._server)

Check warning on line 349 in src/ansys/dpf/core/cyclic_support.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/cyclic_support.py#L348-L349

Added lines #L348 - L349 were not covered by tests

def high_low_map(self, stage_num=0):
"""Retrieve a property field containing node map from high to low
base sector of the given stage.
Parameters
----------
stage_num : int, optional
Number of the stage required (from 0 to num_stages).
Returns
-------
low_high_map : PropertyField
Node correspondence between high to low in the base sector of the given stage.
Examples
--------
>>> from ansys.dpf.core import Model
>>> from ansys.dpf.core import examples
>>> multi_stage = examples.download_multi_stage_cyclic_result()
>>> cyc_support = Model(multi_stage).metadata.result_info.cyclic_support
>>> high_low_map = cyc_support.high_low_map(0)
"""
high_low_map = self._api.cyclic_support_get_high_low_map(self, stage_num)
return property_field.PropertyField(property_field=high_low_map, server=self._server)

Check warning on line 375 in src/ansys/dpf/core/cyclic_support.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/cyclic_support.py#L374-L375

Added lines #L374 - L375 were not covered by tests

def __del__(self):
try:
self._deleter_func[0](self._deleter_func[1](self))
Expand Down
26 changes: 26 additions & 0 deletions src/ansys/dpf/gate/cyclic_support_grpcapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ def cyclic_support_get_base_elements_scoping(support, i_stage):
return getattr(CyclicSupportGRPCAPI.list(support),
"base_elements_scoping_"+str(i_stage)).get_ownership()

@staticmethod
def cyclic_support_get_low_high_map(support, i_stage):
return getattr(CyclicSupportGRPCAPI.list(support),
"low_high_map_"+str(i_stage)).get_ownership()

@staticmethod
def cyclic_support_get_high_low_map(support, i_stage):
return getattr(CyclicSupportGRPCAPI.list(support),
"high_low_map_"+str(i_stage)).get_ownership()

@staticmethod
def get_expanded_ids(support, request):
return _get_stub(support._server).GetExpandedIds(request).expanded_ids
Expand All @@ -100,3 +110,19 @@ def cyclic_support_get_expanded_element_ids(support, baseElementId, i_stage, sec
request = CyclicSupportGRPCAPI.init_get_expanded_ids(support, i_stage, sectorsScoping)
request.element_id = baseElementId
return CyclicSupportGRPCAPI.get_expanded_ids(support, request)

@staticmethod
def get_cs(support, request):
return _get_stub(support._server).GetCS(request).cs

@staticmethod
def init_get_cs(support):
from ansys.grpc.dpf import cyclic_support_pb2
request = cyclic_support_pb2.GetCSRequest()
request.support.CopyFrom(support._internal_obj)
return request

@staticmethod
def cyclic_support_get_cs(support):
request = CyclicSupportGRPCAPI.init_get_cs(support)
return CyclicSupportGRPCAPI.get_cs(support, request)
Loading