diff --git a/doc/source/_static/dpf_operators.html b/doc/source/_static/dpf_operators.html index 694280e73b2..2ffb61714d9 100644 --- a/doc/source/_static/dpf_operators.html +++ b/doc/source/_static/dpf_operators.html @@ -5285,9 +5285,9 @@

Configurating operators

Version 0.0.0

Inputs

unit as a string, ex 'm' for meter, 'Pa' for pascal,...

Outputs

Configurations

Scripting

Changelog

math: norm (fields container)

Description

Computes the element-wise L2 norm of the field elementary data. This process is applied on each field of the input fields container.

Version 0.0.0

Inputs

Lp normalisation type, p = 1, 2, ...n - Default Lp=2

-

Outputs

Configurations

Scripting

Changelog

utility: property field get attribute

Description

A PropertyField in pin 0 and a property name (string) in pin 1 are expected in input.

-
Version 0.0.0

Inputs

Accepted inputs are: 'time_freq_support', 'scoping' and 'header'.

-

Outputs

Property value.

+

Outputs

Configurations

Scripting

Changelog

utility: property field get attribute

Description

Gets a property from an input field/field container. A PropertyFieldin pin 0, a property name (string) in pin 1 are expected as inputs

+
Version 0.0.0

Inputs

Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'.

+

Outputs

Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.

Configurations

Scripting

Changelog

result: element orientations X

Description

Read/compute element euler angles X component of the vector (1st component) by calling the readers defined by the datasources. Regarding the requested location and the input mesh scoping, the result location can be Nodal/ElementalNodal/Elemental.

Version 0.0.0

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

@@ -5312,7 +5312,7 @@

Configurating operators

Warning: There are multiple results named "current density".

This operator returns the elemental "Source current density", also named "JS" in MAPDL and Mechanical.

To retrieve the result named "current density" in Mechanical or "JC" in MAPDL, use the solver specific operator: mapdl::rth::JC.

-
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.

+
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

Fields container already allocated modified inplace

result file container allowed to be kept open to cache data

@@ -6388,10 +6388,7 @@

Configurating operators

result file path container, used if no streams are set

integration point where the result will be read from. Default value: 0 (first integration point).

(LSDyna) Unit System ID (int), semicolon-separated list of base unit strings (str) or UnitSystem instance

-

Outputs

Configurations

Scripting

Changelog

utility: set property

Description

Sets a property to an input field/field container.

-
Version 0.0.0

Inputs

Property to set

-

Property to set

-

Outputs

Configurations

Scripting

Changelog

result: electric flux density Y

Description

Read/compute Electric flux density Y component of the vector (2nd component) by calling the readers defined by the datasources. Regarding the requested location and the input mesh scoping, the result location can be Nodal/ElementalNodal/Elemental.

+

Outputs

Configurations

Scripting

Changelog

result: electric flux density Y

Description

Read/compute Electric flux density Y component of the vector (2nd component) by calling the readers defined by the datasources. Regarding the requested location and the input mesh scoping, the result location can be Nodal/ElementalNodal/Elemental.

Version 0.0.0

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

FieldsContainer already allocated modified inplace

@@ -7435,7 +7432,7 @@

Configurating operators

Version 0.0.0

Inputs

Either a a vector of string fields to merge or string fields from pin 0 to ...

Outputs

Configurations

Scripting

Changelog

result: stress principal 2

Description

Read/compute element nodal component stresses 2nd principal component by calling the readers defined by the datasources and computing its eigen values. This operation is independent of the coordinate system unless averaging across elements is requested, in which case a rotation to the global coordinate system is performed.

-
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.

+
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

FieldsContainer already allocated modified inplace

result file container allowed to be kept open to cache data

@@ -8802,7 +8799,12 @@

Configurating operators

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.

-

Outputs

Configurations

Scripting

Changelog

result: plastic strain X

Description

Read/compute element nodal component plastic strains XX normal component (00 component) by calling the readers defined by the datasources. Regarding the requested location and the input mesh scoping, the result location can be Nodal/ElementalNodal/Elemental.

+

Outputs

Configurations

Scripting

Changelog

scoping: transpose

Description

Transposes the input scoping or scopings container (Elemental/Faces --> Nodal, or Nodal ---> Elemental/Faces), based on the input mesh region.

+
Version 0.0.0

Inputs

Scoping or scopings container (the input type is the output type)

+

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

+

Output scoping location for meshes with nodes, faces and elements. By default, elemental and faces scopings transpose to nodal, and nodal scopings transpose to elemental.

+

Outputs

Scoping or scopings container (the input type is the output type)

+

Configurations

Scripting

Changelog

result: plastic strain X

Description

Read/compute element nodal component plastic strains XX normal component (00 component) by calling the readers defined by the datasources. Regarding the requested location and the input mesh scoping, the result location can be Nodal/ElementalNodal/Elemental.

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

FieldsContainer already allocated modified inplace

@@ -14051,9 +14053,9 @@

Configurating operators

Version 0.0.0

Inputs

Either the result of the make_iterable_info operator, or the operator that must be incremented.

Outputs

Configurations

Scripting

Changelog

metadata: boundary condition provider

Description

Reads boundary conditions from the results files contained in the streams or data sources.

Version 0.0.0

Supported file types

Inputs

Outputs

results info

-

Configurations

Scripting

Changelog

utility: custom type field get attribute

Description

A CustomTypeField in pin 0 and a property name (string) in pin 1 are expected in input.

-
Version 0.0.0

Inputs

Accepted inputs are: 'time_freq_support', 'scoping' and 'header'.

-

Outputs

Property value.

+

Configurations

Scripting

Changelog

utility: custom type field get attribute

Description

Gets a property from an input field/field container. A CustomTypeFieldin pin 0, a property name (string) in pin 1 are expected as inputs

+
Version 0.0.0

Inputs

Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'.

+

Outputs

Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.

Configurations

Scripting

Changelog

utility: merge property fields

Description

Assembles a set of property fields into a unique one.

Version 0.0.0

Inputs

If true, merge the input property fields assuming that there is no repetition in their scoping ids. Default is false.

