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
4 changes: 2 additions & 2 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

39 changes: 38 additions & 1 deletion src/ansys/dpf/core/operators/serialization/deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class deserializer(Operator):

Parameters
----------
stream_type : int
0 for ascii (default), and 1 for binary
file_path : str
File path

Expand All @@ -37,11 +39,14 @@ class deserializer(Operator):
>>> op = dpf.operators.serialization.deserializer()

>>> # Make input connections
>>> my_stream_type = int()
>>> op.inputs.stream_type.connect(my_stream_type)
>>> my_file_path = str()
>>> op.inputs.file_path.connect(my_file_path)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.serialization.deserializer(
... stream_type=my_stream_type,
... file_path=my_file_path,
... )

Expand All @@ -50,10 +55,12 @@ class deserializer(Operator):
>>> result_any_output2 = op.outputs.any_output2()
"""

def __init__(self, file_path=None, config=None, server=None):
def __init__(self, stream_type=None, file_path=None, config=None, server=None):
super().__init__(name="deserializer", config=config, server=server)
self._inputs = InputsDeserializer(self)
self._outputs = OutputsDeserializer(self)
if stream_type is not None:
self.inputs.stream_type.connect(stream_type)
if file_path is not None:
self.inputs.file_path.connect(file_path)

Expand All @@ -64,6 +71,12 @@ def _spec():
spec = Specification(
description=description,
map_input_pin_spec={
-1: PinSpecification(
name="stream_type",
type_names=["int32"],
optional=False,
document="""0 for ascii (default), and 1 for binary""",
),
0: PinSpecification(
name="file_path",
type_names=["string"],
Expand Down Expand Up @@ -135,15 +148,39 @@ class InputsDeserializer(_Inputs):
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.deserializer()
>>> my_stream_type = int()
>>> op.inputs.stream_type.connect(my_stream_type)
>>> my_file_path = str()
>>> op.inputs.file_path.connect(my_file_path)
"""

def __init__(self, op: Operator):
super().__init__(deserializer._spec().inputs, op)
self._stream_type = Input(deserializer._spec().input_pin(-1), -1, op, -1)
self._inputs.append(self._stream_type)
self._file_path = Input(deserializer._spec().input_pin(0), 0, op, -1)
self._inputs.append(self._file_path)

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

0 for ascii (default), and 1 for binary

Parameters
----------
my_stream_type : int

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.deserializer()
>>> op.inputs.stream_type.connect(my_stream_type)
>>> # or
>>> op.inputs.stream_type(my_stream_type)
"""
return self._stream_type

@property
def file_path(self):
"""Allows to connect file_path input to the operator.
Expand Down
45 changes: 44 additions & 1 deletion src/ansys/dpf/core/operators/serialization/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class serializer(Operator):

Parameters
----------
stream_type : int
0 for ascii (default), and 1 for binary
file_path : str
any_input1 : Any
Any input
Expand All @@ -34,6 +36,8 @@ class serializer(Operator):
>>> op = dpf.operators.serialization.serializer()

>>> # Make input connections
>>> my_stream_type = int()
>>> op.inputs.stream_type.connect(my_stream_type)
>>> my_file_path = str()
>>> op.inputs.file_path.connect(my_file_path)
>>> my_any_input1 = dpf.Any()
Expand All @@ -43,6 +47,7 @@ class serializer(Operator):

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.serialization.serializer(
... stream_type=my_stream_type,
... file_path=my_file_path,
... any_input1=my_any_input1,
... any_input2=my_any_input2,
Expand All @@ -53,11 +58,19 @@ class serializer(Operator):
"""

def __init__(
self, file_path=None, any_input1=None, any_input2=None, config=None, server=None
self,
stream_type=None,
file_path=None,
any_input1=None,
any_input2=None,
config=None,
server=None,
):
super().__init__(name="serializer", config=config, server=server)
self._inputs = InputsSerializer(self)
self._outputs = OutputsSerializer(self)
if stream_type is not None:
self.inputs.stream_type.connect(stream_type)
if file_path is not None:
self.inputs.file_path.connect(file_path)
if any_input1 is not None:
Expand All @@ -71,6 +84,12 @@ def _spec():
spec = Specification(
description=description,
map_input_pin_spec={
-1: PinSpecification(
name="stream_type",
type_names=["int32"],
optional=False,
document="""0 for ascii (default), and 1 for binary""",
),
0: PinSpecification(
name="file_path",
type_names=["string"],
Expand Down Expand Up @@ -146,6 +165,8 @@ class InputsSerializer(_Inputs):
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.serializer()
>>> my_stream_type = int()
>>> op.inputs.stream_type.connect(my_stream_type)
>>> my_file_path = str()
>>> op.inputs.file_path.connect(my_file_path)
>>> my_any_input1 = dpf.Any()
Expand All @@ -156,13 +177,35 @@ class InputsSerializer(_Inputs):

def __init__(self, op: Operator):
super().__init__(serializer._spec().inputs, op)
self._stream_type = Input(serializer._spec().input_pin(-1), -1, op, -1)
self._inputs.append(self._stream_type)
self._file_path = Input(serializer._spec().input_pin(0), 0, op, -1)
self._inputs.append(self._file_path)
self._any_input1 = Input(serializer._spec().input_pin(1), 1, op, 0)
self._inputs.append(self._any_input1)
self._any_input2 = Input(serializer._spec().input_pin(2), 2, op, 1)
self._inputs.append(self._any_input2)

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

0 for ascii (default), and 1 for binary

Parameters
----------
my_stream_type : int

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.serializer()
>>> op.inputs.stream_type.connect(my_stream_type)
>>> # or
>>> op.inputs.stream_type(my_stream_type)
"""
return self._stream_type

@property
def file_path(self):
"""Allows to connect file_path input to the operator.
Expand Down
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.
Loading