field_to_csv

class ansys.dpf.core.operators.serialization.field_to_csv.field_to_csv(field_or_fields_container=None, file_path=None, storage_type=None, config=None, server=None)

Exports a field or a fields container into a csv file

available inputs:
  • field_or_fields_container (FieldsContainer, Field)

  • file_path (str)

  • storage_type (int) (optional)

available outputs:

Examples

>>> from ansys.dpf import core as dpf
>>> # Instantiate operator
>>> op = dpf.operators.serialization.field_to_csv()
>>> # Make input connections
>>> my_field_or_fields_container = dpf.FieldsContainer()
>>> op.inputs.field_or_fields_container.connect(my_field_or_fields_container)
>>> my_file_path = str()
>>> op.inputs.file_path.connect(my_file_path)
>>> my_storage_type = int()
>>> op.inputs.storage_type.connect(my_storage_type)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.serialization.field_to_csv(field_or_fields_container=my_field_or_fields_container,file_path=my_file_path,storage_type=my_storage_type)
>>> # Get output data
static default_config()

Returns the default config for a given operator. This config can then be changed to the user needs and be used to instantiate the given operator

Parameters
  • name (str) – Name of the operator. For example ‘U’.

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

property inputs

Enables to connect inputs to the operator

Returns

inputs

Return type

InputsFieldToCsv

property outputs

Enables to get outputs of the operator by evaluationg it

Returns

outputs

Return type

OutputsFieldToCsv

property config

Returns a copy of the current config of the operator. To use the config that you modify, please use operator.config = new_config or create an operator with the new config as a parameter.

Returns

config

Return type

Config

connect(pin, inpt, pin_out=0)

Connect an input on the operator using a pin number.

Parameters

Examples

Compute the minimum of displacement by chaining the 'U' and 'min_max_fc' operators.

>>> from ansys.dpf import core as dpf
>>> from ansys.dpf.core import examples
>>> data_src = dpf.DataSources(examples.multishells_rst)
>>> disp_op = dpf.operators.result.displacement()
>>> disp_op.inputs.data_sources(data_src)
>>> max_fc_op = dpf.operators.min_max.min_max_fc()
>>> max_fc_op.inputs.connect(disp_op.outputs)
>>> max_field = max_fc_op.outputs.field_max()
>>> max_field.data
array([[0.59428386, 0.00201751, 0.0006032 ]])
get_output(pin=0, output_type=None)

Returns the output of the operator on the pin number.

Parameters
  • pin (int, optional) – Number of the output pin.

  • output_type (core.type enum, optional) – The requested type of the output.

run()

Evaluate this operator

class ansys.dpf.core.operators.serialization.field_to_csv.InputsFieldToCsv(op: ansys.dpf.core.dpf_operator.Operator)

Intermediate class used to connect user inputs to field_to_csv operator

Examples

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.field_to_csv()
>>> my_field_or_fields_container = dpf.FieldsContainer()
>>> op.inputs.field_or_fields_container.connect(my_field_or_fields_container)
>>> my_file_path = str()
>>> op.inputs.file_path.connect(my_file_path)
>>> my_storage_type = int()
>>> op.inputs.storage_type.connect(my_storage_type)
property field_or_fields_container

Allows to connect field_or_fields_container input to the operator

  • pindoc: field_or_fields_container

Parameters

my_field_or_fields_container (FieldsContainer, Field,) –

Examples

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.field_to_csv()
>>> op.inputs.field_or_fields_container.connect(my_field_or_fields_container)
>>> #or
>>> op.inputs.field_or_fields_container(my_field_or_fields_container)
property file_path

Allows to connect file_path input to the operator

Parameters

my_file_path (str,) –

Examples

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.field_to_csv()
>>> op.inputs.file_path.connect(my_file_path)
>>> #or
>>> op.inputs.file_path(my_file_path)
property storage_type

Allows to connect storage_type input to the operator

  • pindoc: storage type : if matrices (without any particularity) are included in the fields container, the storage format can be chosen. 0 : flat/line format, 1 : ranked format. If 1 is chosen, the csv can not be read by “csv to field” operator anymore. Default : 0.

Parameters

my_storage_type (int,) –

Examples

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.field_to_csv()
>>> op.inputs.storage_type.connect(my_storage_type)
>>> #or
>>> op.inputs.storage_type(my_storage_type)
connect(inpt)

Allows you to connect any input (an entity or an operator output) to any input pin of this operator.

The matching input type corresponding to the output is looked for.

Parameters

inpt (str, int, double, Field, FieldsContainer, Scoping, DataSources, MeshedRegion, ScopingsContainer, CyclicSupport, ..., Output, Outputs, Operator) – input of the operator

class ansys.dpf.core.operators.serialization.field_to_csv.OutputsFieldToCsv(op: ansys.dpf.core.dpf_operator.Operator)

Intermediate class used to get outputs from field_to_csv operator .. rubric:: Examples

>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.serialization.field_to_csv()
>>> # Connect inputs : op.inputs. ...