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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/source/_static/dpf_operators.html
Original file line number Diff line number Diff line change
Expand Up @@ -8108,7 +8108,10 @@ <h2 class="h2-main">Configurating operators</h2>
</div></td></tr></tbody></table><table class="pin-box"><tbody><tr><td><pin-number-optional n="3" ellipsis = "false"></pin-number-optional></td><td><pin-name name="streams_container"></pin-name></td><td><req-type typeName="(streams_container)"></req-type></td><td><div class = "pin-des-text"><p>result file container allowed to be kept open to cache data</p>
</div></td></tr></tbody></table><table class="pin-box"><tbody><tr><td><pin-number n="4" ellipsis = "false"></pin-number></td><td><pin-name name="data_sources"></pin-name></td><td><req-type typeName="(data_sources)"></req-type></td><td><div class = "pin-des-text"><p>result file path container, used if no streams are set</p>
</div></td></tr></tbody></table><table class="pin-box"><tbody><tr><td><pin-number-optional n="50" ellipsis = "false"></pin-number-optional></td><td><pin-name name="unit_system"></pin-name></td><td><req-type typeName="(int32 | string | class dataProcessing::unit::CUnitSystem)"></req-type></td><td><div class = "pin-des-text"><p>Unit System ID (int), semicolon-separated list of base unit strings (str) or UnitSystem instance</p>
</div></td></tr></tbody></table></div><h2 class="op-des-h2">Outputs</h2><div><table class="pin-box"><tbody><tr><td><pin-number n="0" ellipsis = "false"></pin-number></td><td><pin-name name="fields_container"></pin-name></td><td><req-type typeName="(fields_container)"></req-type></td></tr></tbody></table></div><h2 class="op-des-h2">Configurations</h2><config-spec name="mutex" default="false" doc="If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads." types="bool" ></config-spec><h2 class="op-des-h2">Scripting</h2><scripting-part scripting_name="beam_s_bending_moment" license="none" cat="result" plugin="core" cpp-name="B_M1"></scripting-part></div><div class="operator" id="beam RS shear stress (LSDyna)" scripting_name="beam_rs_shear_stress"plugin="core"cat="result"><h1 class="op-des-h1">result: beam RS shear stress (LSDyna)</h1><figure class="figure-op-des"> <figcaption > Description </figcaption><div class = "figure-op-des-text"><p>Read Beam RS Shear Stress (LSDyna) by calling the readers defined by the datasources.</p>
</div></td></tr></tbody></table></div><h2 class="op-des-h2">Outputs</h2><div><table class="pin-box"><tbody><tr><td><pin-number n="0" ellipsis = "false"></pin-number></td><td><pin-name name="fields_container"></pin-name></td><td><req-type typeName="(fields_container)"></req-type></td></tr></tbody></table></div><h2 class="op-des-h2">Configurations</h2><config-spec name="mutex" default="false" doc="If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads." types="bool" ></config-spec><h2 class="op-des-h2">Scripting</h2><scripting-part scripting_name="beam_s_bending_moment" license="none" cat="result" plugin="core" cpp-name="B_M1"></scripting-part></div><div class="operator" id="operator changelog" scripting_name="operator_changelog"plugin="core"cat="utility"><h1 class="op-des-h1">utility: operator changelog</h1><figure class="figure-op-des"> <figcaption > Description </figcaption><div class = "figure-op-des-text"><p>Return a GenericDataContainer used to instantiate the Changelog of an operator based on its name.</p>
</div></figure><h2 class="op-des-h2">Inputs</h2><div><table class="pin-box"><tbody><tr><td><pin-number n="0" ellipsis = "false"></pin-number></td><td><pin-name name="operator_name"></pin-name></td><td><req-type typeName="(string)"></req-type></td><td><div class = "pin-des-text"><p>Operator internal name.</p>
</div></td></tr></tbody></table></div><h2 class="op-des-h2">Outputs</h2><div><table class="pin-box"><tbody><tr><td><pin-number n="0" ellipsis = "false"></pin-number></td><td><pin-name name="changelog_gdc"></pin-name></td><td><req-type typeName="(generic_data_container)"></req-type></td><td><div class = "pin-des-text"><p>GenericDataContainer used to instantiate a Changelog.</p>
</div></td></tr></tbody></table></div><h2 class="op-des-h2">Configurations</h2><config-spec name="mutex" default="false" doc="If this option is set to true, the shared memory is prevented from being simultaneously accessed by multiple threads." types="bool" ></config-spec><h2 class="op-des-h2">Scripting</h2><scripting-part scripting_name="operator_changelog" license="none" cat="utility" plugin="core" cpp-name="operator_changelog"></scripting-part></div><div class="operator" id="beam RS shear stress (LSDyna)" scripting_name="beam_rs_shear_stress"plugin="core"cat="result"><h1 class="op-des-h1">result: beam RS shear stress (LSDyna)</h1><figure class="figure-op-des"> <figcaption > Description </figcaption><div class = "figure-op-des-text"><p>Read Beam RS Shear Stress (LSDyna) by calling the readers defined by the datasources.</p>
</div></figure><h2 class="op-des-h2">Inputs</h2><div><table class="pin-box"><tbody><tr><td><pin-number-optional n="0" ellipsis = "false"></pin-number-optional></td><td><pin-name name="time_scoping"></pin-name></td><td><req-type typeName="(scoping | int32 | vector<int32> | double | field | vector<double>)"></req-type></td><td><div class = "pin-des-text"><p>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 &quot;TimeFreq_steps&quot;. 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.</p>
</div></td></tr></tbody></table><table class="pin-box"><tbody><tr><td><pin-number-optional n="1" ellipsis = "false"></pin-number-optional></td><td><pin-name name="mesh_scoping"></pin-name></td><td><req-type typeName="(scopings_container | scoping)"></req-type></td><td><div class = "pin-des-text"><p>elements scoping required in output.</p>
</div></td></tr></tbody></table><table class="pin-box"><tbody><tr><td><pin-number-optional n="3" ellipsis = "false"></pin-number-optional></td><td><pin-name name="streams_container"></pin-name></td><td><req-type typeName="(streams_container)"></req-type></td><td><div class = "pin-des-text"><p>result file container allowed to be kept open to cache data</p>
Expand Down
1 change: 1 addition & 0 deletions src/ansys/dpf/core/operators/utility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
from .mesh import mesh
from .mesh_to_mc import mesh_to_mc
from .meshes_container import meshes_container
from .operator_changelog import operator_changelog
from .operator_id import operator_id
from .overlap_fields import overlap_fields
from .producer_consumer_for_each import producer_consumer_for_each
Expand Down
204 changes: 204 additions & 0 deletions src/ansys/dpf/core/operators/utility/operator_changelog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
"""
operator_changelog

Autogenerated DPF operator classes.
"""

