Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions src/ansys/dpf/core/operators/result/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class custom(Operator):
is done, if 3 cyclic expansion is
done and stages are merged (default
is 1)
result_name :
Name of the result that must be extracted
from the file

Returns
-------
Expand Down Expand Up @@ -95,6 +98,8 @@ class custom(Operator):
>>> op.inputs.mesh.connect(my_mesh)
>>> my_read_cyclic = int()
>>> op.inputs.read_cyclic.connect(my_read_cyclic)
>>> my_result_name = dpf.()
>>> op.inputs.result_name.connect(my_result_name)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.result.custom(
Expand All @@ -106,6 +111,7 @@ class custom(Operator):
... bool_rotate_to_global=my_bool_rotate_to_global,
... mesh=my_mesh,
... read_cyclic=my_read_cyclic,
... result_name=my_result_name,
... )

>>> # Get output data
Expand All @@ -122,6 +128,7 @@ def __init__(
bool_rotate_to_global=None,
mesh=None,
read_cyclic=None,
result_name=None,
config=None,
server=None,
):
Expand All @@ -144,6 +151,8 @@ def __init__(
self.inputs.mesh.connect(mesh)
if read_cyclic is not None:
self.inputs.read_cyclic.connect(read_cyclic)
if result_name is not None:
self.inputs.result_name.connect(result_name)

@staticmethod
def _spec():
Expand Down Expand Up @@ -240,6 +249,13 @@ def _spec():
done and stages are merged (default
is 1)""",
),
60: PinSpecification(
name="result_name",
type_names=["any"],
optional=False,
document="""Name of the result that must be extracted
from the file""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -313,6 +329,8 @@ class InputsCustom(_Inputs):
>>> op.inputs.mesh.connect(my_mesh)
>>> my_read_cyclic = int()
>>> op.inputs.read_cyclic.connect(my_read_cyclic)
>>> my_result_name = dpf.()
>>> op.inputs.result_name.connect(my_result_name)
"""

def __init__(self, op: Operator):
Expand All @@ -333,6 +351,8 @@ def __init__(self, op: Operator):
self._inputs.append(self._mesh)
self._read_cyclic = Input(custom._spec().input_pin(14), 14, op, -1)
self._inputs.append(self._read_cyclic)
self._result_name = Input(custom._spec().input_pin(60), 60, op, -1)
self._inputs.append(self._result_name)

@property
def time_scoping(self):
Expand Down Expand Up @@ -527,6 +547,27 @@ def read_cyclic(self):
"""
return self._read_cyclic

@property
def result_name(self):
"""Allows to connect result_name input to the operator.

Name of the result that must be extracted
from the file

Parameters
----------
my_result_name :

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.result.custom()
>>> op.inputs.result_name.connect(my_result_name)
>>> # or
>>> op.inputs.result_name(my_result_name)
"""
return self._result_name


class OutputsCustom(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@


class hdf5dpf_custom_read(Operator):
"""Extract a custom result from an hdf5dpf file.
"""Extract a custom result from an hdf5dpf file. This operator is
deprecated, please use the 'custom' operator instead.

Parameters
----------
Expand Down Expand Up @@ -98,7 +99,8 @@ def __init__(

@staticmethod
def _spec():
description = """Extract a custom result from an hdf5dpf file."""
description = """Extract a custom result from an hdf5dpf file. This operator is
deprecated, please use the 'custom' operator instead."""
spec = Specification(
description=description,
map_input_pin_spec={
Expand Down
12 changes: 12 additions & 0 deletions src/ansys/dpf/gate/generated/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,18 @@ def load_api(path):
dll.Client_get_protocol_name.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Client_get_protocol_name.restype = ctypes.POINTER(ctypes.c_char)

if hasattr(dll, "Client_has_local_server"):
dll.Client_has_local_server.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Client_has_local_server.restype = ctypes.c_bool

if hasattr(dll, "Client_set_local_server"):
dll.Client_set_local_server.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Client_set_local_server.restype = None

if hasattr(dll, "Client_get_local_server"):
dll.Client_get_local_server.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Client_get_local_server.restype = ctypes.c_void_p

#-------------------------------------------------------------------------------
# Collection
#-------------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions src/ansys/dpf/gate/generated/client_abstract_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,15 @@ def client_get_full_address(client):
def client_get_protocol_name(client):
raise NotImplementedError

@staticmethod
def client_has_local_server(client):
raise NotImplementedError

@staticmethod
def client_set_local_server(client, server_streams):
raise NotImplementedError

@staticmethod
def client_get_local_server(client):
raise NotImplementedError

27 changes: 27 additions & 0 deletions src/ansys/dpf/gate/generated/client_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,30 @@ def client_get_protocol_name(client):
capi.dll.DataProcessing_String_post_event(res, ctypes.byref(errorSize), ctypes.byref(sError))
return newres

@staticmethod
def client_has_local_server(client):
errorSize = ctypes.c_int(0)
sError = ctypes.c_wchar_p()
res = capi.dll.Client_has_local_server(client._internal_obj if client is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
if errorSize.value != 0:
raise errors.DPFServerException(sError.value)
return res

@staticmethod
def client_set_local_server(client, server_streams):
errorSize = ctypes.c_int(0)
sError = ctypes.c_wchar_p()
res = capi.dll.Client_set_local_server(client._internal_obj if client is not None else None, server_streams._internal_obj if server_streams is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
if errorSize.value != 0:
raise errors.DPFServerException(sError.value)
return res

@staticmethod
def client_get_local_server(client):
errorSize = ctypes.c_int(0)
sError = ctypes.c_wchar_p()
res = capi.dll.Client_get_local_server(client._internal_obj if client is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
if errorSize.value != 0:
raise errors.DPFServerException(sError.value)
return res

Binary file modified src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/DPFClientAPI.dll
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/libDPFClientAPI.so
Binary file not shown.