diff --git a/doc/source/_static/dpf_operators.html b/doc/source/_static/dpf_operators.html index 22b9c75c299..4dcdc4d4cda 100644 --- a/doc/source/_static/dpf_operators.html +++ b/doc/source/_static/dpf_operators.html @@ -7744,7 +7744,166 @@

Configurating operators

If true, this pin forces the results to be split by element shape, indicated by the presence of the 'elshape' label in the output. If false, the results for all elements shapes are combined. Default value is false if averaging is not required and true if averaging is required.

If connected, this pin allows you to extract the result only on the selected shell layer(s). The available values are: 0: Top, 1: Bottom, 2: TopBottom, 3: Mid, 4: TopBottomMid.

Compute mid nodes (when available) by averaging the neighbour corner nodes. Default: True

-

Outputs

Configurations

Scripting

Changelog

geo: cartesian to spherical coordinates (fields container)

Description

Converts 3D field from cartesian coordinates to spherical coordinates.

+

Outputs

Configurations

Scripting

Changelog

utility: transpose fields container

Description

Transposes a fields container so that the fields' scoping becomes the container's scoping and a chosen label (default: time) becomes the fields' scoping.

+

Input layout (example with time label, 2 body labels, 3 nodes): +FC labels: [time, body] +Field 0: {time:1, body:1} -> scoping {n1, n2, n3}, data [...] +Field 1: {time:1, body:2} -> scoping {n4, n5}, data [...] +Field 2: {time:2, body:1} -> scoping {n1, n2, n3}, data [...] +Field 3: {time:2, body:2} -> scoping {n4, n5}, data [...]

+

Output layout (transposed on time): +FC labels: [Nodal, body] +Field 0: {Nodal:n1, body:1} -> scoping {t1, t2}, data [gathered from fields 0,2] +Field 1: {Nodal:n2, body:1} -> scoping {t1, t2}, data [gathered from fields 0,2] +Field 1: {Nodal:n3, body:1} -> scoping {t1, t2}, data [gathered from fields 0,2] +Field 2: {Nodal:n4, body:2} -> scoping {t1, t2}, data [gathered from fields 1,3] +Field 3: {Nodal:n5, body:2} -> scoping {t1, t2}, data [gathered from fields 1,3] +...

+

Each output field gathers one entity's data across all values of the transposed label from the input fields that share the same non-transposed labels. All input fields sharing a labelspace where only the transposed label changes must have the same scoping and location.

+
Version 1.0.0

Inputs

It is assumed that the fields container consists of fields having the same scoping.

+

fields container label to use as fields label (default is time)

+

Outputs

Configurations

Scripting

Changelog

result: accu eqv creep strain

Description

Read/compute element nodal accumulated equivalent creep strain by calling the readers defined by the datasources.

+
    +
  • The 'requested_location' and 'mesh_scoping' inputs are processed to see if they need scoping transposition or result averaging. The resulting output fields have a 'Nodal', 'ElementalNodal' or 'Elemental' location.
  • +
  • Once the need for averaging has been detected, the behavior of the combined connection of the 'split_shells' and 'shell_layer' pins is:
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Averaging is needed'split_shells''shell_layer'Expected output
NoNot connected/falseNot connectedLocation as in the result file. Fields with all element shapes combined. All shell layers present.
NotrueNot connectedLocation as in the result file. Fields split according to element shapes. All shell layers present.
NotrueConnectedLocation as in the result file. Fields split according to element shapes. Only the requested shell layer present.
NoNot connected/falseConnectedLocation as in the result file. Fields with all element shapes combined. Only the requested shell layer present.
YesNot connected/trueNot connectedLocation as requested. Fields split according to element shapes. All shell layers present.
YesfalseNot connectedLocation as requested. Fields with all element shapes combined. All shell layers present.
YesfalseConnectedLocation as requested. Fields with all element shapes combined. Only the requested shell layer present.
YesNot connected/trueConnectedLocation as requested. Fields split according to element shapes. Only the requested shell layer present.
+
    +
  • The available 'elshape' values are:
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
elshapeRelated elements
1Shell (generic)
2Solid
3Beam
4Skin
5Contact
6Load
7Point
8Shell with 1 result across thickness (membrane)
9Shell with 2 results across thickness (top/bottom)
10Shell with 3 results across thickness (top/bottom/mid)
11Gasket
12Multi-Point Constraint
13Pretension
+
Version 1.0.0

Supported file types

Inputs

time/freq values (use doubles or field), time/freq set ids (use ints or scoping) or time/freq step ids (use scoping with TimeFreq_steps location) required in output. To specify time/freq values at specific load steps, put a Field (and not a list) in input with a scoping located on "TimeFreq_steps". Linear time freq intrapolation is performed if the values are not in the result files and the data at the max time or freq is taken when time/freqs are higher than available time/freqs in result files. To get all data for all time/freq sets, connect an int with value -1.

+

nodes or elements scoping required in output. The output fields will be scoped on these node or element IDs. To figure out the ordering of the fields data, look at their scoping IDs as they might not be ordered as the input scoping was. The scoping's location indicates whether nodes or elements are asked for. Using scopings container allows you to split the result fields container into domains

+

Fields container already allocated modified inplace

+

result file container allowed to be kept open to cache data

+

result file path container, used if no streams are set

+

prevents from reading the mesh in the result files

+

requested location Nodal, Elemental or ElementalNodal

+

elemental nodal beam results are read if this pin is set to true (default is false)

+