from __future__ import annotations

from warnings import warn
from ansys.dpf.core.dpf_operator import Operator
from ansys.dpf.core.inputs import Input, _Inputs
from ansys.dpf.core.outputs import Output, _Outputs
from ansys.dpf.core.operators.specification import PinSpecification, Specification
from ansys.dpf.core.config import Config
from ansys.dpf.core.server_types import AnyServerType


class operator_changelog(Operator):
r"""Return a GenericDataContainer used to instantiate the Changelog of an
operator based on its name.


Parameters
----------
operator_name: str
Operator internal name.

Returns
-------
changelog_gdc: GenericDataContainer
GenericDataContainer used to instantiate a Changelog.

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

>>> # Instantiate operator
>>> op = dpf.operators.utility.operator_changelog()

>>> # Make input connections
>>> my_operator_name = str()
>>> op.inputs.operator_name.connect(my_operator_name)

>>> # Instantiate operator and connect inputs in one line
>>> op = dpf.operators.utility.operator_changelog(
... operator_name=my_operator_name,
... )

>>> # Get output data
>>> result_changelog_gdc = op.outputs.changelog_gdc()
"""

def __init__(self, operator_name=None, config=None, server=None):
super().__init__(name="operator_changelog", config=config, server=server)
self._inputs = InputsOperatorChangelog(self)
self._outputs = OutputsOperatorChangelog(self)
if operator_name is not None:
self.inputs.operator_name.connect(operator_name)

