Skip to content

Commit

Permalink
update generated code (#1684)
Browse files Browse the repository at this point in the history
Co-authored-by: PProfizi <[email protected]>
  • Loading branch information
pyansys-ci-bot and PProfizi authored Aug 5, 2024
1 parent da757b4 commit 52c4ce8
Show file tree
Hide file tree
Showing 44 changed files with 1,161 additions and 149 deletions.
14 changes: 7 additions & 7 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/ansys/dpf/core/operators/math/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from .centroid_fc import centroid_fc
from .component_wise_divide import component_wise_divide
from .component_wise_divide_fc import component_wise_divide_fc
from .component_wise_product import component_wise_product
from .component_wise_product_fc import component_wise_product_fc
from .compute_residual_and_error import compute_residual_and_error
from .conjugate import conjugate
from .correlation import correlation
Expand Down Expand Up @@ -47,6 +49,7 @@
from .linear_combination import linear_combination
from .ln import ln
from .ln_fc import ln_fc
from .mac import mac
from .make_one_on_comp import make_one_on_comp
from .matrix_inverse import matrix_inverse
from .minus import minus
Expand Down
233 changes: 233 additions & 0 deletions src/ansys/dpf/core/operators/math/component_wise_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
"""
component_wise_product
======================
Autogenerated DPF operator classes.
"""

from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import Output, _Outputs
from ansys.dpf.core.operators.specification import PinSpecification, Specification


class component_wise_product(Operator):
"""Computes component-wise product between two fields of same
dimensionality. If one field's scoping has an 'overall' location,
then this field's values are applied on the other field entirely.
When using a constant or 'work_by_index', you can use 'inplace' to
reuse one of the fields.
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
Examples
--------
>>> from ansys.dpf import core as dpf
>>> # Instantiate operator
>>> op = dpf.operators.math.component_wise_product()
>>> # Make input connections
>>> my_fieldA = dpf.Field()
>>> op.inputs.fieldA.connect(my_fieldA)
>>> my_fieldB = dpf.Field()
>>> op.inputs.fieldB.connect(my_fieldB)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.math.component_wise_product(
... fieldA=my_fieldA,
... fieldB=my_fieldB,
... )
>>> # Get output data
>>> result_field = op.outputs.field()
"""

def __init__(self, fieldA=None, fieldB=None, config=None, server=None):
super().__init__(name="component_wise_product", config=config, server=server)
self._inputs = InputsComponentWiseProduct(self)
self._outputs = OutputsComponentWiseProduct(self)
if fieldA is not None:
self.inputs.fieldA.connect(fieldA)
if fieldB is not None:
self.inputs.fieldB.connect(fieldB)

@staticmethod
def _spec():
description = """Computes component-wise product between two fields of same
dimensionality. If one field's scoping has an 'overall'
location, then this field's values are applied on the
other field entirely. When using a constant or
'work_by_index', you can use 'inplace' to reuse one of the
fields."""
spec = Specification(
description=description,
map_input_pin_spec={
0: PinSpecification(
name="fieldA",
type_names=["field", "fields_container"],
optional=False,
document="""Field or fields container with only one field
is expected""",
),
1: PinSpecification(
name="fieldB",
type_names=["field", "fields_container"],
optional=False,
document="""Field or fields container with only one field
is expected""",
),
},
map_output_pin_spec={
0: PinSpecification(
name="field",
type_names=["field"],
optional=False,
document="""""",
),
},
)
return spec

@staticmethod
def 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.
"""
return Operator.default_config(name="component_wise_product", server=server)

@property
def inputs(self):
"""Enables to connect inputs to the operator
Returns
--------
inputs : InputsComponentWiseProduct
"""
return super().inputs

@property
def outputs(self):
"""Enables to get outputs of the operator by evaluating it
Returns
--------
outputs : OutputsComponentWiseProduct
"""
return super().outputs


class InputsComponentWiseProduct(_Inputs):
"""Intermediate class used to connect user inputs to
component_wise_product operator.
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.component_wise_product()
>>> my_fieldA = dpf.Field()
>>> op.inputs.fieldA.connect(my_fieldA)
>>> my_fieldB = dpf.Field()
>>> op.inputs.fieldB.connect(my_fieldB)
"""

def __init__(self, op: Operator):
super().__init__(component_wise_product._spec().inputs, op)
self._fieldA = Input(component_wise_product._spec().input_pin(0), 0, op, -1)
self._inputs.append(self._fieldA)
self._fieldB = Input(component_wise_product._spec().input_pin(1), 1, op, -1)
self._inputs.append(self._fieldB)

@property
def fieldA(self):
"""Allows to connect fieldA input to the operator.
Field or fields container with only one field
is expected
Parameters
----------
my_fieldA : Field or FieldsContainer
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.component_wise_product()
>>> op.inputs.fieldA.connect(my_fieldA)
>>> # or
>>> op.inputs.fieldA(my_fieldA)
"""
return self._fieldA

@property
def fieldB(self):
"""Allows to connect fieldB input to the operator.
Field or fields container with only one field
is expected
Parameters
----------
my_fieldB : Field or FieldsContainer
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.component_wise_product()
>>> op.inputs.fieldB.connect(my_fieldB)
>>> # or
>>> op.inputs.fieldB(my_fieldB)
"""
return self._fieldB


class OutputsComponentWiseProduct(_Outputs):
"""Intermediate class used to get outputs from
component_wise_product operator.
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.component_wise_product()
>>> # Connect inputs : op.inputs. ...
>>> result_field = op.outputs.field()
"""

def __init__(self, op: Operator):
super().__init__(component_wise_product._spec().outputs, op)
self._field = Output(component_wise_product._spec().output_pin(0), 0, op)
self._outputs.append(self._field)

@property
def field(self):
"""Allows to get field output of the operator
Returns
----------
my_field : Field
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.math.component_wise_product()
>>> # Connect inputs : op.inputs. ...
>>> result_field = op.outputs.field()
""" # noqa: E501
return self._field
Loading

0 comments on commit 52c4ce8

Please sign in to comment.