If true, this pin forces the results to be split by element shape, indicated by the presence of the 'elshape' label in the output. If false, the results for all elements shapes are combined. Default value is false if averaging is not required and true if averaging is required.

+

If connected, this pin allows you to extract the result only on the selected shell layer(s). The available values are: 0: Top, 1: Bottom, 2: TopBottom, 3: Mid, 4: TopBottomMid.

+

Compute mid nodes (when available) by averaging the neighbour corner nodes. Default: True

+

Outputs

Configurations

Scripting

Changelog

geo: cartesian to spherical coordinates (fields container)

Description

Converts 3D field from cartesian coordinates to spherical coordinates.

Version 0.0.1

Inputs

Outputs

Configurations

Scripting

Changelog

result: reaction force X

Description

Read/compute nodal reaction forces X component of the vector (1st component) by calling the readers defined by the datasources.

Version 0.0.0

Supported file types

Inputs

time/freq values (use doubles or field), time/freq set ids (use ints or scoping) or time/freq step ids (use scoping with TimeFreq_steps location) required in output. To specify time/freq values at specific load steps, put a Field (and not a list) in input with a scoping located on "TimeFreq_steps". Linear time freq intrapolation is performed if the values are not in the result files and the data at the max time or freq is taken when time/freqs are higher than available time/freqs in result files. To get all data for all time/freq sets, connect an int with value -1.

nodes or elements scoping required in output. The output fields will be scoped on these node or element IDs. To figure out the ordering of the fields data, look at their scoping IDs as they might not be ordered as the input scoping was. The scoping's location indicates whether nodes or elements are asked for. Using scopings container allows you to split the result fields container into domains

@@ -10040,13 +10199,13 @@

LaTeX

$r_i$ is the mode-specific damping ratio (pin 2, default $0$), $\alpha$ is the mass-proportional Rayleigh coefficient (pin 3), and $\beta$ is the stiffness-proportional Rayleigh coefficient (pin 4).

-
Version 0.0.1

Inputs

input vector expects natural frequencies.

+
Version 0.1.0

Inputs

input vector expects natural frequencies.

constant modal damping ratio

modal damping ratio for each mode shape

global mass matrix multiplier

global stiffness matrix multiplier

Outputs

Field of modal damping ratios $\xi_i$, one value per mode, in the same order as the input natural frequencies.

-

Configurations

Scripting

Changelog

filter: band pass (field)

Description

The band pass filter returns all the values above (but not equal to) the minimum threshold value and below (but not equal to) the maximum threshold value in input.

+

Configurations

Scripting

Changelog

filter: band pass (field)

Description

The band pass filter returns all the values above (but not equal to) the minimum threshold value and below (but not equal to) the maximum threshold value in input.

Version 0.0.1

Inputs

field or fields container with only one field is expected

A minimum threshold scalar or a field containing one value is expected.

A maximum threshold scalar or a field containing one value is expected.

@@ -12833,148 +12992,7 @@

LaTeX

If true, this pin forces the results to be split by element shape, indicated by the presence of the 'elshape' label in the output. If false, the results for all elements shapes are combined. Default value is false if averaging is not required and true if averaging is required.

If connected, this pin allows you to extract the result only on the selected shell layer(s). The available values are: 0: Top, 1: Bottom, 2: TopBottom, 3: Mid, 4: TopBottomMid.

Compute mid nodes (when available) by averaging the neighbour corner nodes. Default: True

-

Outputs

Configurations

Scripting

Changelog

result: accu eqv creep strain

Description

Read/compute element nodal accumulated equivalent creep strain by calling the readers defined by the datasources.

-
    -
  • The 'requested_location' and 'mesh_scoping' inputs are processed to see if they need scoping transposition or result averaging. The resulting output fields have a 'Nodal', 'ElementalNodal' or 'Elemental' location.
  • -
  • Once the need for averaging has been detected, the behavior of the combined connection of the 'split_shells' and 'shell_layer' pins is:
  • -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Averaging is needed'split_shells''shell_layer'Expected output
NoNot connected/falseNot connectedLocation as in the result file. Fields with all element shapes combined. All shell layers present.
NotrueNot connectedLocation as in the result file. Fields split according to element shapes. All shell layers present.
NotrueConnectedLocation as in the result file. Fields split according to element shapes. Only the requested shell layer present.
NoNot connected/falseConnectedLocation as in the result file. Fields with all element shapes combined. Only the requested shell layer present.
YesNot connected/trueNot connectedLocation as requested. Fields split according to element shapes. All shell layers present.
YesfalseNot connectedLocation as requested. Fields with all element shapes combined. All shell layers present.
YesfalseConnectedLocation as requested. Fields with all element shapes combined. Only the requested shell layer present.
YesNot connected/trueConnectedLocation as requested. Fields split according to element shapes. Only the requested shell layer present.
-
    -
  • The available 'elshape' values are:
  • -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
elshapeRelated elements
1Shell (generic)
2Solid
3Beam
4Skin
5Contact
6Load
7Point
8Shell with 1 result across thickness (membrane)
9Shell with 2 results across thickness (top/bottom)
10Shell with 3 results across thickness (top/bottom/mid)
11Gasket
12Multi-Point Constraint
13Pretension
-
Version 1.0.0

Supported file types

Inputs