Either a property fields container, a vector of property fields to merge or property fields from pin 0 to ...

@@ -14098,16 +14100,16 @@

Configurating operators

Version 0.0.0

Inputs

Vector or tensor field that must be rotated, expressed in nodal coordinate system.

Nodal euler angles defined from a result file. Those must be the rotations from Nodal to Global.

Outputs

Rotated field

-

Configurations

Scripting

Changelog

result: global_to_nodal

Description

Rotate results from global coordinate system to local coordinate system.

-
Version 0.0.0

Inputs

Vector or tensor field that must be rotated, expressed in global coordinate system.

-

Nodal euler angles defined from a result file. Those must be the rotations from Nodal to Global.

-

Outputs

Rotated field

-

Configurations

Scripting

Changelog

min_max: min max by entity over time

Description

For each entity and component, evaluates minimum and maximum over time/frequency.
+

Configurations

Scripting

Changelog

min_max: min max by entity over time

Description

For each entity and component, evaluates minimum and maximum over time/frequency.
Input pin 4 compute_amplitude is only effective when given fields_container contains the complex label.
if given input fields_container has a time_freq_support, output pins 2 and 3 fields_container contains time/freq indices of the minimum and maximum values.

Version 0.0.0

Inputs

Calculate the absolute value of field entities before computing the min/max.

Do calculate amplitude.

-

Outputs

Configurations

Scripting

Changelog

scoping: connectivity ids

Description

Returns the ordered node ids corresponding to the element ids scoping in input. For each element the node ids are its connectivity.

+

Outputs

Configurations

Scripting

Changelog

result: global_to_nodal

Description

Rotate results from global coordinate system to local coordinate system.

+
Version 0.0.0

Inputs

Vector or tensor field that must be rotated, expressed in global coordinate system.

+

Nodal euler angles defined from a result file. Those must be the rotations from Nodal to Global.

+

Outputs

Rotated field

+

Configurations

Scripting

Changelog

scoping: connectivity ids

Description

Returns the ordered node ids corresponding to the element ids scoping in input. For each element the node ids are its connectivity.

Version 0.0.0

Inputs

Elemental scoping

the support of the scoping is expected if there is no mesh in input

default is true

@@ -14210,12 +14212,7 @@

Configurating operators

set to 0: to have skin elements in their own group, 1: merge skin and solid elements, 2: merge skin and shell elements (default)

properties to apply the filtering 'mat' and/or 'elshape' (since 2025R1 it supports any property name contained in the mesh property fields) (default is 'elshape')

Outputs

Scoping

-

Configurations

Scripting

Changelog

scoping: transpose

Description

Transposes the input scoping or scopings container (Elemental/Faces --> Nodal, or Nodal ---> Elemental/Faces), based on the input mesh region.

-
Version 0.0.0

Inputs

Scoping or scopings container (the input type is the output type)

-

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

-

Output scoping location for meshes with nodes, faces and elements. By default, elemental and faces scopings transpose to nodal, and nodal scopings transpose to elemental.

-

Outputs

Scoping or scopings container (the input type is the output type)

-

Configurations

Scripting

Changelog

utility: overlap fields

Description

Take two fields and superpose them, the overlapping field will override values of base_field.

+

Configurations

Scripting

Changelog

utility: overlap fields

Description

Take two fields and superpose them, the overlapping field will override values of base_field.

Version 0.0.0

Inputs

Outputs

Configurations

Scripting

Changelog

mapping: find reduced coordinates

Description

Finds the elements corresponding to the given coordinates in input and computes their reduced coordinates in those elements.

Version 0.0.0

Inputs

If the first field in input has no mesh in support, then the mesh in this pin is expected (default is false). If a meshes container with several meshes is set, it should be on the same label spaces as the coordinates fields container.

If this pin is set to true, reduced coordinates are computed on the quadratic element if the element is quadratic (more precise but less performant). Default is false.

@@ -14351,9 +14348,21 @@

Configurating operators

Version 0.0.0

Inputs

Supported property names are: "labels".

Value of the property to be set : vector of string or LabelSpace for "labels".

Outputs

Returns the modified FieldsContainer.

-

Configurations

Scripting

Changelog

utility: field get attribute

Description

A Field in pin 0 and a property name (string) in pin 1 are expected in input.

-
Version 0.0.0

Inputs

Accepted inputs are: 'time_freq_support', 'scoping' and 'header'.

-

Outputs

Property value.

+

Configurations

Scripting

Changelog

utility: field set property

Description

Sets a property to an input field/field container. A Fieldin pin 0, a property name (string) in pin 1 and a valid property value in pin 2 are expected as inputs

+
Version 0.0.0

Inputs

Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'.

+

Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string.

+

Outputs

Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.

+

Configurations

Scripting

Changelog

utility: property field set property

Description

Sets a property to an input field/field container. A PropertyFieldin pin 0, a property name (string) in pin 1 and a valid property value in pin 2 are expected as inputs

+
Version 0.0.0

Inputs

Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'.

+

Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string.

+

Outputs

Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.

+

Configurations

Scripting

Changelog

utility: custom type field set property

Description

Sets a property to an input field/field container. A CustomTypeFieldin pin 0, a property name (string) in pin 1 and a valid property value in pin 2 are expected as inputs

+
Version 0.0.0

Inputs

Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'.

+

Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string.

+

Outputs

Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.

+

Configurations

Scripting

Changelog

utility: field get attribute

Description

Gets a property from an input field/field container. A Fieldin pin 0, a property name (string) in pin 1 are expected as inputs

+
Version 0.0.0

Inputs

Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'.

+

Outputs

Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.

Configurations

Scripting

Changelog

metadata: cyclic mesh expansion

Description

Expand the mesh.

Version 0.0.0

Inputs

sectors to expand (start at 0), for multistage: use scopings container with 'stage' label.

Outputs

expanded meshed region.

