Skip to content

Commit

Permalink
update generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
rlagha authored Dec 7, 2024
1 parent ce858d8 commit 3271482
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/ansys/dpf/core/operators/utility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
from .mesh import mesh
from .meshes_container import meshes_container
from .mesh_to_mc import mesh_to_mc
from .operator_id import operator_id
from .overlap_fields import overlap_fields
from .producer_consumer_for_each import producer_consumer_for_each
from .property_field import property_field
Expand Down
181 changes: 181 additions & 0 deletions src/ansys/dpf/core/operators/utility/operator_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
"""
operator_id
===========
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 operator_id(Operator):
"""Return the id of an Operator.
Parameters
----------
op : Operator
Returns
-------
id : int
Examples
--------
>>> from ansys.dpf import core as dpf
>>> # Instantiate operator
>>> op = dpf.operators.utility.operator_id()
>>> # Make input connections
>>> my_op = dpf.Operator()
>>> op.inputs.op.connect(my_op)
>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.utility.operator_id(
... op=my_op,
... )
>>> # Get output data
>>> result_id = op.outputs.id()
"""

def __init__(self, op=None, config=None, server=None):
super().__init__(name="operator_id", config=config, server=server)
self._inputs = InputsOperatorId(self)
self._outputs = OutputsOperatorId(self)
if op is not None:
self.inputs.op.connect(op)

@staticmethod
def _spec():
description = """Return the id of an Operator."""
spec = Specification(
description=description,
map_input_pin_spec={
0: PinSpecification(
name="op",
type_names=["operator"],
optional=False,
document="""""",
),
},
map_output_pin_spec={
0: PinSpecification(
name="id",
type_names=["int32"],
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="operator_id", server=server)

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

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


class InputsOperatorId(_Inputs):
"""Intermediate class used to connect user inputs to
operator_id operator.
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_id()
>>> my_op = dpf.Operator()
>>> op.inputs.op.connect(my_op)
"""

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

@property
def op(self):
"""Allows to connect op input to the operator.
Parameters
----------
my_op : Operator
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_id()
>>> op.inputs.op.connect(my_op)
>>> # or
>>> op.inputs.op(my_op)
"""
return self._op


class OutputsOperatorId(_Outputs):
"""Intermediate class used to get outputs from
operator_id operator.
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_id()
>>> # Connect inputs : op.inputs. ...
>>> result_id = op.outputs.id()
"""

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

@property
def id(self):
"""Allows to get id output of the operator
Returns
----------
my_id : int
Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_id()
>>> # Connect inputs : op.inputs. ...
>>> result_id = op.outputs.id()
""" # noqa: E501
return self._id
Binary file modified src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/DPFClientAPI.dll
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so
Binary file not shown.
Binary file modified src/ansys/dpf/gatebin/libDPFClientAPI.so
Binary file not shown.

0 comments on commit 3271482

Please sign in to comment.