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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions docs/source/_static/dpf_operators.html

Large diffs are not rendered by default.

36 changes: 35 additions & 1 deletion src/ansys/dpf/core/operators/geo/elements_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class elements_volume(Operator):
Parameters
----------
mesh : MeshedRegion
mesh_scoping : Scoping


Examples
Expand All @@ -29,22 +30,27 @@ class elements_volume(Operator):
>>> # Make input connections
>>> my_mesh = dpf.MeshedRegion()
>>> op.inputs.mesh.connect(my_mesh)
>>> my_mesh_scoping = dpf.Scoping()
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.geo.elements_volume(
... mesh=my_mesh,
... mesh_scoping=my_mesh_scoping,
... )

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

def __init__(self, mesh=None, config=None, server=None):
def __init__(self, mesh=None, mesh_scoping=None, config=None, server=None):
super().__init__(name="element::volume", config=config, server=server)
self._inputs = InputsElementsVolume(self)
self._outputs = OutputsElementsVolume(self)
if mesh is not None:
self.inputs.mesh.connect(mesh)
if mesh_scoping is not None:
self.inputs.mesh_scoping.connect(mesh_scoping)

@staticmethod
def _spec():
Expand All @@ -59,6 +65,12 @@ def _spec():
optional=False,
document="""""",
),
1: PinSpecification(
name="mesh_scoping",
type_names=["scoping"],
optional=False,
document="""""",
),
},
map_output_pin_spec={
0: PinSpecification(
Expand Down Expand Up @@ -118,12 +130,16 @@ class InputsElementsVolume(_Inputs):
>>> op = dpf.operators.geo.elements_volume()
>>> my_mesh = dpf.MeshedRegion()
>>> op.inputs.mesh.connect(my_mesh)
>>> my_mesh_scoping = dpf.Scoping()
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
"""

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

@property
def mesh(self):
Expand All @@ -143,6 +159,24 @@ def mesh(self):
"""
return self._mesh

@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.geo.elements_volume()
>>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
>>> # or
>>> op.inputs.mesh_scoping(my_mesh_scoping)
"""
return self._mesh_scoping


class OutputsElementsVolume(_Outputs):
"""Intermediate class used to get outputs from
Expand Down
21 changes: 12 additions & 9 deletions src/ansys/dpf/core/operators/mesh/from_scoping.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ class from_scoping(Operator):
transposed respecting the inclusive
pin
inclusive : int, optional
If inclusive == 1 then all the elements
If inclusive == 1 then all the elements/faces
adjacent to the nodes ids in input
are added, if inclusive == 0, only
the elements which have all their
nodes in the scoping are included
the elements/faces which have all
their nodes in the scoping are
included
nodes_only : bool, optional
Returns mesh with nodes only (without any
elements). default is false.
Expand Down Expand Up @@ -101,11 +102,12 @@ def _spec():
name="inclusive",
type_names=["int32"],
optional=True,
document="""If inclusive == 1 then all the elements
document="""If inclusive == 1 then all the elements/faces
adjacent to the nodes ids in input
are added, if inclusive == 0, only
the elements which have all their
nodes in the scoping are included""",
the elements/faces which have all
their nodes in the scoping are
included""",
),
3: PinSpecification(
name="nodes_only",
Expand Down Expand Up @@ -224,11 +226,12 @@ def scoping(self):
def inclusive(self):
"""Allows to connect inclusive input to the operator.

If inclusive == 1 then all the elements
If inclusive == 1 then all the elements/faces
adjacent to the nodes ids in input
are added, if inclusive == 0, only
the elements which have all their
nodes in the scoping are included
the elements/faces which have all
their nodes in the scoping are
included

Parameters
----------
Expand Down
21 changes: 12 additions & 9 deletions src/ansys/dpf/core/operators/mesh/from_scopings.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ class from_scopings(Operator):
transposed respecting the inclusive
pin
inclusive : int, optional
If inclusive == 1 then all the elements
If inclusive == 1 then all the elements/faces
adjacent to the nodes ids in input
are added, if inclusive == 0, only
the elements which have all their
nodes in the scoping are included
the elements/faces which have all
their nodes in the scoping are
included
nodes_only : bool, optional
Returns mesh with nodes only (without any
elements). default is false.
Expand Down Expand Up @@ -101,11 +102,12 @@ def _spec():
name="inclusive",
type_names=["int32"],
optional=True,
document="""If inclusive == 1 then all the elements
document="""If inclusive == 1 then all the elements/faces
adjacent to the nodes ids in input
are added, if inclusive == 0, only
the elements which have all their
nodes in the scoping are included""",
the elements/faces which have all
their nodes in the scoping are
included""",
),
3: PinSpecification(
name="nodes_only",
Expand Down Expand Up @@ -224,11 +226,12 @@ def scopings_container(self):
def inclusive(self):
"""Allows to connect inclusive input to the operator.

If inclusive == 1 then all the elements
If inclusive == 1 then all the elements/faces
adjacent to the nodes ids in input
are added, if inclusive == 0, only
the elements which have all their
nodes in the scoping are included
the elements/faces which have all
their nodes in the scoping are
included

Parameters
----------
Expand Down
22 changes: 10 additions & 12 deletions src/ansys/dpf/core/operators/metadata/mesh_info_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class mesh_info_provider(Operator):
... )

>>> # Get output data
>>> result_generic_data_container = op.outputs.generic_data_container()
>>> result_mesh_info = op.outputs.mesh_info()
"""

def __init__(
Expand Down Expand Up @@ -102,7 +102,7 @@ def _spec():
},
map_output_pin_spec={
0: PinSpecification(
name="generic_data_container",
name="mesh_info",
type_names=["generic_data_container"],
optional=False,
document="""""",
Expand Down Expand Up @@ -246,29 +246,27 @@ class OutputsMeshInfoProvider(_Outputs):
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.metadata.mesh_info_provider()
>>> # Connect inputs : op.inputs. ...
>>> result_generic_data_container = op.outputs.generic_data_container()
>>> result_mesh_info = op.outputs.mesh_info()
"""

def __init__(self, op: Operator):
super().__init__(mesh_info_provider._spec().outputs, op)
self._generic_data_container = Output(
mesh_info_provider._spec().output_pin(0), 0, op
)
self._outputs.append(self._generic_data_container)
self._mesh_info = Output(mesh_info_provider._spec().output_pin(0), 0, op)
self._outputs.append(self._mesh_info)

@property
def generic_data_container(self):
"""Allows to get generic_data_container output of the operator
def mesh_info(self):
"""Allows to get mesh_info output of the operator

Returns
----------
my_generic_data_container : GenericDataContainer
my_mesh_info : GenericDataContainer

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.metadata.mesh_info_provider()
>>> # Connect inputs : op.inputs. ...
>>> result_generic_data_container = op.outputs.generic_data_container()
>>> result_mesh_info = op.outputs.mesh_info()
""" # noqa: E501
return self._generic_data_container
return self._mesh_info
1 change: 1 addition & 0 deletions src/ansys/dpf/core/operators/scoping/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .change_fc import change_fc
from .compute_element_centroids import compute_element_centroids
from .connectivity_ids import connectivity_ids
from .elemental_from_mesh import elemental_from_mesh
from .from_mesh import from_mesh
Expand Down
Loading