time/freq values (use doubles or field), time/freq set ids (use ints or scoping) or time/freq step ids (use scoping with TimeFreq_steps location) required in output. To specify time/freq values at specific load steps, put a Field (and not a list) in input with a scoping located on "TimeFreq_steps". Linear time freq intrapolation is performed if the values are not in the result files and the data at the max time or freq is taken when time/freqs are higher than available time/freqs in result files. To get all data for all time/freq sets, connect an int with value -1.

-

nodes or elements scoping required in output. The output fields will be scoped on these node or element IDs. To figure out the ordering of the fields data, look at their scoping IDs as they might not be ordered as the input scoping was. The scoping's location indicates whether nodes or elements are asked for. Using scopings container allows you to split the result fields container into domains

-

Fields container already allocated modified inplace

-

result file container allowed to be kept open to cache data

-

result file path container, used if no streams are set

-

prevents from reading the mesh in the result files

-

requested location Nodal, Elemental or ElementalNodal

-

elemental nodal beam results are read if this pin is set to true (default is false)

-

If true, this pin forces the results to be split by element shape, indicated by the presence of the 'elshape' label in the output. If false, the results for all elements shapes are combined. Default value is false if averaging is not required and true if averaging is required.

-

If connected, this pin allows you to extract the result only on the selected shell layer(s). The available values are: 0: Top, 1: Bottom, 2: TopBottom, 3: Mid, 4: TopBottomMid.

-

Compute mid nodes (when available) by averaging the neighbour corner nodes. Default: True

-

Outputs

Configurations

Scripting

Changelog

result: plastic strain energy density

Description

Read/compute element nodal plastic strain energy density by calling the readers defined by the datasources.

+

Outputs

Configurations

Scripting

Changelog

result: plastic strain energy density

Description

Read/compute element nodal plastic strain energy density by calling the readers defined by the datasources.

  • The 'requested_location' and 'mesh_scoping' inputs are processed to see if they need scoping transposition or result averaging. The resulting output fields have a 'Nodal', 'ElementalNodal' or 'Elemental' location.
  • Once the need for averaging has been detected, the behavior of the combined connection of the 'split_shells' and 'shell_layer' pins is:
  • @@ -15492,7 +15510,7 @@

    LaTeX

Result file container allowed to be kept open to cache data.

Result file path container, used if no streams are set.

Outputs

Configurations

Scripting

Changelog

metadata: coordinate system data provider

Description

Reads coordinate systems data from the result files contained in the streams or data sources.

-
Version 0.0.0

Supported file types

Inputs

Coorfinate System ids to recover used by the solver. If not set, all available materials to be recovered.

+
Version 0.0.0

Supported file types

Inputs

Coorfinate System ids to recover used by the solver. If not set, all available materials to be recovered.

Result file container allowed to be kept open to cache data.

Result file path container, used if no streams are set.

Outputs

Configurations

Scripting

Changelog

logic: splitter::streams

Description

Splits a Streams into multiple coherent streams, actual number of outputs is always less or equal to the given desired number of ouputs.

@@ -16622,15 +16640,7 @@

Performance considerations

defines the threshold scale for wireframe (default: 2.0)

defines the angular limit in radian for edge decimation (default: 1.0)

Outputs

Data Source containing the dfmf file generated.

-

Configurations

Scripting

Changelog

result: split on facet indices

Description

Splits each Field in a FieldsContainer defined on the skin elements of a mesh according to the local facets indices of its corresponding solid element. The output FieldsContainer retains the original labels and adds a 'facet' label, which indicates at which facet of the solid mesh was the original skin element located. The facet ids are according to MAPDL convention. The scoping of the output Fields reflects the element indices in the solid mesh.

-
Version 0.0.3

Inputs

Fields container to split, with generic number of labels (e.g. time, zone, complex...). Fields may have Elemental or ElementalNodal location; scoping ids are skin element ids.

-

This property field provides, for each new face element ID (in the scoping), the corresponding 3D volume element index (in the data) it has been extracted from. The 3D volume element ID can be found with the element scoping of the input mesh.

-

This property field gives, for each new face element ID (in the scoping), the corresponding face index on the source 3D volume element. The 3D volume element can be extracted from the previous output.

-

The solid support.

-

Elemental scoping of tet elements. If connected, the tets in the scoping are treated as degenerated tets (SOLID185), and the rest as non-degenerated tets (SOLID285). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285).

-

Elemental scoping of tet elements. If connected, the tets in the scoping are treated as non-degenerated tets (SOLID285), and the rest as degenerated tets (SOLID185). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285).

-

Outputs

Output splitted fields containter

-

Configurations

Scripting

Changelog

result: split to acmo facet indices

Description

This will retain the already existing labels from the input FC and will change the facet label to now mean ACMO facet indices.Each Field in the input will be split/merged into several Fields, redistributing the data to the appropriate entity.

+

Configurations

Scripting

Changelog

result: split to acmo facet indices

Description

This will retain the already existing labels from the input FC and will change the facet label to now mean ACMO facet indices.Each Field in the input will be split/merged into several Fields, redistributing the data to the appropriate entity.

Version 0.0.2

Inputs

Fields container to split, with generic number of labels (e.g. time, zone, complex...), 'facet' label is compulsory.The Scopings of the Fields will be the Element Ids on the skin mesh.

It should only have the 'facet' label. For each facet, it stores a PropertyField with the element types of the corresponding elements.The scoping should be the same as the scoping of the corresponding Field in input 0.

Outputs

Output splitted fields containter