@staticmethod
def _spec() -> Specification:
description = r"""Return a GenericDataContainer used to instantiate the Changelog of an
operator based on its name.
"""
spec = Specification(
description=description,
map_input_pin_spec={
0: PinSpecification(
name="operator_name",
type_names=["string"],
optional=False,
document=r"""Operator internal name.""",
),
},
map_output_pin_spec={
0: PinSpecification(
name="changelog_gdc",
type_names=["generic_data_container"],
optional=False,
document=r"""GenericDataContainer used to instantiate a Changelog.""",
),
},
)
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="operator_changelog", server=server)

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

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

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

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


class InputsOperatorChangelog(_Inputs):
"""Intermediate class used to connect user inputs to
operator_changelog operator.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_changelog()
>>> my_operator_name = str()
>>> op.inputs.operator_name.connect(my_operator_name)
"""

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

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

Operator internal name.

Returns
-------
input:
An Input instance for this pin.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_changelog()
>>> op.inputs.operator_name.connect(my_operator_name)
>>> # or
>>> op.inputs.operator_name(my_operator_name)
"""
return self._operator_name


class OutputsOperatorChangelog(_Outputs):
"""Intermediate class used to get outputs from
operator_changelog operator.

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_changelog()
>>> # Connect inputs : op.inputs. ...
>>> result_changelog_gdc = op.outputs.changelog_gdc()
"""

def __init__(self, op: Operator):
super().__init__(operator_changelog._spec().outputs, op)
self._changelog_gdc = Output(operator_changelog._spec().output_pin(0), 0, op)
self._outputs.append(self._changelog_gdc)

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

GenericDataContainer used to instantiate a Changelog.

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

Examples
--------
>>> from ansys.dpf import core as dpf
>>> op = dpf.operators.utility.operator_changelog()
>>> # Get the output from op.outputs. ...
>>> result_changelog_gdc = op.outputs.changelog_gdc()
"""
return self._changelog_gdc
2 changes: 0 additions & 2 deletions src/ansys/dpf/gate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
from .generated import result_info_capi
from .generated import scoping_abstract_api
from .generated import scoping_capi
from .generated import semantic_version_abstract_api
from .generated import semantic_version_capi
from .generated import serialization_stream_abstract_api
from .generated import serialization_stream_capi
from .generated import session_abstract_api
Expand Down
27 changes: 6 additions & 21 deletions src/ansys/dpf/gate/generated/capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3195,12 +3195,12 @@ def load_api(path):
dll.Operator_specification_GetPinDerivedClassTypeName.restype = ctypes.POINTER(ctypes.c_char)

if hasattr(dll, "Operator_specification_SetVersion"):
dll.Operator_specification_SetVersion.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Operator_specification_SetVersion.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Operator_specification_SetVersion.restype = None

if hasattr(dll, "Operator_specification_GetVersion"):
dll.Operator_specification_GetVersion.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Operator_specification_GetVersion.restype = ctypes.c_void_p
dll.Operator_specification_GetVersion.restype = ctypes.POINTER(ctypes.c_char)

