|
| 1 | +""" |
| 2 | +operator_changelog |
| 3 | +
|
| 4 | +Autogenerated DPF operator classes. |
| 5 | +""" |
| 6 | + |
| 7 | +from __future__ import annotations |
| 8 | + |
| 9 | +from warnings import warn |
| 10 | +from ansys.dpf.core.dpf_operator import Operator |
| 11 | +from ansys.dpf.core.inputs import Input, _Inputs |
| 12 | +from ansys.dpf.core.outputs import Output, _Outputs |
| 13 | +from ansys.dpf.core.operators.specification import PinSpecification, Specification |
| 14 | +from ansys.dpf.core.config import Config |
| 15 | +from ansys.dpf.core.server_types import AnyServerType |
| 16 | + |
| 17 | + |
| 18 | +class operator_changelog(Operator): |
| 19 | + r"""Return a GenericDataContainer used to instantiate the Changelog of an |
| 20 | + operator based on its name. |
| 21 | +
|
| 22 | +
|
| 23 | + Parameters |
| 24 | + ---------- |
| 25 | + operator_name: str |
| 26 | + Operator internal name. |
| 27 | +
|
| 28 | + Returns |
| 29 | + ------- |
| 30 | + changelog_gdc: GenericDataContainer |
| 31 | + GenericDataContainer used to instantiate a Changelog. |
| 32 | +
|
| 33 | + Examples |
| 34 | + -------- |
| 35 | + >>> from ansys.dpf import core as dpf |
| 36 | +
|
| 37 | + >>> # Instantiate operator |
| 38 | + >>> op = dpf.operators.utility.operator_changelog() |
| 39 | +
|
| 40 | + >>> # Make input connections |
| 41 | + >>> my_operator_name = str() |
| 42 | + >>> op.inputs.operator_name.connect(my_operator_name) |
| 43 | +
|
| 44 | + >>> # Instantiate operator and connect inputs in one line |
| 45 | + >>> op = dpf.operators.utility.operator_changelog( |
| 46 | + ... operator_name=my_operator_name, |
| 47 | + ... ) |
| 48 | +
|
| 49 | + >>> # Get output data |
| 50 | + >>> result_changelog_gdc = op.outputs.changelog_gdc() |
| 51 | + """ |
| 52 | + |
| 53 | + def __init__(self, operator_name=None, config=None, server=None): |
| 54 | + super().__init__(name="operator_changelog", config=config, server=server) |
| 55 | + self._inputs = InputsOperatorChangelog(self) |
| 56 | + self._outputs = OutputsOperatorChangelog(self) |
| 57 | + if operator_name is not None: |
| 58 | + self.inputs.operator_name.connect(operator_name) |
| 59 | + |
| 60 | + @staticmethod |
| 61 | + def _spec() -> Specification: |
| 62 | + description = r"""Return a GenericDataContainer used to instantiate the Changelog of an |
| 63 | +operator based on its name. |
| 64 | +""" |
| 65 | + spec = Specification( |
| 66 | + description=description, |
| 67 | + map_input_pin_spec={ |
| 68 | + 0: PinSpecification( |
| 69 | + name="operator_name", |
| 70 | + type_names=["string"], |
| 71 | + optional=False, |
| 72 | + document=r"""Operator internal name.""", |
| 73 | + ), |
| 74 | + }, |
| 75 | + map_output_pin_spec={ |
| 76 | + 0: PinSpecification( |
| 77 | + name="changelog_gdc", |
| 78 | + type_names=["generic_data_container"], |
| 79 | + optional=False, |
| 80 | + document=r"""GenericDataContainer used to instantiate a Changelog.""", |
| 81 | + ), |
| 82 | + }, |
| 83 | + ) |
| 84 | + return spec |
| 85 | + |
| 86 | + @staticmethod |
| 87 | + def default_config(server: AnyServerType = None) -> Config: |
| 88 | + """Returns the default config of the operator. |
| 89 | +
|
| 90 | + This config can then be changed to the user needs and be used to |
| 91 | + instantiate the operator. The Configuration allows to customize |
| 92 | + how the operation will be processed by the operator. |
| 93 | +
|
| 94 | + Parameters |
| 95 | + ---------- |
| 96 | + server: |
| 97 | + Server with channel connected to the remote or local instance. When |
| 98 | + ``None``, attempts to use the global server. |
| 99 | +
|
| 100 | + Returns |
| 101 | + ------- |
| 102 | + config: |
| 103 | + A new Config instance equivalent to the default config for this operator. |
| 104 | + """ |
| 105 | + return Operator.default_config(name="operator_changelog", server=server) |
| 106 | + |
| 107 | + @property |
| 108 | + def inputs(self) -> InputsOperatorChangelog: |
| 109 | + """Enables to connect inputs to the operator |
| 110 | +
|
| 111 | + Returns |
| 112 | + -------- |
| 113 | + inputs: |
| 114 | + An instance of InputsOperatorChangelog. |
| 115 | + """ |
| 116 | + return super().inputs |
| 117 | + |
| 118 | + @property |
| 119 | + def outputs(self) -> OutputsOperatorChangelog: |
| 120 | + """Enables to get outputs of the operator by evaluating it |
| 121 | +
|
| 122 | + Returns |
| 123 | + -------- |
| 124 | + outputs: |
| 125 | + An instance of OutputsOperatorChangelog. |
| 126 | + """ |
| 127 | + return super().outputs |
| 128 | + |
| 129 | + |
| 130 | +class InputsOperatorChangelog(_Inputs): |
| 131 | + """Intermediate class used to connect user inputs to |
| 132 | + operator_changelog operator. |
| 133 | +
|
| 134 | + Examples |
| 135 | + -------- |
| 136 | + >>> from ansys.dpf import core as dpf |
| 137 | + >>> op = dpf.operators.utility.operator_changelog() |
| 138 | + >>> my_operator_name = str() |
| 139 | + >>> op.inputs.operator_name.connect(my_operator_name) |
| 140 | + """ |
| 141 | + |
| 142 | + def __init__(self, op: Operator): |
| 143 | + super().__init__(operator_changelog._spec().inputs, op) |
| 144 | + self._operator_name = Input(operator_changelog._spec().input_pin(0), 0, op, -1) |
| 145 | + self._inputs.append(self._operator_name) |
| 146 | + |
| 147 | + @property |
| 148 | + def operator_name(self) -> Input: |
| 149 | + r"""Allows to connect operator_name input to the operator. |
| 150 | +
|
| 151 | + Operator internal name. |
| 152 | +
|
| 153 | + Returns |
| 154 | + ------- |
| 155 | + input: |
| 156 | + An Input instance for this pin. |
| 157 | +
|
| 158 | + Examples |
| 159 | + -------- |
| 160 | + >>> from ansys.dpf import core as dpf |
| 161 | + >>> op = dpf.operators.utility.operator_changelog() |
| 162 | + >>> op.inputs.operator_name.connect(my_operator_name) |
| 163 | + >>> # or |
| 164 | + >>> op.inputs.operator_name(my_operator_name) |
| 165 | + """ |
| 166 | + return self._operator_name |
| 167 | + |
| 168 | + |
| 169 | +class OutputsOperatorChangelog(_Outputs): |
| 170 | + """Intermediate class used to get outputs from |
| 171 | + operator_changelog operator. |
| 172 | +
|
| 173 | + Examples |
| 174 | + -------- |
| 175 | + >>> from ansys.dpf import core as dpf |
| 176 | + >>> op = dpf.operators.utility.operator_changelog() |
| 177 | + >>> # Connect inputs : op.inputs. ... |
| 178 | + >>> result_changelog_gdc = op.outputs.changelog_gdc() |
| 179 | + """ |
| 180 | + |
| 181 | + def __init__(self, op: Operator): |
| 182 | + super().__init__(operator_changelog._spec().outputs, op) |
| 183 | + self._changelog_gdc = Output(operator_changelog._spec().output_pin(0), 0, op) |
| 184 | + self._outputs.append(self._changelog_gdc) |
| 185 | + |
| 186 | + @property |
| 187 | + def changelog_gdc(self) -> Output: |
| 188 | + r"""Allows to get changelog_gdc output of the operator |
| 189 | +
|
| 190 | + GenericDataContainer used to instantiate a Changelog. |
| 191 | +
|
| 192 | + Returns |
| 193 | + ------- |
| 194 | + output: |
| 195 | + An Output instance for this pin. |
| 196 | +
|
| 197 | + Examples |
| 198 | + -------- |
| 199 | + >>> from ansys.dpf import core as dpf |
| 200 | + >>> op = dpf.operators.utility.operator_changelog() |
| 201 | + >>> # Get the output from op.outputs. ... |
| 202 | + >>> result_changelog_gdc = op.outputs.changelog_gdc() |
| 203 | + """ |
| 204 | + return self._changelog_gdc |
0 commit comments