|
| 1 | +""" |
| 2 | +field_clone_to_shell_layer |
| 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 field_clone_to_shell_layer(Operator): |
| 19 | + r"""Generates a Field from the Field in input 0 that has the same |
| 20 | + FieldDefinition with the exception of the shellLayers enum that is |
| 21 | + specified in input 1. The DataPointer is recomputed to the appropriate |
| 22 | + value. The Data of the output Field is 0.0 for all entities. Scoping can |
| 23 | + be shared or not based on the optional pin 2. |
| 24 | +
|
| 25 | +
|
| 26 | + Parameters |
| 27 | + ---------- |
| 28 | + field: Field |
| 29 | + shell_layer: int |
| 30 | + 0: Top, 1: Bottom, 2: BottomTop, 3: Mid, 4: BottomTopMid. |
| 31 | + duplicate_scoping: bool, optional |
| 32 | + If true, a new scoping is computed for the output Field. If false, the input Field scoping is used. Default is false. |
| 33 | +
|
| 34 | + Returns |
| 35 | + ------- |
| 36 | + field: Field |
| 37 | +
|
| 38 | + Examples |
| 39 | + -------- |
| 40 | + >>> from ansys.dpf import core as dpf |
| 41 | +
|
| 42 | + >>> # Instantiate operator |
| 43 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 44 | +
|
| 45 | + >>> # Make input connections |
| 46 | + >>> my_field = dpf.Field() |
| 47 | + >>> op.inputs.field.connect(my_field) |
| 48 | + >>> my_shell_layer = int() |
| 49 | + >>> op.inputs.shell_layer.connect(my_shell_layer) |
| 50 | + >>> my_duplicate_scoping = bool() |
| 51 | + >>> op.inputs.duplicate_scoping.connect(my_duplicate_scoping) |
| 52 | +
|
| 53 | + >>> # Instantiate operator and connect inputs in one line |
| 54 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer( |
| 55 | + ... field=my_field, |
| 56 | + ... shell_layer=my_shell_layer, |
| 57 | + ... duplicate_scoping=my_duplicate_scoping, |
| 58 | + ... ) |
| 59 | +
|
| 60 | + >>> # Get output data |
| 61 | + >>> result_field = op.outputs.field() |
| 62 | + """ |
| 63 | + |
| 64 | + def __init__( |
| 65 | + self, |
| 66 | + field=None, |
| 67 | + shell_layer=None, |
| 68 | + duplicate_scoping=None, |
| 69 | + config=None, |
| 70 | + server=None, |
| 71 | + ): |
| 72 | + super().__init__( |
| 73 | + name="field::clone_to_shell_layer", config=config, server=server |
| 74 | + ) |
| 75 | + self._inputs = InputsFieldCloneToShellLayer(self) |
| 76 | + self._outputs = OutputsFieldCloneToShellLayer(self) |
| 77 | + if field is not None: |
| 78 | + self.inputs.field.connect(field) |
| 79 | + if shell_layer is not None: |
| 80 | + self.inputs.shell_layer.connect(shell_layer) |
| 81 | + if duplicate_scoping is not None: |
| 82 | + self.inputs.duplicate_scoping.connect(duplicate_scoping) |
| 83 | + |
| 84 | + @staticmethod |
| 85 | + def _spec() -> Specification: |
| 86 | + description = r"""Generates a Field from the Field in input 0 that has the same |
| 87 | +FieldDefinition with the exception of the shellLayers enum that is |
| 88 | +specified in input 1. The DataPointer is recomputed to the appropriate |
| 89 | +value. The Data of the output Field is 0.0 for all entities. Scoping can |
| 90 | +be shared or not based on the optional pin 2. |
| 91 | +""" |
| 92 | + spec = Specification( |
| 93 | + description=description, |
| 94 | + map_input_pin_spec={ |
| 95 | + 0: PinSpecification( |
| 96 | + name="field", |
| 97 | + type_names=["field"], |
| 98 | + optional=False, |
| 99 | + document=r"""""", |
| 100 | + ), |
| 101 | + 1: PinSpecification( |
| 102 | + name="shell_layer", |
| 103 | + type_names=["int32", "enum dataProcessing::EShellLayers"], |
| 104 | + optional=False, |
| 105 | + document=r"""0: Top, 1: Bottom, 2: BottomTop, 3: Mid, 4: BottomTopMid.""", |
| 106 | + ), |
| 107 | + 2: PinSpecification( |
| 108 | + name="duplicate_scoping", |
| 109 | + type_names=["bool"], |
| 110 | + optional=True, |
| 111 | + document=r"""If true, a new scoping is computed for the output Field. If false, the input Field scoping is used. Default is false.""", |
| 112 | + ), |
| 113 | + }, |
| 114 | + map_output_pin_spec={ |
| 115 | + 0: PinSpecification( |
| 116 | + name="field", |
| 117 | + type_names=["field"], |
| 118 | + optional=False, |
| 119 | + document=r"""""", |
| 120 | + ), |
| 121 | + }, |
| 122 | + ) |
| 123 | + return spec |
| 124 | + |
| 125 | + @staticmethod |
| 126 | + def default_config(server: AnyServerType = None) -> Config: |
| 127 | + """Returns the default config of the operator. |
| 128 | +
|
| 129 | + This config can then be changed to the user needs and be used to |
| 130 | + instantiate the operator. The Configuration allows to customize |
| 131 | + how the operation will be processed by the operator. |
| 132 | +
|
| 133 | + Parameters |
| 134 | + ---------- |
| 135 | + server: |
| 136 | + Server with channel connected to the remote or local instance. When |
| 137 | + ``None``, attempts to use the global server. |
| 138 | +
|
| 139 | + Returns |
| 140 | + ------- |
| 141 | + config: |
| 142 | + A new Config instance equivalent to the default config for this operator. |
| 143 | + """ |
| 144 | + return Operator.default_config( |
| 145 | + name="field::clone_to_shell_layer", server=server |
| 146 | + ) |
| 147 | + |
| 148 | + @property |
| 149 | + def inputs(self) -> InputsFieldCloneToShellLayer: |
| 150 | + """Enables to connect inputs to the operator |
| 151 | +
|
| 152 | + Returns |
| 153 | + -------- |
| 154 | + inputs: |
| 155 | + An instance of InputsFieldCloneToShellLayer. |
| 156 | + """ |
| 157 | + return super().inputs |
| 158 | + |
| 159 | + @property |
| 160 | + def outputs(self) -> OutputsFieldCloneToShellLayer: |
| 161 | + """Enables to get outputs of the operator by evaluating it |
| 162 | +
|
| 163 | + Returns |
| 164 | + -------- |
| 165 | + outputs: |
| 166 | + An instance of OutputsFieldCloneToShellLayer. |
| 167 | + """ |
| 168 | + return super().outputs |
| 169 | + |
| 170 | + |
| 171 | +class InputsFieldCloneToShellLayer(_Inputs): |
| 172 | + """Intermediate class used to connect user inputs to |
| 173 | + field_clone_to_shell_layer operator. |
| 174 | +
|
| 175 | + Examples |
| 176 | + -------- |
| 177 | + >>> from ansys.dpf import core as dpf |
| 178 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 179 | + >>> my_field = dpf.Field() |
| 180 | + >>> op.inputs.field.connect(my_field) |
| 181 | + >>> my_shell_layer = int() |
| 182 | + >>> op.inputs.shell_layer.connect(my_shell_layer) |
| 183 | + >>> my_duplicate_scoping = bool() |
| 184 | + >>> op.inputs.duplicate_scoping.connect(my_duplicate_scoping) |
| 185 | + """ |
| 186 | + |
| 187 | + def __init__(self, op: Operator): |
| 188 | + super().__init__(field_clone_to_shell_layer._spec().inputs, op) |
| 189 | + self._field = Input(field_clone_to_shell_layer._spec().input_pin(0), 0, op, -1) |
| 190 | + self._inputs.append(self._field) |
| 191 | + self._shell_layer = Input( |
| 192 | + field_clone_to_shell_layer._spec().input_pin(1), 1, op, -1 |
| 193 | + ) |
| 194 | + self._inputs.append(self._shell_layer) |
| 195 | + self._duplicate_scoping = Input( |
| 196 | + field_clone_to_shell_layer._spec().input_pin(2), 2, op, -1 |
| 197 | + ) |
| 198 | + self._inputs.append(self._duplicate_scoping) |
| 199 | + |
| 200 | + @property |
| 201 | + def field(self) -> Input: |
| 202 | + r"""Allows to connect field input to the operator. |
| 203 | +
|
| 204 | + Returns |
| 205 | + ------- |
| 206 | + input: |
| 207 | + An Input instance for this pin. |
| 208 | +
|
| 209 | + Examples |
| 210 | + -------- |
| 211 | + >>> from ansys.dpf import core as dpf |
| 212 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 213 | + >>> op.inputs.field.connect(my_field) |
| 214 | + >>> # or |
| 215 | + >>> op.inputs.field(my_field) |
| 216 | + """ |
| 217 | + return self._field |
| 218 | + |
| 219 | + @property |
| 220 | + def shell_layer(self) -> Input: |
| 221 | + r"""Allows to connect shell_layer input to the operator. |
| 222 | +
|
| 223 | + 0: Top, 1: Bottom, 2: BottomTop, 3: Mid, 4: BottomTopMid. |
| 224 | +
|
| 225 | + Returns |
| 226 | + ------- |
| 227 | + input: |
| 228 | + An Input instance for this pin. |
| 229 | +
|
| 230 | + Examples |
| 231 | + -------- |
| 232 | + >>> from ansys.dpf import core as dpf |
| 233 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 234 | + >>> op.inputs.shell_layer.connect(my_shell_layer) |
| 235 | + >>> # or |
| 236 | + >>> op.inputs.shell_layer(my_shell_layer) |
| 237 | + """ |
| 238 | + return self._shell_layer |
| 239 | + |
| 240 | + @property |
| 241 | + def duplicate_scoping(self) -> Input: |
| 242 | + r"""Allows to connect duplicate_scoping input to the operator. |
| 243 | +
|
| 244 | + If true, a new scoping is computed for the output Field. If false, the input Field scoping is used. Default is false. |
| 245 | +
|
| 246 | + Returns |
| 247 | + ------- |
| 248 | + input: |
| 249 | + An Input instance for this pin. |
| 250 | +
|
| 251 | + Examples |
| 252 | + -------- |
| 253 | + >>> from ansys.dpf import core as dpf |
| 254 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 255 | + >>> op.inputs.duplicate_scoping.connect(my_duplicate_scoping) |
| 256 | + >>> # or |
| 257 | + >>> op.inputs.duplicate_scoping(my_duplicate_scoping) |
| 258 | + """ |
| 259 | + return self._duplicate_scoping |
| 260 | + |
| 261 | + |
| 262 | +class OutputsFieldCloneToShellLayer(_Outputs): |
| 263 | + """Intermediate class used to get outputs from |
| 264 | + field_clone_to_shell_layer operator. |
| 265 | +
|
| 266 | + Examples |
| 267 | + -------- |
| 268 | + >>> from ansys.dpf import core as dpf |
| 269 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 270 | + >>> # Connect inputs : op.inputs. ... |
| 271 | + >>> result_field = op.outputs.field() |
| 272 | + """ |
| 273 | + |
| 274 | + def __init__(self, op: Operator): |
| 275 | + super().__init__(field_clone_to_shell_layer._spec().outputs, op) |
| 276 | + self._field = Output(field_clone_to_shell_layer._spec().output_pin(0), 0, op) |
| 277 | + self._outputs.append(self._field) |
| 278 | + |
| 279 | + @property |
| 280 | + def field(self) -> Output: |
| 281 | + r"""Allows to get field output of the operator |
| 282 | +
|
| 283 | + Returns |
| 284 | + ------- |
| 285 | + output: |
| 286 | + An Output instance for this pin. |
| 287 | +
|
| 288 | + Examples |
| 289 | + -------- |
| 290 | + >>> from ansys.dpf import core as dpf |
| 291 | + >>> op = dpf.operators.utility.field_clone_to_shell_layer() |
| 292 | + >>> # Get the output from op.outputs. ... |
| 293 | + >>> result_field = op.outputs.field() |
| 294 | + """ |
| 295 | + return self._field |
0 commit comments