Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for DPF 252_daily on master #1947

Merged
merged 1 commit into from
Jan 10, 2025
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/source/_static/dpf_operators.html

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/ansys/dpf/core/operators/averaging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
from .nodal_fraction_fc import nodal_fraction_fc
from .nodal_to_elemental import nodal_to_elemental
from .nodal_to_elemental_fc import nodal_to_elemental_fc
from .nodal_to_elemental_nodal import nodal_to_elemental_nodal
from .nodal_to_elemental_nodal_fc import nodal_to_elemental_nodal_fc
from .to_elemental_fc import to_elemental_fc
from .to_elemental_nodal_fc import to_elemental_nodal_fc
from .to_nodal import to_nodal
Expand Down
274 changes: 274 additions & 0 deletions src/ansys/dpf/core/operators/averaging/nodal_to_elemental_nodal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
"""
nodal_to_elemental_nodal

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 nodal_to_elemental_nodal(Operator):
"""Transforms a Nodal field to an ElementalNodal field, The result is
computed on a given element's scoping.

Parameters
----------
field : Field or FieldsContainer
Field or fields container with only one field
is expected
mesh_scoping : Scoping, optional
collapse_shell_layers : bool, optional
If true, shell layers are averaged as well
(default is false).

Returns
-------
field : Field

Examples
--------
>>> from ansys.dpf import core as dpf

>>> # Instantiate operator
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal()

>>> # Make input connections
>>> my_field = dpf.Field()
>>> op.inputs.field.connect(my_field)
>>> my_mesh_scoping = dpf.Scoping()
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
>>> my_collapse_shell_layers = bool()
>>> op.inputs.collapse_shell_layers.connect(my_collapse_shell_layers)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal(
... field=my_field,
... mesh_scoping=my_mesh_scoping,
... collapse_shell_layers=my_collapse_shell_layers,
... )

>>> # Get output data
>>> result_field = op.outputs.field()
"""

def __init__(
self,
field=None,
mesh_scoping=None,
collapse_shell_layers=None,
config=None,
server=None,
):
super().__init__(name="nodal_to_elemental_nodal", config=config, server=server)
self._inputs = InputsNodalToElementalNodal(self)
self._outputs = OutputsNodalToElementalNodal(self)
if field is not None:
self.inputs.field.connect(field)
if mesh_scoping is not None:
self.inputs.mesh_scoping.connect(mesh_scoping)
if collapse_shell_layers is not None:
self.inputs.collapse_shell_layers.connect(collapse_shell_layers)

@staticmethod
def _spec():
description = """Transforms a Nodal field to an ElementalNodal field, The result is
computed on a given element's 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""",
),
1: PinSpecification(
name="mesh_scoping",
type_names=["scoping"],
optional=True,
document="""""",
),
10: PinSpecification(
name="collapse_shell_layers",
type_names=["bool"],
optional=True,
document="""If true, shell layers are averaged as well
(default is false).""",
),
},
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="nodal_to_elemental_nodal", server=server)

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

Returns
--------
inputs : InputsNodalToElementalNodal
"""
return super().inputs

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

Returns
--------
outputs : OutputsNodalToElementalNodal
"""
return super().outputs


class InputsNodalToElementalNodal(_Inputs):
"""Intermediate class used to connect user inputs to
nodal_to_elemental_nodal operator.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal()
>>> my_field = dpf.Field()
>>> op.inputs.field.connect(my_field)
>>> my_mesh_scoping = dpf.Scoping()
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
>>> my_collapse_shell_layers = bool()
>>> op.inputs.collapse_shell_layers.connect(my_collapse_shell_layers)
"""

def __init__(self, op: Operator):
super().__init__(nodal_to_elemental_nodal._spec().inputs, op)
self._field = Input(nodal_to_elemental_nodal._spec().input_pin(0), 0, op, -1)
self._inputs.append(self._field)
self._mesh_scoping = Input(
nodal_to_elemental_nodal._spec().input_pin(1), 1, op, -1
)
self._inputs.append(self._mesh_scoping)
self._collapse_shell_layers = Input(
nodal_to_elemental_nodal._spec().input_pin(10), 10, op, -1
)
self._inputs.append(self._collapse_shell_layers)

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

Field or fields container with only one field
is expected

Parameters
----------
my_field : Field or FieldsContainer

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal()
>>> op.inputs.field.connect(my_field)
>>> # or
>>> op.inputs.field(my_field)
"""
return self._field

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

Parameters
----------
my_mesh_scoping : Scoping

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal()
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
>>> # or
>>> op.inputs.mesh_scoping(my_mesh_scoping)
"""
return self._mesh_scoping

@property
def collapse_shell_layers(self):
"""Allows to connect collapse_shell_layers input to the operator.

If true, shell layers are averaged as well
(default is false).

Parameters
----------
my_collapse_shell_layers : bool

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal()
>>> op.inputs.collapse_shell_layers.connect(my_collapse_shell_layers)
>>> # or
>>> op.inputs.collapse_shell_layers(my_collapse_shell_layers)
"""
return self._collapse_shell_layers


class OutputsNodalToElementalNodal(_Outputs):
"""Intermediate class used to get outputs from
nodal_to_elemental_nodal operator.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.averaging.nodal_to_elemental_nodal()
>>> # Connect inputs : op.inputs. ...
>>> result_field = op.outputs.field()
"""

def __init__(self, op: Operator):
super().__init__(nodal_to_elemental_nodal._spec().outputs, op)
self._field = Output(nodal_to_elemental_nodal._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.averaging.nodal_to_elemental_nodal()
>>> # Connect inputs : op.inputs. ...
>>> result_field = op.outputs.field()
""" # noqa: E501
return self._field
Loading
Loading