Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

141 changes: 75 additions & 66 deletions src/ansys/dpf/core/operators/averaging/elemental_difference.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,37 @@
Autogenerated DPF operator classes.
"""

from __future__ import annotations

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
from ansys.dpf.core.config import Config
from ansys.dpf.core.server_types import AnyServerType


class elemental_difference(Operator):
"""Transforms an Elemental Nodal or Nodal field into an Elemental field.
Each elemental value is the maximum difference between the
computed result for all nodes in this element. The result is
computed on a given element scoping.
r"""Transforms an Elemental Nodal or Nodal field into an Elemental field.
Each elemental value is the maximum difference between the computed
result for all nodes in this element. The result is computed on a given
element scoping.


Parameters
----------
field : Field or FieldsContainer
Field or fields container with only one field
is expected
mesh_scoping : Scoping, optional
Average only on these entities
mesh : MeshedRegion, optional
through_layers : bool, optional
The maximum elemental difference is taken
through the different shell layers if
true (default is false).
field: Field or FieldsContainer
field or fields container with only one field is expected
mesh_scoping: Scoping, optional
average only on these entities
mesh: MeshedRegion, optional
through_layers: bool, optional
The maximum elemental difference is taken through the different shell layers if true (default is false).

Returns
-------
field : Field
field: Field

Examples
--------
Expand Down Expand Up @@ -85,55 +87,53 @@ def __init__(
self.inputs.through_layers.connect(through_layers)

@staticmethod
def _spec():
description = """Transforms an Elemental Nodal or Nodal field into an Elemental field.
Each elemental value is the maximum difference between the
computed result for all nodes in this element. The result
is computed on a given element scoping."""
def _spec() -> Specification:
description = r"""Transforms an Elemental Nodal or Nodal field into an Elemental field.
Each elemental value is the maximum difference between the computed
result for all nodes in this element. The result is computed on a given
element scoping.
"""
spec = Specification(
description=description,
map_input_pin_spec={
0: PinSpecification(
name="field",
type_names=["field", "fields_container"],
optional=False,
document="""Field or fields container with only one field
is expected""",
document=r"""field or fields container with only one field is expected""",
),
1: PinSpecification(
name="mesh_scoping",
type_names=["scoping"],
optional=True,
document="""Average only on these entities""",
document=r"""average only on these entities""",
),
7: PinSpecification(
name="mesh",
type_names=["abstract_meshed_region"],
optional=True,
document="""""",
document=r"""""",
),
10: PinSpecification(
name="through_layers",
type_names=["bool"],
optional=True,
document="""The maximum elemental difference is taken
through the different shell layers if
true (default is false).""",
document=r"""The maximum elemental difference is taken through the different shell layers if true (default is false).""",
),
},
map_output_pin_spec={
0: PinSpecification(
name="field",
type_names=["field"],
optional=False,
document="""""",
document=r"""""",
),
},
)
return spec

@staticmethod
def default_config(server=None):
def default_config(server: AnyServerType = None) -> Config:
"""Returns the default config of the operator.

This config can then be changed to the user needs and be used to
Expand All @@ -142,29 +142,36 @@ def default_config(server=None):

Parameters
----------
server : server.DPFServer, optional
server:
Server with channel connected to the remote or local instance. When
``None``, attempts to use the global server.

Returns
-------
config:
A new Config instance equivalent to the default config for this operator.
"""
return Operator.default_config(name="elemental_difference", server=server)

@property
def inputs(self):
def inputs(self) -> InputsElementalDifference:
"""Enables to connect inputs to the operator

Returns
--------
inputs : InputsElementalDifference
inputs:
An instance of InputsElementalDifference.
"""
return super().inputs

@property
def outputs(self):
def outputs(self) -> OutputsElementalDifference:
"""Enables to get outputs of the operator by evaluating it

Returns
--------
outputs : OutputsElementalDifference
outputs:
An instance of OutputsElementalDifference.
"""
return super().outputs

Expand Down Expand Up @@ -201,15 +208,15 @@ def __init__(self, op: Operator):
self._inputs.append(self._through_layers)

@property
def field(self):
"""Allows to connect field input to the operator.
def field(self) -> Input:
r"""Allows to connect field input to the operator.

Field or fields container with only one field
is expected
field or fields container with only one field is expected

Parameters
----------
my_field : Field or FieldsContainer
Returns
-------
input:
An Input instance for this pin.

Examples
--------
Expand All @@ -222,14 +229,15 @@ def field(self):
return self._field

@property
def mesh_scoping(self):
"""Allows to connect mesh_scoping input to the operator.
def mesh_scoping(self) -> Input:
r"""Allows to connect mesh_scoping input to the operator.

Average only on these entities
average only on these entities

Parameters
----------
my_mesh_scoping : Scoping
Returns
-------
input:
An Input instance for this pin.

Examples
--------
Expand All @@ -242,12 +250,13 @@ def mesh_scoping(self):
return self._mesh_scoping

@property
def mesh(self):
"""Allows to connect mesh input to the operator.
def mesh(self) -> Input:
r"""Allows to connect mesh input to the operator.

Parameters
----------
my_mesh : MeshedRegion
Returns
-------
input:
An Input instance for this pin.

Examples
--------
Expand All @@ -260,16 +269,15 @@ def mesh(self):
return self._mesh

@property
def through_layers(self):
"""Allows to connect through_layers input to the operator.
def through_layers(self) -> Input:
r"""Allows to connect through_layers input to the operator.

The maximum elemental difference is taken
through the different shell layers if
true (default is false).
The maximum elemental difference is taken through the different shell layers if true (default is false).

Parameters
----------
my_through_layers : bool
Returns
-------
input:
An Input instance for this pin.

Examples
--------
Expand Down Expand Up @@ -300,18 +308,19 @@ def __init__(self, op: Operator):
self._outputs.append(self._field)

@property
def field(self):
"""Allows to get field output of the operator
def field(self) -> Output:
r"""Allows to get field output of the operator

Returns
----------
my_field : Field
-------
output:
An Output instance for this pin.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.elemental_difference()
>>> # Connect inputs : op.inputs. ...
>>> # Get the output from op.outputs. ...
>>> result_field = op.outputs.field()
""" # noqa: E501
"""
return self._field
Loading
Loading