if hasattr(dll, "Operator_specification_GetPinNumAliases"):
dll.Operator_specification_GetPinNumAliases.argtypes = (ctypes.c_void_p, ctypes.c_bool, ctypes.c_int32, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
Expand All @@ -3210,6 +3210,10 @@ def load_api(path):
dll.Operator_specification_GetPinAlias.argtypes = (ctypes.c_void_p, ctypes.c_bool, ctypes.c_int32, ctypes.c_int32, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Operator_specification_GetPinAlias.restype = ctypes.POINTER(ctypes.c_char)

if hasattr(dll, "Operator_specification_SetChangelog"):
dll.Operator_specification_SetChangelog.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Operator_specification_SetChangelog.restype = None

if hasattr(dll, "Operator_specification_new_on_client"):
dll.Operator_specification_new_on_client.argtypes = (ctypes.c_void_p, ctypes.POINTER(ctypes.c_char), ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Operator_specification_new_on_client.restype = ctypes.c_void_p
Expand Down Expand Up @@ -3832,25 +3836,6 @@ def load_api(path):
dll.Scoping_getCopy.argtypes = (ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.Scoping_getCopy.restype = ctypes.c_void_p

#-------------------------------------------------------------------------------
# SemanticVersion
#-------------------------------------------------------------------------------
if hasattr(dll, "SemanticVersion_new"):
dll.SemanticVersion_new.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.SemanticVersion_new.restype = ctypes.c_void_p

if hasattr(dll, "SemanticVersion_getComponents"):
dll.SemanticVersion_getComponents.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.SemanticVersion_getComponents.restype = None

if hasattr(dll, "SemanticVersion_eq"):
dll.SemanticVersion_eq.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.SemanticVersion_eq.restype = ctypes.c_bool

if hasattr(dll, "SemanticVersion_lt"):
dll.SemanticVersion_lt.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32), ctypes.POINTER(ctypes.c_wchar_p), )
dll.SemanticVersion_lt.restype = ctypes.c_bool

#-------------------------------------------------------------------------------
# SerializationStream
#-------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def operator_specification_get_pin_num_aliases(specification, binput, numPin):
def operator_specification_get_pin_alias(specification, binput, numPin, numAlias):
raise NotImplementedError

@staticmethod
def operator_specification_set_changelog(specification, changelog):
raise NotImplementedError

@staticmethod
def operator_specification_new_on_client(client, op):
raise NotImplementedError
Expand Down
15 changes: 13 additions & 2 deletions src/ansys/dpf/gate/generated/operator_specification_capi.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def operator_specification_get_pin_derived_class_type_name(specification, binput
def operator_specification_set_version(specification, semver):
errorSize = ctypes.c_int(0)
sError = ctypes.c_wchar_p()
res = capi.dll.Operator_specification_SetVersion(specification._internal_obj if specification is not None else None, semver._internal_obj if semver is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
res = capi.dll.Operator_specification_SetVersion(specification._internal_obj if specification is not None else None, utils.to_char_ptr(semver), ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
if errorSize.value != 0:
raise errors.DPFServerException(sError.value)
return res
Expand All @@ -335,7 +335,9 @@ def operator_specification_get_version(specification):
res = capi.dll.Operator_specification_GetVersion(specification._internal_obj if specification is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
if errorSize.value != 0:
raise errors.DPFServerException(sError.value)
return res
newres = ctypes.cast(res, ctypes.c_char_p).value.decode("utf-8") if res else None
capi.dll.DataProcessing_String_post_event(res, ctypes.byref(errorSize), ctypes.byref(sError))
return newres

@staticmethod
def operator_specification_get_pin_num_aliases(specification, binput, numPin):
Expand All @@ -357,6 +359,15 @@ def operator_specification_get_pin_alias(specification, binput, numPin, numAlias
capi.dll.DataProcessing_String_post_event(res, ctypes.byref(errorSize), ctypes.byref(sError))
return newres

@staticmethod
def operator_specification_set_changelog(specification, changelog):
errorSize = ctypes.c_int(0)
sError = ctypes.c_wchar_p()
res = capi.dll.Operator_specification_SetChangelog(specification._internal_obj if specification is not None else None, changelog._internal_obj if changelog is not None else None, ctypes.byref(utils.to_int32(errorSize)), ctypes.byref(sError))
if errorSize.value != 0:
raise errors.DPFServerException(sError.value)
return res

@staticmethod
def operator_specification_new_on_client(client, op):
errorSize = ctypes.c_int(0)
Expand Down
Loading