diff --git a/src/ansys/dpf/core/operators/math/modal_damping_ratio.py b/src/ansys/dpf/core/operators/math/modal_damping_ratio.py index be69df2b19c..95f262dd8f9 100644 --- a/src/ansys/dpf/core/operators/math/modal_damping_ratio.py +++ b/src/ansys/dpf/core/operators/math/modal_damping_ratio.py @@ -17,6 +17,7 @@ if TYPE_CHECKING: from ansys.dpf.core.field import Field + from ansys.dpf.core.time_freq_support import TimeFreqSupport class modal_damping_ratio(Operator): @@ -36,7 +37,7 @@ class modal_damping_ratio(Operator): Inputs ------ - natural_freq: + natural_freq: Field or TimeFreqSupport input vector expects natural frequencies. const_ratio: float, optional constant modal damping ratio @@ -60,7 +61,7 @@ class modal_damping_ratio(Operator): >>> op = dpf.operators.math.modal_damping_ratio() >>> # Make input connections - >>> my_natural_freq = dpf.() + >>> my_natural_freq = dpf.Field() >>> op.inputs.natural_freq.connect(my_natural_freq) >>> my_const_ratio = float() >>> op.inputs.const_ratio.connect(my_const_ratio) @@ -132,7 +133,7 @@ def _spec() -> Specification: map_input_pin_spec={ 0: PinSpecification( name="natural_freq", - type_names=["vector"], + type_names=["vector", "field", "time_freq_support"], optional=False, document=r"""input vector expects natural frequencies.""", ), @@ -224,7 +225,7 @@ class InputsModalDampingRatio(_Inputs): -------- >>> from ansys.dpf import core as dpf >>> op = dpf.operators.math.modal_damping_ratio() - >>> my_natural_freq = dpf.() + >>> my_natural_freq = dpf.Field() >>> op.inputs.natural_freq.connect(my_natural_freq) >>> my_const_ratio = float() >>> op.inputs.const_ratio.connect(my_const_ratio) @@ -238,7 +239,7 @@ class InputsModalDampingRatio(_Inputs): def __init__(self, op: Operator): super().__init__(modal_damping_ratio._spec().inputs, op) - self._natural_freq: Input = Input( + self._natural_freq: Input[Field | TimeFreqSupport] = Input( modal_damping_ratio._spec().input_pin(0), 0, op, -1 ) self._inputs.append(self._natural_freq) @@ -260,7 +261,7 @@ def __init__(self, op: Operator): self._inputs.append(self._k_coefficient) @property - def natural_freq(self) -> Input: + def natural_freq(self) -> Input[Field | TimeFreqSupport]: r"""Allows to connect natural_freq input to the operator. input vector expects natural frequencies. diff --git a/src/ansys/dpf/core/operators/result/__init__.py b/src/ansys/dpf/core/operators/result/__init__.py index a98e6a24fc8..64a0fade3c4 100644 --- a/src/ansys/dpf/core/operators/result/__init__.py +++ b/src/ansys/dpf/core/operators/result/__init__.py @@ -217,7 +217,6 @@ from .magnetic_vector_potential import magnetic_vector_potential from .mapdl_material_properties import mapdl_material_properties from .mapdl_section import mapdl_section -from .mapdl_split_on_facet_indices import mapdl_split_on_facet_indices from .mapdl_split_to_acmo_facet_indices import mapdl_split_to_acmo_facet_indices from .mass_flow_rate import mass_flow_rate from .mass_fraction import mass_fraction diff --git a/src/ansys/dpf/core/operators/result/mapdl_split_on_facet_indices.py b/src/ansys/dpf/core/operators/result/mapdl_split_on_facet_indices.py deleted file mode 100644 index 0fd5b92f6c2..00000000000 --- a/src/ansys/dpf/core/operators/result/mapdl_split_on_facet_indices.py +++ /dev/null @@ -1,443 +0,0 @@ -""" -mapdl_split_on_facet_indices - -Autogenerated DPF operator classes. -""" - -from __future__ import annotations -from typing import TYPE_CHECKING - -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 - -if TYPE_CHECKING: - from ansys.dpf.core.fields_container import FieldsContainer - from ansys.dpf.core.meshed_region import MeshedRegion - from ansys.dpf.core.property_field import PropertyField - from ansys.dpf.core.scoping import Scoping - - -class mapdl_split_on_facet_indices(Operator): - r"""Splits each Field in a FieldsContainer defined on the skin elements of a - mesh according to the local facets indices of its corresponding solid - element. The output FieldsContainer retains the original labels and adds - a ‘facet’ label, which indicates at which facet of the solid mesh was - the original skin element located. The facet ids are according to MAPDL - convention. The scoping of the output Fields reflects the element - indices in the solid mesh. - - - Inputs - ------ - fields_container: FieldsContainer - Fields container to split, with generic number of labels (e.g. time, zone, complex...). Fields may have Elemental or ElementalNodal location; scoping ids are skin element ids. - property_field_new_elements_to_old: PropertyField - This property field provides, for each new face element ID (in the scoping), the corresponding 3D volume element index (in the data) it has been extracted from. The 3D volume element ID can be found with the element scoping of the input mesh. - facet_indices: PropertyField - This property field gives, for each new face element ID (in the scoping), the corresponding face index on the source 3D volume element. The 3D volume element can be extracted from the previous output. - volume_mesh: MeshedRegion - The solid support. - degenerated_tets: Scoping, optional - Elemental scoping of tet elements. If connected, the tets in the scoping are treated as degenerated tets (SOLID185), and the rest as non-degenerated tets (SOLID285). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285). - non_degenerated_tets: Scoping, optional - Elemental scoping of tet elements. If connected, the tets in the scoping are treated as non-degenerated tets (SOLID285), and the rest as degenerated tets (SOLID185). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285). - - Outputs - ------- - fields_container: FieldsContainer - Output splitted fields containter - - Examples - -------- - >>> from ansys.dpf import core as dpf - - >>> # Instantiate operator - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - - >>> # Make input connections - >>> my_fields_container = dpf.FieldsContainer() - >>> op.inputs.fields_container.connect(my_fields_container) - >>> my_property_field_new_elements_to_old = dpf.PropertyField() - >>> op.inputs.property_field_new_elements_to_old.connect(my_property_field_new_elements_to_old) - >>> my_facet_indices = dpf.PropertyField() - >>> op.inputs.facet_indices.connect(my_facet_indices) - >>> my_volume_mesh = dpf.MeshedRegion() - >>> op.inputs.volume_mesh.connect(my_volume_mesh) - >>> my_degenerated_tets = dpf.Scoping() - >>> op.inputs.degenerated_tets.connect(my_degenerated_tets) - >>> my_non_degenerated_tets = dpf.Scoping() - >>> op.inputs.non_degenerated_tets.connect(my_non_degenerated_tets) - - >>> # Instantiate operator and connect inputs in one line - >>> op = dpf.operators.result.mapdl_split_on_facet_indices( - ... fields_container=my_fields_container, - ... property_field_new_elements_to_old=my_property_field_new_elements_to_old, - ... facet_indices=my_facet_indices, - ... volume_mesh=my_volume_mesh, - ... degenerated_tets=my_degenerated_tets, - ... non_degenerated_tets=my_non_degenerated_tets, - ... ) - - >>> # Get output data - >>> result_fields_container = op.outputs.fields_container() - """ - - def __init__( - self, - fields_container=None, - property_field_new_elements_to_old=None, - facet_indices=None, - volume_mesh=None, - degenerated_tets=None, - non_degenerated_tets=None, - config=None, - server=None, - ): - super().__init__( - name="mapdl::split_on_facet_indices", - config=config, - server=server, - inputs_type=InputsMapdlSplitOnFacetIndices, - outputs_type=OutputsMapdlSplitOnFacetIndices, - ) - if fields_container is not None: - self.inputs.fields_container.connect(fields_container) - if property_field_new_elements_to_old is not None: - self.inputs.property_field_new_elements_to_old.connect( - property_field_new_elements_to_old - ) - if facet_indices is not None: - self.inputs.facet_indices.connect(facet_indices) - if volume_mesh is not None: - self.inputs.volume_mesh.connect(volume_mesh) - if degenerated_tets is not None: - self.inputs.degenerated_tets.connect(degenerated_tets) - if non_degenerated_tets is not None: - self.inputs.non_degenerated_tets.connect(non_degenerated_tets) - - @staticmethod - def _spec() -> Specification: - description = r"""Splits each Field in a FieldsContainer defined on the skin elements of a -mesh according to the local facets indices of its corresponding solid -element. The output FieldsContainer retains the original labels and adds -a ‘facet’ label, which indicates at which facet of the solid mesh was -the original skin element located. The facet ids are according to MAPDL -convention. The scoping of the output Fields reflects the element -indices in the solid mesh. -""" - spec = Specification( - description=description, - map_input_pin_spec={ - 0: PinSpecification( - name="fields_container", - type_names=["fields_container"], - optional=False, - document=r"""Fields container to split, with generic number of labels (e.g. time, zone, complex...). Fields may have Elemental or ElementalNodal location; scoping ids are skin element ids.""", - ), - 1: PinSpecification( - name="property_field_new_elements_to_old", - type_names=["property_field"], - optional=False, - document=r"""This property field provides, for each new face element ID (in the scoping), the corresponding 3D volume element index (in the data) it has been extracted from. The 3D volume element ID can be found with the element scoping of the input mesh.""", - ), - 2: PinSpecification( - name="facet_indices", - type_names=["property_field"], - optional=False, - document=r"""This property field gives, for each new face element ID (in the scoping), the corresponding face index on the source 3D volume element. The 3D volume element can be extracted from the previous output.""", - ), - 3: PinSpecification( - name="volume_mesh", - type_names=["abstract_meshed_region"], - optional=False, - document=r"""The solid support.""", - ), - 185: PinSpecification( - name="degenerated_tets", - type_names=["scoping"], - optional=True, - document=r"""Elemental scoping of tet elements. If connected, the tets in the scoping are treated as degenerated tets (SOLID185), and the rest as non-degenerated tets (SOLID285). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285).""", - ), - 285: PinSpecification( - name="non_degenerated_tets", - type_names=["scoping"], - optional=True, - document=r"""Elemental scoping of tet elements. If connected, the tets in the scoping are treated as non-degenerated tets (SOLID285), and the rest as degenerated tets (SOLID185). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285).""", - ), - }, - map_output_pin_spec={ - 0: PinSpecification( - name="fields_container", - type_names=["fields_container"], - optional=False, - document=r"""Output splitted fields containter""", - ), - }, - ) - return spec - - @staticmethod - 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 - instantiate the operator. The Configuration allows to customize - how the operation will be processed by the operator. - - Parameters - ---------- - 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="mapdl::split_on_facet_indices", server=server - ) - - @property - def inputs(self) -> InputsMapdlSplitOnFacetIndices: - """Enables to connect inputs to the operator - - Returns - -------- - inputs: - An instance of InputsMapdlSplitOnFacetIndices. - """ - return self._inputs - - @property - def outputs(self) -> OutputsMapdlSplitOnFacetIndices: - """Enables to get outputs of the operator by evaluating it - - Returns - -------- - outputs: - An instance of OutputsMapdlSplitOnFacetIndices. - """ - return self._outputs - - -class InputsMapdlSplitOnFacetIndices(_Inputs): - """Intermediate class used to connect user inputs to - mapdl_split_on_facet_indices operator. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> my_fields_container = dpf.FieldsContainer() - >>> op.inputs.fields_container.connect(my_fields_container) - >>> my_property_field_new_elements_to_old = dpf.PropertyField() - >>> op.inputs.property_field_new_elements_to_old.connect(my_property_field_new_elements_to_old) - >>> my_facet_indices = dpf.PropertyField() - >>> op.inputs.facet_indices.connect(my_facet_indices) - >>> my_volume_mesh = dpf.MeshedRegion() - >>> op.inputs.volume_mesh.connect(my_volume_mesh) - >>> my_degenerated_tets = dpf.Scoping() - >>> op.inputs.degenerated_tets.connect(my_degenerated_tets) - >>> my_non_degenerated_tets = dpf.Scoping() - >>> op.inputs.non_degenerated_tets.connect(my_non_degenerated_tets) - """ - - def __init__(self, op: Operator): - super().__init__(mapdl_split_on_facet_indices._spec().inputs, op) - self._fields_container: Input[FieldsContainer] = Input( - mapdl_split_on_facet_indices._spec().input_pin(0), 0, op, -1 - ) - self._inputs.append(self._fields_container) - self._property_field_new_elements_to_old: Input[PropertyField] = Input( - mapdl_split_on_facet_indices._spec().input_pin(1), 1, op, -1 - ) - self._inputs.append(self._property_field_new_elements_to_old) - self._facet_indices: Input[PropertyField] = Input( - mapdl_split_on_facet_indices._spec().input_pin(2), 2, op, -1 - ) - self._inputs.append(self._facet_indices) - self._volume_mesh: Input[MeshedRegion] = Input( - mapdl_split_on_facet_indices._spec().input_pin(3), 3, op, -1 - ) - self._inputs.append(self._volume_mesh) - self._degenerated_tets: Input[Scoping] = Input( - mapdl_split_on_facet_indices._spec().input_pin(185), 185, op, -1 - ) - self._inputs.append(self._degenerated_tets) - self._non_degenerated_tets: Input[Scoping] = Input( - mapdl_split_on_facet_indices._spec().input_pin(285), 285, op, -1 - ) - self._inputs.append(self._non_degenerated_tets) - - @property - def fields_container(self) -> Input[FieldsContainer]: - r"""Allows to connect fields_container input to the operator. - - Fields container to split, with generic number of labels (e.g. time, zone, complex...). Fields may have Elemental or ElementalNodal location; scoping ids are skin element ids. - - Returns - ------- - input: - An Input instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> op.inputs.fields_container.connect(my_fields_container) - >>> # or - >>> op.inputs.fields_container(my_fields_container) - """ - return self._fields_container - - @property - def property_field_new_elements_to_old(self) -> Input[PropertyField]: - r"""Allows to connect property_field_new_elements_to_old input to the operator. - - This property field provides, for each new face element ID (in the scoping), the corresponding 3D volume element index (in the data) it has been extracted from. The 3D volume element ID can be found with the element scoping of the input mesh. - - Returns - ------- - input: - An Input instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> op.inputs.property_field_new_elements_to_old.connect(my_property_field_new_elements_to_old) - >>> # or - >>> op.inputs.property_field_new_elements_to_old(my_property_field_new_elements_to_old) - """ - return self._property_field_new_elements_to_old - - @property - def facet_indices(self) -> Input[PropertyField]: - r"""Allows to connect facet_indices input to the operator. - - This property field gives, for each new face element ID (in the scoping), the corresponding face index on the source 3D volume element. The 3D volume element can be extracted from the previous output. - - Returns - ------- - input: - An Input instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> op.inputs.facet_indices.connect(my_facet_indices) - >>> # or - >>> op.inputs.facet_indices(my_facet_indices) - """ - return self._facet_indices - - @property - def volume_mesh(self) -> Input[MeshedRegion]: - r"""Allows to connect volume_mesh input to the operator. - - The solid support. - - Returns - ------- - input: - An Input instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> op.inputs.volume_mesh.connect(my_volume_mesh) - >>> # or - >>> op.inputs.volume_mesh(my_volume_mesh) - """ - return self._volume_mesh - - @property - def degenerated_tets(self) -> Input[Scoping]: - r"""Allows to connect degenerated_tets input to the operator. - - Elemental scoping of tet elements. If connected, the tets in the scoping are treated as degenerated tets (SOLID185), and the rest as non-degenerated tets (SOLID285). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285). - - Returns - ------- - input: - An Input instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> op.inputs.degenerated_tets.connect(my_degenerated_tets) - >>> # or - >>> op.inputs.degenerated_tets(my_degenerated_tets) - """ - return self._degenerated_tets - - @property - def non_degenerated_tets(self) -> Input[Scoping]: - r"""Allows to connect non_degenerated_tets input to the operator. - - Elemental scoping of tet elements. If connected, the tets in the scoping are treated as non-degenerated tets (SOLID285), and the rest as degenerated tets (SOLID185). Pins 185 and 285 are mutually exclusionary (they cannot be connected at the same time), and if none of them is connected, all tets are treated as non-degenerated (SOLID285). - - Returns - ------- - input: - An Input instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> op.inputs.non_degenerated_tets.connect(my_non_degenerated_tets) - >>> # or - >>> op.inputs.non_degenerated_tets(my_non_degenerated_tets) - """ - return self._non_degenerated_tets - - -class OutputsMapdlSplitOnFacetIndices(_Outputs): - """Intermediate class used to get outputs from - mapdl_split_on_facet_indices operator. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> # Connect inputs : op.inputs. ... - >>> result_fields_container = op.outputs.fields_container() - """ - - def __init__(self, op: Operator): - super().__init__(mapdl_split_on_facet_indices._spec().outputs, op) - self._fields_container: Output[FieldsContainer] = Output( - mapdl_split_on_facet_indices._spec().output_pin(0), 0, op - ) - self._outputs.append(self._fields_container) - - @property - def fields_container(self) -> Output[FieldsContainer]: - r"""Allows to get fields_container output of the operator - - Output splitted fields containter - - Returns - ------- - output: - An Output instance for this pin. - - Examples - -------- - >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.result.mapdl_split_on_facet_indices() - >>> # Get the output from op.outputs. ... - >>> result_fields_container = op.outputs.fields_container() - """ - return self._fields_container diff --git a/src/ansys/dpf/core/operators/utility/__init__.py b/src/ansys/dpf/core/operators/utility/__init__.py index 73eb3c36ef8..0d71a4509c5 100644 --- a/src/ansys/dpf/core/operators/utility/__init__.py +++ b/src/ansys/dpf/core/operators/utility/__init__.py @@ -83,6 +83,7 @@ from .split_in_for_each_range import split_in_for_each_range from .strain_from_voigt import strain_from_voigt from .strain_from_voigt_fc import strain_from_voigt_fc +from .transpose_fields_container import transpose_fields_container from .txt_file_to_dpf import txt_file_to_dpf from .unitary_field import unitary_field from .weighted_merge_fields_by_label import weighted_merge_fields_by_label diff --git a/src/ansys/dpf/core/operators/utility/transpose_fields_container.py b/src/ansys/dpf/core/operators/utility/transpose_fields_container.py new file mode 100644 index 00000000000..22ed1da9f81 --- /dev/null +++ b/src/ansys/dpf/core/operators/utility/transpose_fields_container.py @@ -0,0 +1,293 @@ +""" +transpose_fields_container + +Autogenerated DPF operator classes. +""" + +from __future__ import annotations +from typing import TYPE_CHECKING + +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 + +if TYPE_CHECKING: + from ansys.dpf.core.fields_container import FieldsContainer + + +class transpose_fields_container(Operator): + r"""Transposes a fields container so that the fields’ scoping becomes the + container’s scoping and a chosen label (default: time) becomes the + fields’ scoping. + + Input layout (example with time label, 2 body labels, 3 nodes): FC + labels: [time, body] Field 0: {time:1, body:1} -> scoping {n1, n2, n3}, + data […] Field 1: {time:1, body:2} -> scoping {n4, n5}, data […] Field + 2: {time:2, body:1} -> scoping {n1, n2, n3}, data […] Field 3: {time:2, + body:2} -> scoping {n4, n5}, data […] + + Output layout (transposed on time): FC labels: [Nodal, body] Field 0: + {Nodal:n1, body:1} -> scoping {t1, t2}, data [gathered from fields 0,2] + Field 1: {Nodal:n2, body:1} -> scoping {t1, t2}, data [gathered from + fields 0,2] Field 1: {Nodal:n3, body:1} -> scoping {t1, t2}, data + [gathered from fields 0,2] Field 2: {Nodal:n4, body:2} -> scoping {t1, + t2}, data [gathered from fields 1,3] Field 3: {Nodal:n5, body:2} -> + scoping {t1, t2}, data [gathered from fields 1,3] … + + Each output field gathers one entity’s data across all values of the + transposed label from the input fields that share the same + non-transposed labels. All input fields sharing a labelspace where only + the transposed label changes must have the same scoping and location. + + + Inputs + ------ + fields_container: FieldsContainer + It is assumed that the fields container consists of fields having the same scoping. + label: str, optional + fields container label to use as fields label (default is time) + + Outputs + ------- + fields_container: FieldsContainer + + Examples + -------- + >>> from ansys.dpf import core as dpf + + >>> # Instantiate operator + >>> op = dpf.operators.utility.transpose_fields_container() + + >>> # Make input connections + >>> my_fields_container = dpf.FieldsContainer() + >>> op.inputs.fields_container.connect(my_fields_container) + >>> my_label = str() + >>> op.inputs.label.connect(my_label) + + >>> # Instantiate operator and connect inputs in one line + >>> op = dpf.operators.utility.transpose_fields_container( + ... fields_container=my_fields_container, + ... label=my_label, + ... ) + + >>> # Get output data + >>> result_fields_container = op.outputs.fields_container() + """ + + def __init__(self, fields_container=None, label=None, config=None, server=None): + super().__init__( + name="transpose_fields_container", + config=config, + server=server, + inputs_type=InputsTransposeFieldsContainer, + outputs_type=OutputsTransposeFieldsContainer, + ) + if fields_container is not None: + self.inputs.fields_container.connect(fields_container) + if label is not None: + self.inputs.label.connect(label) + + @staticmethod + def _spec() -> Specification: + description = r"""Transposes a fields container so that the fields’ scoping becomes the +container’s scoping and a chosen label (default: time) becomes the +fields’ scoping. + +Input layout (example with time label, 2 body labels, 3 nodes): FC +labels: [time, body] Field 0: {time:1, body:1} -> scoping {n1, n2, n3}, +data […] Field 1: {time:1, body:2} -> scoping {n4, n5}, data […] Field +2: {time:2, body:1} -> scoping {n1, n2, n3}, data […] Field 3: {time:2, +body:2} -> scoping {n4, n5}, data […] + +Output layout (transposed on time): FC labels: [Nodal, body] Field 0: +{Nodal:n1, body:1} -> scoping {t1, t2}, data [gathered from fields 0,2] +Field 1: {Nodal:n2, body:1} -> scoping {t1, t2}, data [gathered from +fields 0,2] Field 1: {Nodal:n3, body:1} -> scoping {t1, t2}, data +[gathered from fields 0,2] Field 2: {Nodal:n4, body:2} -> scoping {t1, +t2}, data [gathered from fields 1,3] Field 3: {Nodal:n5, body:2} -> +scoping {t1, t2}, data [gathered from fields 1,3] … + +Each output field gathers one entity’s data across all values of the +transposed label from the input fields that share the same +non-transposed labels. All input fields sharing a labelspace where only +the transposed label changes must have the same scoping and location. +""" + spec = Specification( + description=description, + map_input_pin_spec={ + 0: PinSpecification( + name="fields_container", + type_names=["fields_container"], + optional=False, + document=r"""It is assumed that the fields container consists of fields having the same scoping.""", + ), + 1: PinSpecification( + name="label", + type_names=["string"], + optional=True, + document=r"""fields container label to use as fields label (default is time)""", + ), + }, + map_output_pin_spec={ + 0: PinSpecification( + name="fields_container", + type_names=["fields_container"], + optional=False, + document=r"""""", + ), + }, + ) + return spec + + @staticmethod + 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 + instantiate the operator. The Configuration allows to customize + how the operation will be processed by the operator. + + Parameters + ---------- + 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="transpose_fields_container", server=server) + + @property + def inputs(self) -> InputsTransposeFieldsContainer: + """Enables to connect inputs to the operator + + Returns + -------- + inputs: + An instance of InputsTransposeFieldsContainer. + """ + return self._inputs + + @property + def outputs(self) -> OutputsTransposeFieldsContainer: + """Enables to get outputs of the operator by evaluating it + + Returns + -------- + outputs: + An instance of OutputsTransposeFieldsContainer. + """ + return self._outputs + + +class InputsTransposeFieldsContainer(_Inputs): + """Intermediate class used to connect user inputs to + transpose_fields_container operator. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.transpose_fields_container() + >>> my_fields_container = dpf.FieldsContainer() + >>> op.inputs.fields_container.connect(my_fields_container) + >>> my_label = str() + >>> op.inputs.label.connect(my_label) + """ + + def __init__(self, op: Operator): + super().__init__(transpose_fields_container._spec().inputs, op) + self._fields_container: Input[FieldsContainer] = Input( + transpose_fields_container._spec().input_pin(0), 0, op, -1 + ) + self._inputs.append(self._fields_container) + self._label: Input[str] = Input( + transpose_fields_container._spec().input_pin(1), 1, op, -1 + ) + self._inputs.append(self._label) + + @property + def fields_container(self) -> Input[FieldsContainer]: + r"""Allows to connect fields_container input to the operator. + + It is assumed that the fields container consists of fields having the same scoping. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.transpose_fields_container() + >>> op.inputs.fields_container.connect(my_fields_container) + >>> # or + >>> op.inputs.fields_container(my_fields_container) + """ + return self._fields_container + + @property + def label(self) -> Input[str]: + r"""Allows to connect label input to the operator. + + fields container label to use as fields label (default is time) + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.transpose_fields_container() + >>> op.inputs.label.connect(my_label) + >>> # or + >>> op.inputs.label(my_label) + """ + return self._label + + +class OutputsTransposeFieldsContainer(_Outputs): + """Intermediate class used to get outputs from + transpose_fields_container operator. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.transpose_fields_container() + >>> # Connect inputs : op.inputs. ... + >>> result_fields_container = op.outputs.fields_container() + """ + + def __init__(self, op: Operator): + super().__init__(transpose_fields_container._spec().outputs, op) + self._fields_container: Output[FieldsContainer] = Output( + transpose_fields_container._spec().output_pin(0), 0, op + ) + self._outputs.append(self._fields_container) + + @property + def fields_container(self) -> Output[FieldsContainer]: + r"""Allows to get fields_container output of the operator + + Returns + ------- + output: + An Output instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.transpose_fields_container() + >>> # Get the output from op.outputs. ... + >>> result_fields_container = op.outputs.fields_container() + """ + return self._fields_container diff --git a/src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll b/src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll index 4f2723e6eab..a7e1626a40d 100644 Binary files a/src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll and b/src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll differ diff --git a/src/ansys/dpf/gatebin/DPFClientAPI.dll b/src/ansys/dpf/gatebin/DPFClientAPI.dll index d1967b40c19..faa28ce46cd 100644 Binary files a/src/ansys/dpf/gatebin/DPFClientAPI.dll and b/src/ansys/dpf/gatebin/DPFClientAPI.dll differ