serializer#

class ansys.dpf.core.operators.serialization.serializer.serializer(stream_type=None, file_path=None, any_input1=None, any_input2=None, config=None, server=None)#

Bases: ansys.dpf.core.dpf_operator.Operator

Take any input and serialize them in a file.

Parameters:
  • stream_type (int) – 0 for ascii (default), and 1 for binary

  • file_path (str)

  • any_input1 (Any) – Any input

  • any_input2 (Any) – Any input

Returns:

file_path

Return type:

str

Examples

>>> from ansys.dpf import core as dpf
>>> # Instantiate 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()
>>> op.inputs.any_input1.connect(my_any_input1)
>>> my_any_input2 = dpf.Any()
>>> op.inputs.any_input2.connect(my_any_input2)
>>> # 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,
... )
>>> # Get output data
>>> result_file_path = op.outputs.file_path()

Overview#

inputs

Enables to connect inputs to the operator

outputs

Enables to get outputs of the operator by evaluating it

default_config

Returns the default config of the operator.

Import detail#

from ansys.dpf.core.operators.serialization.serializer import serializer

Property detail#

property serializer.inputs#

Enables to connect inputs to the operator

Returns:

inputs

Return type:

InputsSerializer

property serializer.outputs#

Enables to get outputs of the operator by evaluating it

Returns:

outputs

Return type:

OutputsSerializer

Method detail#

static serializer.default_config(server=None)#

Returns the default config of the operator.

This config can then be changed to the user needs and be used to instantiate the operator. The Configuration allows to customize how the operation will be processed by the operator.

Parameters:

server (server.DPFServer, optional) – Server with channel connected to the remote or local instance. When None, attempts to use the global server.