centroid
#
- class ansys.dpf.core.operators.math.centroid.centroid(fieldA=None, fieldB=None, factor=None, config=None, server=None)#
Bases:
ansys.dpf.core.dpf_operator.Operator
Computes centroid of field1 and field2, using fieldOut = field1*(1.-fact)+field2*(fact). Only works by index.
- Parameters:
fieldA (Field or FieldsContainer) – Field or fields container with only one field is expected
fieldB (Field or FieldsContainer) – Field or fields container with only one field is expected
factor (float) – Scalar
- Returns:
field
- Return type:
Examples
>>> from ansys.dpf import core as dpf
>>> # Instantiate operator >>> op = dpf.operators.math.centroid()
>>> # Make input connections >>> my_fieldA = dpf.Field() >>> op.inputs.fieldA.connect(my_fieldA) >>> my_fieldB = dpf.Field() >>> op.inputs.fieldB.connect(my_fieldB) >>> my_factor = float() >>> op.inputs.factor.connect(my_factor)
>>> # Instantiate operator and connect inputs in one line >>> op = dpf.operators.math.centroid( ... fieldA=my_fieldA, ... fieldB=my_fieldB, ... factor=my_factor, ... )
>>> # Get output data >>> result_field = op.outputs.field()
Overview#
Returns the default config of the operator. |
Import detail#
from ansys.dpf.core.operators.math.centroid import centroid
Property detail#
- property centroid.inputs#
Enables to connect inputs to the operator
- Returns:
inputs
- Return type:
- property centroid.outputs#
Enables to get outputs of the operator by evaluating it
- Returns:
outputs
- Return type:
Method detail#
- static centroid.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.