diff --git a/src/ansys/dpf/core/operators/utility/__init__.py b/src/ansys/dpf/core/operators/utility/__init__.py index b54711d50b5..19655f6810c 100644 --- a/src/ansys/dpf/core/operators/utility/__init__.py +++ b/src/ansys/dpf/core/operators/utility/__init__.py @@ -8,6 +8,7 @@ from .change_shell_layers import change_shell_layers from .compute_time_scoping import compute_time_scoping from .customtypefield_get_attribute import customtypefield_get_attribute +from .customtypefield_set_property import customtypefield_set_property from .default_value import default_value from .delegate_to_operator import delegate_to_operator from .ds_get_attribute import ds_get_attribute @@ -21,6 +22,7 @@ from .field import field from .field_clone_to_shell_layer import field_clone_to_shell_layer from .field_get_attribute import field_get_attribute +from .field_set_property import field_set_property from .field_to_fc import field_to_fc from .fields_container import fields_container from .fields_container_matrices_label import fields_container_matrices_label @@ -66,6 +68,7 @@ from .producer_consumer_for_each import producer_consumer_for_each from .property_field import property_field from .propertyfield_get_attribute import propertyfield_get_attribute +from .propertyfield_set_property import propertyfield_set_property from .python_generator import python_generator from .remote_operator_instantiate import remote_operator_instantiate from .remote_workflow_instantiate import remote_workflow_instantiate @@ -73,7 +76,6 @@ from .scalars_to_field import scalars_to_field from .server_path import server_path from .set_attribute import set_attribute -from .set_property import set_property 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 diff --git a/src/ansys/dpf/core/operators/utility/customtypefield_get_attribute.py b/src/ansys/dpf/core/operators/utility/customtypefield_get_attribute.py index 253272cc7de..fc8ef28d54f 100644 --- a/src/ansys/dpf/core/operators/utility/customtypefield_get_attribute.py +++ b/src/ansys/dpf/core/operators/utility/customtypefield_get_attribute.py @@ -17,20 +17,20 @@ class customtypefield_get_attribute(Operator): - r"""A CustomTypeField in pin 0 and a property name (string) in pin 1 are - expected in input. + r"""Gets a property from an input field/field container. A CustomTypeFieldin + pin 0, a property name (string) in pin 1 are expected as inputs Parameters ---------- - custom_type_field: CustomTypeField + custom_type_field: CustomTypeField or CustomTypeFieldsContainer property_name: str - Accepted inputs are: 'time_freq_support', 'scoping' and 'header'. + Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'. Returns ------- - property: TimeFreqSupport or Scoping or DataTree - Property value. + property_value: str or TimeFreqSupport or Scoping or DataTree + Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers. Examples -------- @@ -52,7 +52,7 @@ class customtypefield_get_attribute(Operator): ... ) >>> # Get output data - >>> result_property = op.outputs.property() + >>> result_property_value = op.outputs.property_value() """ def __init__( @@ -70,15 +70,15 @@ def __init__( @staticmethod def _spec() -> Specification: - description = r"""A CustomTypeField in pin 0 and a property name (string) in pin 1 are -expected in input. + description = r"""Gets a property from an input field/field container. A CustomTypeFieldin +pin 0, a property name (string) in pin 1 are expected as inputs """ spec = Specification( description=description, map_input_pin_spec={ 0: PinSpecification( name="custom_type_field", - type_names=["custom_type_field"], + type_names=["custom_type_field", "custom_type_fields_container"], optional=False, document=r"""""", ), @@ -86,15 +86,20 @@ def _spec() -> Specification: name="property_name", type_names=["string"], optional=False, - document=r"""Accepted inputs are: 'time_freq_support', 'scoping' and 'header'.""", + document=r"""Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'.""", ), }, map_output_pin_spec={ 0: PinSpecification( - name="property", - type_names=["time_freq_support", "scoping", "abstract_data_tree"], + name="property_value", + type_names=[ + "string", + "time_freq_support", + "scoping", + "abstract_data_tree", + ], optional=False, - document=r"""Property value.""", + document=r"""Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.""", ), }, ) @@ -194,7 +199,7 @@ def custom_type_field(self) -> Input: def property_name(self) -> Input: r"""Allows to connect property_name input to the operator. - Accepted inputs are: 'time_freq_support', 'scoping' and 'header'. + Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'. Returns ------- @@ -221,32 +226,40 @@ class OutputsCustomtypefieldGetAttribute(_Outputs): >>> from ansys.dpf import core as dpf >>> op = dpf.operators.utility.customtypefield_get_attribute() >>> # Connect inputs : op.inputs. ... - >>> result_property = op.outputs.property() + >>> result_property_value = op.outputs.property_value() """ def __init__(self, op: Operator): super().__init__(customtypefield_get_attribute._spec().outputs, op) - self.property_as_time_freq_support = Output( + self.property_value_as_string = Output( + _modify_output_spec_with_one_type( + customtypefield_get_attribute._spec().output_pin(0), "string" + ), + 0, + op, + ) + self._outputs.append(self.property_value_as_string) + self.property_value_as_time_freq_support = Output( _modify_output_spec_with_one_type( customtypefield_get_attribute._spec().output_pin(0), "time_freq_support" ), 0, op, ) - self._outputs.append(self.property_as_time_freq_support) - self.property_as_scoping = Output( + self._outputs.append(self.property_value_as_time_freq_support) + self.property_value_as_scoping = Output( _modify_output_spec_with_one_type( customtypefield_get_attribute._spec().output_pin(0), "scoping" ), 0, op, ) - self._outputs.append(self.property_as_scoping) - self.property_as_data_tree = Output( + self._outputs.append(self.property_value_as_scoping) + self.property_value_as_data_tree = Output( _modify_output_spec_with_one_type( customtypefield_get_attribute._spec().output_pin(0), "data_tree" ), 0, op, ) - self._outputs.append(self.property_as_data_tree) + self._outputs.append(self.property_value_as_data_tree) diff --git a/src/ansys/dpf/core/operators/utility/customtypefield_set_property.py b/src/ansys/dpf/core/operators/utility/customtypefield_set_property.py new file mode 100644 index 00000000000..0406f9b9c53 --- /dev/null +++ b/src/ansys/dpf/core/operators/utility/customtypefield_set_property.py @@ -0,0 +1,300 @@ +""" +customtypefield_set_property + +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.outputs import _modify_output_spec_with_one_type +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 customtypefield_set_property(Operator): + r"""Sets a property to an input field/field container. A CustomTypeFieldin + pin 0, a property name (string) in pin 1 and a valid property value in + pin 2 are expected as inputs + + + Parameters + ---------- + custom_type_field: CustomTypeField or CustomTypeFieldsContainer + property_name: str + Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'. + property_value: str or TimeFreqSupport or Scoping or DataTree or int or + float + Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string. + + Returns + ------- + field_type: CustomTypeField or CustomTypeFieldsContainer + Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers. + + Examples + -------- + >>> from ansys.dpf import core as dpf + + >>> # Instantiate operator + >>> op = dpf.operators.utility.customtypefield_set_property() + + >>> # Make input connections + >>> my_custom_type_field = dpf.CustomTypeField() + >>> op.inputs.custom_type_field.connect(my_custom_type_field) + >>> my_property_name = str() + >>> op.inputs.property_name.connect(my_property_name) + >>> my_property_value = str() + >>> op.inputs.property_value.connect(my_property_value) + + >>> # Instantiate operator and connect inputs in one line + >>> op = dpf.operators.utility.customtypefield_set_property( + ... custom_type_field=my_custom_type_field, + ... property_name=my_property_name, + ... property_value=my_property_value, + ... ) + + >>> # Get output data + >>> result_field_type = op.outputs.field_type() + """ + + def __init__( + self, + custom_type_field=None, + property_name=None, + property_value=None, + config=None, + server=None, + ): + super().__init__( + name="customtypefield::set_property", config=config, server=server + ) + self._inputs = InputsCustomtypefieldSetProperty(self) + self._outputs = OutputsCustomtypefieldSetProperty(self) + if custom_type_field is not None: + self.inputs.custom_type_field.connect(custom_type_field) + if property_name is not None: + self.inputs.property_name.connect(property_name) + if property_value is not None: + self.inputs.property_value.connect(property_value) + + @staticmethod + def _spec() -> Specification: + description = r"""Sets a property to an input field/field container. A CustomTypeFieldin +pin 0, a property name (string) in pin 1 and a valid property value in +pin 2 are expected as inputs +""" + spec = Specification( + description=description, + map_input_pin_spec={ + 0: PinSpecification( + name="custom_type_field", + type_names=["custom_type_field", "custom_type_fields_container"], + optional=False, + document=r"""""", + ), + 1: PinSpecification( + name="property_name", + type_names=["string"], + optional=False, + document=r"""Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'.""", + ), + 2: PinSpecification( + name="property_value", + type_names=[ + "string", + "time_freq_support", + "scoping", + "abstract_data_tree", + "int32", + "double", + ], + optional=False, + document=r"""Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string.""", + ), + }, + map_output_pin_spec={ + 0: PinSpecification( + name="field_type", + type_names=["custom_type_field", "custom_type_fields_container"], + optional=False, + document=r"""Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.""", + ), + }, + ) + 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="customtypefield::set_property", server=server + ) + + @property + def inputs(self) -> InputsCustomtypefieldSetProperty: + """Enables to connect inputs to the operator + + Returns + -------- + inputs: + An instance of InputsCustomtypefieldSetProperty. + """ + return super().inputs + + @property + def outputs(self) -> OutputsCustomtypefieldSetProperty: + """Enables to get outputs of the operator by evaluating it + + Returns + -------- + outputs: + An instance of OutputsCustomtypefieldSetProperty. + """ + return super().outputs + + +class InputsCustomtypefieldSetProperty(_Inputs): + """Intermediate class used to connect user inputs to + customtypefield_set_property operator. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.customtypefield_set_property() + >>> my_custom_type_field = dpf.CustomTypeField() + >>> op.inputs.custom_type_field.connect(my_custom_type_field) + >>> my_property_name = str() + >>> op.inputs.property_name.connect(my_property_name) + >>> my_property_value = str() + >>> op.inputs.property_value.connect(my_property_value) + """ + + def __init__(self, op: Operator): + super().__init__(customtypefield_set_property._spec().inputs, op) + self._custom_type_field = Input( + customtypefield_set_property._spec().input_pin(0), 0, op, -1 + ) + self._inputs.append(self._custom_type_field) + self._property_name = Input( + customtypefield_set_property._spec().input_pin(1), 1, op, -1 + ) + self._inputs.append(self._property_name) + self._property_value = Input( + customtypefield_set_property._spec().input_pin(2), 2, op, -1 + ) + self._inputs.append(self._property_value) + + @property + def custom_type_field(self) -> Input: + r"""Allows to connect custom_type_field input to the operator. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.customtypefield_set_property() + >>> op.inputs.custom_type_field.connect(my_custom_type_field) + >>> # or + >>> op.inputs.custom_type_field(my_custom_type_field) + """ + return self._custom_type_field + + @property + def property_name(self) -> Input: + r"""Allows to connect property_name input to the operator. + + Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.customtypefield_set_property() + >>> op.inputs.property_name.connect(my_property_name) + >>> # or + >>> op.inputs.property_name(my_property_name) + """ + return self._property_name + + @property + def property_value(self) -> Input: + r"""Allows to connect property_value input to the operator. + + Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.customtypefield_set_property() + >>> op.inputs.property_value.connect(my_property_value) + >>> # or + >>> op.inputs.property_value(my_property_value) + """ + return self._property_value + + +class OutputsCustomtypefieldSetProperty(_Outputs): + """Intermediate class used to get outputs from + customtypefield_set_property operator. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.customtypefield_set_property() + >>> # Connect inputs : op.inputs. ... + >>> result_field_type = op.outputs.field_type() + """ + + def __init__(self, op: Operator): + super().__init__(customtypefield_set_property._spec().outputs, op) + self.field_type_as_custom_type_field = Output( + _modify_output_spec_with_one_type( + customtypefield_set_property._spec().output_pin(0), "custom_type_field" + ), + 0, + op, + ) + self._outputs.append(self.field_type_as_custom_type_field) + self.field_type_as_custom_type_fields_container = Output( + _modify_output_spec_with_one_type( + customtypefield_set_property._spec().output_pin(0), + "custom_type_fields_container", + ), + 0, + op, + ) + self._outputs.append(self.field_type_as_custom_type_fields_container) diff --git a/src/ansys/dpf/core/operators/utility/field_get_attribute.py b/src/ansys/dpf/core/operators/utility/field_get_attribute.py index 958e24fbf98..b2493a74bf9 100644 --- a/src/ansys/dpf/core/operators/utility/field_get_attribute.py +++ b/src/ansys/dpf/core/operators/utility/field_get_attribute.py @@ -17,20 +17,20 @@ class field_get_attribute(Operator): - r"""A Field in pin 0 and a property name (string) in pin 1 are expected in - input. + r"""Gets a property from an input field/field container. A Fieldin pin 0, a + property name (string) in pin 1 are expected as inputs Parameters ---------- - field: Field + field: Field or FieldsContainer property_name: str - Accepted inputs are: 'time_freq_support', 'scoping' and 'header'. + Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'. Returns ------- - property: TimeFreqSupport or Scoping or DataTree - Property value. + property_value: str or TimeFreqSupport or Scoping or DataTree + Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers. Examples -------- @@ -52,7 +52,7 @@ class field_get_attribute(Operator): ... ) >>> # Get output data - >>> result_property = op.outputs.property() + >>> result_property_value = op.outputs.property_value() """ def __init__(self, field=None, property_name=None, config=None, server=None): @@ -66,15 +66,15 @@ def __init__(self, field=None, property_name=None, config=None, server=None): @staticmethod def _spec() -> Specification: - description = r"""A Field in pin 0 and a property name (string) in pin 1 are expected in -input. + description = r"""Gets a property from an input field/field container. A Fieldin pin 0, a +property name (string) in pin 1 are expected as inputs """ spec = Specification( description=description, map_input_pin_spec={ 0: PinSpecification( name="field", - type_names=["field"], + type_names=["field", "fields_container"], optional=False, document=r"""""", ), @@ -82,15 +82,20 @@ def _spec() -> Specification: name="property_name", type_names=["string"], optional=False, - document=r"""Accepted inputs are: 'time_freq_support', 'scoping' and 'header'.""", + document=r"""Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'.""", ), }, map_output_pin_spec={ 0: PinSpecification( - name="property", - type_names=["time_freq_support", "scoping", "abstract_data_tree"], + name="property_value", + type_names=[ + "string", + "time_freq_support", + "scoping", + "abstract_data_tree", + ], optional=False, - document=r"""Property value.""", + document=r"""Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.""", ), }, ) @@ -184,7 +189,7 @@ def field(self) -> Input: def property_name(self) -> Input: r"""Allows to connect property_name input to the operator. - Accepted inputs are: 'time_freq_support', 'scoping' and 'header'. + Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'. Returns ------- @@ -211,32 +216,40 @@ class OutputsFieldGetAttribute(_Outputs): >>> from ansys.dpf import core as dpf >>> op = dpf.operators.utility.field_get_attribute() >>> # Connect inputs : op.inputs. ... - >>> result_property = op.outputs.property() + >>> result_property_value = op.outputs.property_value() """ def __init__(self, op: Operator): super().__init__(field_get_attribute._spec().outputs, op) - self.property_as_time_freq_support = Output( + self.property_value_as_string = Output( + _modify_output_spec_with_one_type( + field_get_attribute._spec().output_pin(0), "string" + ), + 0, + op, + ) + self._outputs.append(self.property_value_as_string) + self.property_value_as_time_freq_support = Output( _modify_output_spec_with_one_type( field_get_attribute._spec().output_pin(0), "time_freq_support" ), 0, op, ) - self._outputs.append(self.property_as_time_freq_support) - self.property_as_scoping = Output( + self._outputs.append(self.property_value_as_time_freq_support) + self.property_value_as_scoping = Output( _modify_output_spec_with_one_type( field_get_attribute._spec().output_pin(0), "scoping" ), 0, op, ) - self._outputs.append(self.property_as_scoping) - self.property_as_data_tree = Output( + self._outputs.append(self.property_value_as_scoping) + self.property_value_as_data_tree = Output( _modify_output_spec_with_one_type( field_get_attribute._spec().output_pin(0), "data_tree" ), 0, op, ) - self._outputs.append(self.property_as_data_tree) + self._outputs.append(self.property_value_as_data_tree) diff --git a/src/ansys/dpf/core/operators/utility/set_property.py b/src/ansys/dpf/core/operators/utility/field_set_property.py similarity index 63% rename from src/ansys/dpf/core/operators/utility/set_property.py rename to src/ansys/dpf/core/operators/utility/field_set_property.py index c3c51f15903..c221ef7a0b3 100644 --- a/src/ansys/dpf/core/operators/utility/set_property.py +++ b/src/ansys/dpf/core/operators/utility/field_set_property.py @@ -1,5 +1,5 @@ """ -set_property +field_set_property Autogenerated DPF operator classes. """ @@ -16,28 +16,32 @@ from ansys.dpf.core.server_types import AnyServerType -class set_property(Operator): - r"""Sets a property to an input field/field container. +class field_set_property(Operator): + r"""Sets a property to an input field/field container. A Fieldin pin 0, a + property name (string) in pin 1 and a valid property value in pin 2 are + expected as inputs Parameters ---------- field: Field or FieldsContainer property_name: str - Property to set - property_value: str or int or float - Property to set + Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'. + property_value: str or TimeFreqSupport or Scoping or DataTree or int or + float + Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string. Returns ------- - field: Field or FieldsContainer + field_type: Field or FieldsContainer + Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers. Examples -------- >>> from ansys.dpf import core as dpf >>> # Instantiate operator - >>> op = dpf.operators.utility.set_property() + >>> op = dpf.operators.utility.field_set_property() >>> # Make input connections >>> my_field = dpf.Field() @@ -48,14 +52,14 @@ class set_property(Operator): >>> op.inputs.property_value.connect(my_property_value) >>> # Instantiate operator and connect inputs in one line - >>> op = dpf.operators.utility.set_property( + >>> op = dpf.operators.utility.field_set_property( ... field=my_field, ... property_name=my_property_name, ... property_value=my_property_value, ... ) >>> # Get output data - >>> result_field = op.outputs.field() + >>> result_field_type = op.outputs.field_type() """ def __init__( @@ -67,8 +71,8 @@ def __init__( server=None, ): super().__init__(name="field::set_property", config=config, server=server) - self._inputs = InputsSetProperty(self) - self._outputs = OutputsSetProperty(self) + self._inputs = InputsFieldSetProperty(self) + self._outputs = OutputsFieldSetProperty(self) if field is not None: self.inputs.field.connect(field) if property_name is not None: @@ -78,7 +82,9 @@ def __init__( @staticmethod def _spec() -> Specification: - description = r"""Sets a property to an input field/field container. + description = r"""Sets a property to an input field/field container. A Fieldin pin 0, a +property name (string) in pin 1 and a valid property value in pin 2 are +expected as inputs """ spec = Specification( description=description, @@ -93,21 +99,28 @@ def _spec() -> Specification: name="property_name", type_names=["string"], optional=False, - document=r"""Property to set""", + document=r"""Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'.""", ), 2: PinSpecification( name="property_value", - type_names=["string", "int32", "double"], + type_names=[ + "string", + "time_freq_support", + "scoping", + "abstract_data_tree", + "int32", + "double", + ], optional=False, - document=r"""Property to set""", + document=r"""Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string.""", ), }, map_output_pin_spec={ 0: PinSpecification( - name="field", + name="field_type", type_names=["field", "fields_container"], optional=False, - document=r"""""", + document=r"""Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.""", ), }, ) @@ -135,36 +148,36 @@ def default_config(server: AnyServerType = None) -> Config: return Operator.default_config(name="field::set_property", server=server) @property - def inputs(self) -> InputsSetProperty: + def inputs(self) -> InputsFieldSetProperty: """Enables to connect inputs to the operator Returns -------- inputs: - An instance of InputsSetProperty. + An instance of InputsFieldSetProperty. """ return super().inputs @property - def outputs(self) -> OutputsSetProperty: + def outputs(self) -> OutputsFieldSetProperty: """Enables to get outputs of the operator by evaluating it Returns -------- outputs: - An instance of OutputsSetProperty. + An instance of OutputsFieldSetProperty. """ return super().outputs -class InputsSetProperty(_Inputs): +class InputsFieldSetProperty(_Inputs): """Intermediate class used to connect user inputs to - set_property operator. + field_set_property operator. Examples -------- >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.utility.set_property() + >>> op = dpf.operators.utility.field_set_property() >>> my_field = dpf.Field() >>> op.inputs.field.connect(my_field) >>> my_property_name = str() @@ -174,12 +187,12 @@ class InputsSetProperty(_Inputs): """ def __init__(self, op: Operator): - super().__init__(set_property._spec().inputs, op) - self._field = Input(set_property._spec().input_pin(0), 0, op, -1) + super().__init__(field_set_property._spec().inputs, op) + self._field = Input(field_set_property._spec().input_pin(0), 0, op, -1) self._inputs.append(self._field) - self._property_name = Input(set_property._spec().input_pin(1), 1, op, -1) + self._property_name = Input(field_set_property._spec().input_pin(1), 1, op, -1) self._inputs.append(self._property_name) - self._property_value = Input(set_property._spec().input_pin(2), 2, op, -1) + self._property_value = Input(field_set_property._spec().input_pin(2), 2, op, -1) self._inputs.append(self._property_value) @property @@ -194,7 +207,7 @@ def field(self) -> Input: Examples -------- >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.utility.set_property() + >>> op = dpf.operators.utility.field_set_property() >>> op.inputs.field.connect(my_field) >>> # or >>> op.inputs.field(my_field) @@ -205,7 +218,7 @@ def field(self) -> Input: def property_name(self) -> Input: r"""Allows to connect property_name input to the operator. - Property to set + Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'. Returns ------- @@ -215,7 +228,7 @@ def property_name(self) -> Input: Examples -------- >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.utility.set_property() + >>> op = dpf.operators.utility.field_set_property() >>> op.inputs.property_name.connect(my_property_name) >>> # or >>> op.inputs.property_name(my_property_name) @@ -226,7 +239,7 @@ def property_name(self) -> Input: def property_value(self) -> Input: r"""Allows to connect property_value input to the operator. - Property to set + Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string. Returns ------- @@ -236,7 +249,7 @@ def property_value(self) -> Input: Examples -------- >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.utility.set_property() + >>> op = dpf.operators.utility.field_set_property() >>> op.inputs.property_value.connect(my_property_value) >>> # or >>> op.inputs.property_value(my_property_value) @@ -244,33 +257,33 @@ def property_value(self) -> Input: return self._property_value -class OutputsSetProperty(_Outputs): +class OutputsFieldSetProperty(_Outputs): """Intermediate class used to get outputs from - set_property operator. + field_set_property operator. Examples -------- >>> from ansys.dpf import core as dpf - >>> op = dpf.operators.utility.set_property() + >>> op = dpf.operators.utility.field_set_property() >>> # Connect inputs : op.inputs. ... - >>> result_field = op.outputs.field() + >>> result_field_type = op.outputs.field_type() """ def __init__(self, op: Operator): - super().__init__(set_property._spec().outputs, op) - self.field_as_field = Output( + super().__init__(field_set_property._spec().outputs, op) + self.field_type_as_field = Output( _modify_output_spec_with_one_type( - set_property._spec().output_pin(0), "field" + field_set_property._spec().output_pin(0), "field" ), 0, op, ) - self._outputs.append(self.field_as_field) - self.field_as_fields_container = Output( + self._outputs.append(self.field_type_as_field) + self.field_type_as_fields_container = Output( _modify_output_spec_with_one_type( - set_property._spec().output_pin(0), "fields_container" + field_set_property._spec().output_pin(0), "fields_container" ), 0, op, ) - self._outputs.append(self.field_as_fields_container) + self._outputs.append(self.field_type_as_fields_container) diff --git a/src/ansys/dpf/core/operators/utility/propertyfield_get_attribute.py b/src/ansys/dpf/core/operators/utility/propertyfield_get_attribute.py index f45c8787e56..54c26606d16 100644 --- a/src/ansys/dpf/core/operators/utility/propertyfield_get_attribute.py +++ b/src/ansys/dpf/core/operators/utility/propertyfield_get_attribute.py @@ -17,20 +17,20 @@ class propertyfield_get_attribute(Operator): - r"""A PropertyField in pin 0 and a property name (string) in pin 1 are - expected in input. + r"""Gets a property from an input field/field container. A PropertyFieldin + pin 0, a property name (string) in pin 1 are expected as inputs Parameters ---------- - property_field: PropertyField + property_field: PropertyField or PropertyFieldsContainer property_name: str - Accepted inputs are: 'time_freq_support', 'scoping' and 'header'. + Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'. Returns ------- - property: TimeFreqSupport or Scoping or DataTree - Property value. + property_value: str or TimeFreqSupport or Scoping or DataTree + Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers. Examples -------- @@ -52,7 +52,7 @@ class propertyfield_get_attribute(Operator): ... ) >>> # Get output data - >>> result_property = op.outputs.property() + >>> result_property_value = op.outputs.property_value() """ def __init__( @@ -70,15 +70,15 @@ def __init__( @staticmethod def _spec() -> Specification: - description = r"""A PropertyField in pin 0 and a property name (string) in pin 1 are -expected in input. + description = r"""Gets a property from an input field/field container. A PropertyFieldin +pin 0, a property name (string) in pin 1 are expected as inputs """ spec = Specification( description=description, map_input_pin_spec={ 0: PinSpecification( name="property_field", - type_names=["property_field"], + type_names=["property_field", "property_fields_container"], optional=False, document=r"""""", ), @@ -86,15 +86,20 @@ def _spec() -> Specification: name="property_name", type_names=["string"], optional=False, - document=r"""Accepted inputs are: 'time_freq_support', 'scoping' and 'header'.""", + document=r"""Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'.""", ), }, map_output_pin_spec={ 0: PinSpecification( - name="property", - type_names=["time_freq_support", "scoping", "abstract_data_tree"], + name="property_value", + type_names=[ + "string", + "time_freq_support", + "scoping", + "abstract_data_tree", + ], optional=False, - document=r"""Property value.""", + document=r"""Property value that is returned. Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.""", ), }, ) @@ -194,7 +199,7 @@ def property_field(self) -> Input: def property_name(self) -> Input: r"""Allows to connect property_name input to the operator. - Accepted inputs are: 'time_freq_support', 'scoping' and 'header'. + Property to get. Accepted inputs are specific strings namely: 'unit, 'name','time_freq_support', 'scoping' and 'header'. Returns ------- @@ -221,32 +226,40 @@ class OutputsPropertyfieldGetAttribute(_Outputs): >>> from ansys.dpf import core as dpf >>> op = dpf.operators.utility.propertyfield_get_attribute() >>> # Connect inputs : op.inputs. ... - >>> result_property = op.outputs.property() + >>> result_property_value = op.outputs.property_value() """ def __init__(self, op: Operator): super().__init__(propertyfield_get_attribute._spec().outputs, op) - self.property_as_time_freq_support = Output( + self.property_value_as_string = Output( + _modify_output_spec_with_one_type( + propertyfield_get_attribute._spec().output_pin(0), "string" + ), + 0, + op, + ) + self._outputs.append(self.property_value_as_string) + self.property_value_as_time_freq_support = Output( _modify_output_spec_with_one_type( propertyfield_get_attribute._spec().output_pin(0), "time_freq_support" ), 0, op, ) - self._outputs.append(self.property_as_time_freq_support) - self.property_as_scoping = Output( + self._outputs.append(self.property_value_as_time_freq_support) + self.property_value_as_scoping = Output( _modify_output_spec_with_one_type( propertyfield_get_attribute._spec().output_pin(0), "scoping" ), 0, op, ) - self._outputs.append(self.property_as_scoping) - self.property_as_data_tree = Output( + self._outputs.append(self.property_value_as_scoping) + self.property_value_as_data_tree = Output( _modify_output_spec_with_one_type( propertyfield_get_attribute._spec().output_pin(0), "data_tree" ), 0, op, ) - self._outputs.append(self.property_as_data_tree) + self._outputs.append(self.property_value_as_data_tree) diff --git a/src/ansys/dpf/core/operators/utility/propertyfield_set_property.py b/src/ansys/dpf/core/operators/utility/propertyfield_set_property.py new file mode 100644 index 00000000000..2cb417d775f --- /dev/null +++ b/src/ansys/dpf/core/operators/utility/propertyfield_set_property.py @@ -0,0 +1,300 @@ +""" +propertyfield_set_property + +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.outputs import _modify_output_spec_with_one_type +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 propertyfield_set_property(Operator): + r"""Sets a property to an input field/field container. A PropertyFieldin pin + 0, a property name (string) in pin 1 and a valid property value in pin 2 + are expected as inputs + + + Parameters + ---------- + property_field: PropertyField or PropertyFieldsContainer + property_name: str + Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'. + property_value: str or TimeFreqSupport or Scoping or DataTree or int or + float + Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string. + + Returns + ------- + field_type: PropertyField or PropertyFieldsContainer + Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers. + + Examples + -------- + >>> from ansys.dpf import core as dpf + + >>> # Instantiate operator + >>> op = dpf.operators.utility.propertyfield_set_property() + + >>> # Make input connections + >>> my_property_field = dpf.PropertyField() + >>> op.inputs.property_field.connect(my_property_field) + >>> my_property_name = str() + >>> op.inputs.property_name.connect(my_property_name) + >>> my_property_value = str() + >>> op.inputs.property_value.connect(my_property_value) + + >>> # Instantiate operator and connect inputs in one line + >>> op = dpf.operators.utility.propertyfield_set_property( + ... property_field=my_property_field, + ... property_name=my_property_name, + ... property_value=my_property_value, + ... ) + + >>> # Get output data + >>> result_field_type = op.outputs.field_type() + """ + + def __init__( + self, + property_field=None, + property_name=None, + property_value=None, + config=None, + server=None, + ): + super().__init__( + name="propertyfield::set_property", config=config, server=server + ) + self._inputs = InputsPropertyfieldSetProperty(self) + self._outputs = OutputsPropertyfieldSetProperty(self) + if property_field is not None: + self.inputs.property_field.connect(property_field) + if property_name is not None: + self.inputs.property_name.connect(property_name) + if property_value is not None: + self.inputs.property_value.connect(property_value) + + @staticmethod + def _spec() -> Specification: + description = r"""Sets a property to an input field/field container. A PropertyFieldin pin +0, a property name (string) in pin 1 and a valid property value in pin 2 +are expected as inputs +""" + spec = Specification( + description=description, + map_input_pin_spec={ + 0: PinSpecification( + name="property_field", + type_names=["property_field", "property_fields_container"], + optional=False, + document=r"""""", + ), + 1: PinSpecification( + name="property_name", + type_names=["string"], + optional=False, + document=r"""Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'.""", + ), + 2: PinSpecification( + name="property_value", + type_names=[ + "string", + "time_freq_support", + "scoping", + "abstract_data_tree", + "int32", + "double", + ], + optional=False, + document=r"""Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string.""", + ), + }, + map_output_pin_spec={ + 0: PinSpecification( + name="field_type", + type_names=["property_field", "property_fields_container"], + optional=False, + document=r"""Accepted Outputs are: Field, PropertyField, StringField, CustomTypeField or their containers.""", + ), + }, + ) + 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="propertyfield::set_property", server=server + ) + + @property + def inputs(self) -> InputsPropertyfieldSetProperty: + """Enables to connect inputs to the operator + + Returns + -------- + inputs: + An instance of InputsPropertyfieldSetProperty. + """ + return super().inputs + + @property + def outputs(self) -> OutputsPropertyfieldSetProperty: + """Enables to get outputs of the operator by evaluating it + + Returns + -------- + outputs: + An instance of OutputsPropertyfieldSetProperty. + """ + return super().outputs + + +class InputsPropertyfieldSetProperty(_Inputs): + """Intermediate class used to connect user inputs to + propertyfield_set_property operator. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.propertyfield_set_property() + >>> my_property_field = dpf.PropertyField() + >>> op.inputs.property_field.connect(my_property_field) + >>> my_property_name = str() + >>> op.inputs.property_name.connect(my_property_name) + >>> my_property_value = str() + >>> op.inputs.property_value.connect(my_property_value) + """ + + def __init__(self, op: Operator): + super().__init__(propertyfield_set_property._spec().inputs, op) + self._property_field = Input( + propertyfield_set_property._spec().input_pin(0), 0, op, -1 + ) + self._inputs.append(self._property_field) + self._property_name = Input( + propertyfield_set_property._spec().input_pin(1), 1, op, -1 + ) + self._inputs.append(self._property_name) + self._property_value = Input( + propertyfield_set_property._spec().input_pin(2), 2, op, -1 + ) + self._inputs.append(self._property_value) + + @property + def property_field(self) -> Input: + r"""Allows to connect property_field input to the operator. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.propertyfield_set_property() + >>> op.inputs.property_field.connect(my_property_field) + >>> # or + >>> op.inputs.property_field(my_property_field) + """ + return self._property_field + + @property + def property_name(self) -> Input: + r"""Allows to connect property_name input to the operator. + + Property to set. Accepted inputs are specific strings namely: 'unit', 'name', 'time_freq_support', 'scoping', 'header'. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.propertyfield_set_property() + >>> op.inputs.property_name.connect(my_property_name) + >>> # or + >>> op.inputs.property_name(my_property_name) + """ + return self._property_name + + @property + def property_value(self) -> Input: + r"""Allows to connect property_value input to the operator. + + Property Value to set. Accepted inputs on this pin are: CTimeFreqSupport, CScoping, DataTree, int, double, string. + + Returns + ------- + input: + An Input instance for this pin. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.propertyfield_set_property() + >>> op.inputs.property_value.connect(my_property_value) + >>> # or + >>> op.inputs.property_value(my_property_value) + """ + return self._property_value + + +class OutputsPropertyfieldSetProperty(_Outputs): + """Intermediate class used to get outputs from + propertyfield_set_property operator. + + Examples + -------- + >>> from ansys.dpf import core as dpf + >>> op = dpf.operators.utility.propertyfield_set_property() + >>> # Connect inputs : op.inputs. ... + >>> result_field_type = op.outputs.field_type() + """ + + def __init__(self, op: Operator): + super().__init__(propertyfield_set_property._spec().outputs, op) + self.field_type_as_property_field = Output( + _modify_output_spec_with_one_type( + propertyfield_set_property._spec().output_pin(0), "property_field" + ), + 0, + op, + ) + self._outputs.append(self.field_type_as_property_field) + self.field_type_as_property_fields_container = Output( + _modify_output_spec_with_one_type( + propertyfield_set_property._spec().output_pin(0), + "property_fields_container", + ), + 0, + op, + ) + self._outputs.append(self.field_type_as_property_fields_container) diff --git a/src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll b/src/ansys/dpf/gatebin/Ans.Dpf.GrpcClient.dll index 6b6353dcd7e..23f41c98a2c 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 6ad7bf44713..b4253e80394 100644 Binary files a/src/ansys/dpf/gatebin/DPFClientAPI.dll and b/src/ansys/dpf/gatebin/DPFClientAPI.dll differ diff --git a/src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so b/src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so index cbb50d1bf74..cc6b4d6d8a2 100644 Binary files a/src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so and b/src/ansys/dpf/gatebin/libAns.Dpf.GrpcClient.so differ diff --git a/src/ansys/dpf/gatebin/libDPFClientAPI.so b/src/ansys/dpf/gatebin/libDPFClientAPI.so index 5131f92c0b3..f0aedc209b8 100644 Binary files a/src/ansys/dpf/gatebin/libDPFClientAPI.so and b/src/ansys/dpf/gatebin/libDPFClientAPI.so differ