scale#

class ansys.dpf.core.operators.math.scale.scale(field=None, ponderation=None, boolean=None, algorithm=None, config=None, server=None)#

Bases: ansys.dpf.core.dpf_operator.Operator

Scales a field by a constant factor. This factor can be a scalar or a vector, where each value of the vector represents a scaler per component. Number of the components are corresponding to the input field dimensionality

Parameters:
  • field (Field or FieldsContainer) – Field or fields container with only one field is expected

  • ponderation (float or Field) – Double/field/vector of doubles. when scoped on overall, same value(s) applied on all the data, when scoped elsewhere, corresponding values will be multiplied due to the scoping

  • boolean (bool, optional) – Default is false. if set to true, output of scale is made dimensionless

  • algorithm (int, optional) – Default is 0 use mkl. if set to 1, don’t

Returns:

field

Return type:

Field

Examples

>>> from ansys.dpf import core as dpf
>>> # Instantiate operator
>>> op = dpf.operators.math.scale()
>>> # Make input connections
>>> my_field = dpf.Field()
>>> op.inputs.field.connect(my_field)
>>> my_ponderation = float()
>>> op.inputs.ponderation.connect(my_ponderation)
>>> my_boolean = bool()
>>> op.inputs.boolean.connect(my_boolean)
>>> my_algorithm = int()
>>> op.inputs.algorithm.connect(my_algorithm)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.math.scale(
...     field=my_field,
...     ponderation=my_ponderation,
...     boolean=my_boolean,
...     algorithm=my_algorithm,
... )
>>> # Get output data
>>> result_field = op.outputs.field()

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.math.scale import scale

Property detail#

property scale.inputs#

Enables to connect inputs to the operator

Returns:

inputs

Return type:

InputsScale

property scale.outputs#

Enables to get outputs of the operator by evaluating it

Returns:

outputs

Return type:

OutputsScale

Method detail#

static scale.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.