|
| 1 | +""" |
| 2 | +change_fc |
| 3 | +========= |
| 4 | +Autogenerated DPF operator classes. |
| 5 | +""" |
| 6 | + |
| 7 | +from warnings import warn |
| 8 | +from ansys.dpf.core.dpf_operator import Operator |
| 9 | +from ansys.dpf.core.inputs import Input, _Inputs |
| 10 | +from ansys.dpf.core.outputs import Output, _Outputs |
| 11 | +from ansys.dpf.core.operators.specification import PinSpecification, Specification |
| 12 | + |
| 13 | + |
| 14 | +class change_fc(Operator): |
| 15 | + """DEPRECATED, PLEASE USE ADAPT WITH SCOPINGS CONTAINER. Rescopes/splits |
| 16 | + a fields container to correspond to a scopings container. |
| 17 | +
|
| 18 | + Parameters |
| 19 | + ---------- |
| 20 | + field_or_fields_container : FieldsContainer or Field |
| 21 | + scopings_container : ScopingsContainer |
| 22 | +
|
| 23 | + Returns |
| 24 | + ------- |
| 25 | + fields_container : FieldsContainer |
| 26 | +
|
| 27 | + Examples |
| 28 | + -------- |
| 29 | + >>> from ansys.dpf import core as dpf |
| 30 | +
|
| 31 | + >>> # Instantiate operator |
| 32 | + >>> op = dpf.operators.scoping.change_fc() |
| 33 | +
|
| 34 | + >>> # Make input connections |
| 35 | + >>> my_field_or_fields_container = dpf.FieldsContainer() |
| 36 | + >>> op.inputs.field_or_fields_container.connect(my_field_or_fields_container) |
| 37 | + >>> my_scopings_container = dpf.ScopingsContainer() |
| 38 | + >>> op.inputs.scopings_container.connect(my_scopings_container) |
| 39 | +
|
| 40 | + >>> # Instantiate operator and connect inputs in one line |
| 41 | + >>> op = dpf.operators.scoping.change_fc( |
| 42 | + ... field_or_fields_container=my_field_or_fields_container, |
| 43 | + ... scopings_container=my_scopings_container, |
| 44 | + ... ) |
| 45 | +
|
| 46 | + >>> # Get output data |
| 47 | + >>> result_fields_container = op.outputs.fields_container() |
| 48 | + """ |
| 49 | + |
| 50 | + def __init__( |
| 51 | + self, |
| 52 | + field_or_fields_container=None, |
| 53 | + scopings_container=None, |
| 54 | + config=None, |
| 55 | + server=None, |
| 56 | + ): |
| 57 | + super().__init__(name="change_fc", config=config, server=server) |
| 58 | + self._inputs = InputsChangeFc(self) |
| 59 | + self._outputs = OutputsChangeFc(self) |
| 60 | + if field_or_fields_container is not None: |
| 61 | + self.inputs.field_or_fields_container.connect(field_or_fields_container) |
| 62 | + if scopings_container is not None: |
| 63 | + self.inputs.scopings_container.connect(scopings_container) |
| 64 | + |
| 65 | + @staticmethod |
| 66 | + def _spec(): |
| 67 | + description = """DEPRECATED, PLEASE USE ADAPT WITH SCOPINGS CONTAINER. Rescopes/splits |
| 68 | + a fields container to correspond to a scopings container.""" |
| 69 | + spec = Specification( |
| 70 | + description=description, |
| 71 | + map_input_pin_spec={ |
| 72 | + 0: PinSpecification( |
| 73 | + name="field_or_fields_container", |
| 74 | + type_names=["fields_container", "field"], |
| 75 | + optional=False, |
| 76 | + document="""""", |
| 77 | + ), |
| 78 | + 1: PinSpecification( |
| 79 | + name="scopings_container", |
| 80 | + type_names=["scopings_container"], |
| 81 | + optional=False, |
| 82 | + document="""""", |
| 83 | + ), |
| 84 | + }, |
| 85 | + map_output_pin_spec={ |
| 86 | + 0: PinSpecification( |
| 87 | + name="fields_container", |
| 88 | + type_names=["fields_container"], |
| 89 | + optional=False, |
| 90 | + document="""""", |
| 91 | + ), |
| 92 | + }, |
| 93 | + ) |
| 94 | + return spec |
| 95 | + |
| 96 | + @staticmethod |
| 97 | + def default_config(server=None): |
| 98 | + """Returns the default config of the operator. |
| 99 | +
|
| 100 | + This config can then be changed to the user needs and be used to |
| 101 | + instantiate the operator. The Configuration allows to customize |
| 102 | + how the operation will be processed by the operator. |
| 103 | +
|
| 104 | + Parameters |
| 105 | + ---------- |
| 106 | + server : server.DPFServer, optional |
| 107 | + Server with channel connected to the remote or local instance. When |
| 108 | + ``None``, attempts to use the global server. |
| 109 | + """ |
| 110 | + return Operator.default_config(name="change_fc", server=server) |
| 111 | + |
| 112 | + @property |
| 113 | + def inputs(self): |
| 114 | + """Enables to connect inputs to the operator |
| 115 | +
|
| 116 | + Returns |
| 117 | + -------- |
| 118 | + inputs : InputsChangeFc |
| 119 | + """ |
| 120 | + return super().inputs |
| 121 | + |
| 122 | + @property |
| 123 | + def outputs(self): |
| 124 | + """Enables to get outputs of the operator by evaluating it |
| 125 | +
|
| 126 | + Returns |
| 127 | + -------- |
| 128 | + outputs : OutputsChangeFc |
| 129 | + """ |
| 130 | + return super().outputs |
| 131 | + |
| 132 | + |
| 133 | +class InputsChangeFc(_Inputs): |
| 134 | + """Intermediate class used to connect user inputs to |
| 135 | + change_fc operator. |
| 136 | +
|
| 137 | + Examples |
| 138 | + -------- |
| 139 | + >>> from ansys.dpf import core as dpf |
| 140 | + >>> op = dpf.operators.scoping.change_fc() |
| 141 | + >>> my_field_or_fields_container = dpf.FieldsContainer() |
| 142 | + >>> op.inputs.field_or_fields_container.connect(my_field_or_fields_container) |
| 143 | + >>> my_scopings_container = dpf.ScopingsContainer() |
| 144 | + >>> op.inputs.scopings_container.connect(my_scopings_container) |
| 145 | + """ |
| 146 | + |
| 147 | + def __init__(self, op: Operator): |
| 148 | + super().__init__(change_fc._spec().inputs, op) |
| 149 | + self._field_or_fields_container = Input( |
| 150 | + change_fc._spec().input_pin(0), 0, op, -1 |
| 151 | + ) |
| 152 | + self._inputs.append(self._field_or_fields_container) |
| 153 | + self._scopings_container = Input(change_fc._spec().input_pin(1), 1, op, -1) |
| 154 | + self._inputs.append(self._scopings_container) |
| 155 | + |
| 156 | + @property |
| 157 | + def field_or_fields_container(self): |
| 158 | + """Allows to connect field_or_fields_container input to the operator. |
| 159 | +
|
| 160 | + Parameters |
| 161 | + ---------- |
| 162 | + my_field_or_fields_container : FieldsContainer or Field |
| 163 | +
|
| 164 | + Examples |
| 165 | + -------- |
| 166 | + >>> from ansys.dpf import core as dpf |
| 167 | + >>> op = dpf.operators.scoping.change_fc() |
| 168 | + >>> op.inputs.field_or_fields_container.connect(my_field_or_fields_container) |
| 169 | + >>> # or |
| 170 | + >>> op.inputs.field_or_fields_container(my_field_or_fields_container) |
| 171 | + """ |
| 172 | + return self._field_or_fields_container |
| 173 | + |
| 174 | + @property |
| 175 | + def scopings_container(self): |
| 176 | + """Allows to connect scopings_container input to the operator. |
| 177 | +
|
| 178 | + Parameters |
| 179 | + ---------- |
| 180 | + my_scopings_container : ScopingsContainer |
| 181 | +
|
| 182 | + Examples |
| 183 | + -------- |
| 184 | + >>> from ansys.dpf import core as dpf |
| 185 | + >>> op = dpf.operators.scoping.change_fc() |
| 186 | + >>> op.inputs.scopings_container.connect(my_scopings_container) |
| 187 | + >>> # or |
| 188 | + >>> op.inputs.scopings_container(my_scopings_container) |
| 189 | + """ |
| 190 | + return self._scopings_container |
| 191 | + |
| 192 | + |
| 193 | +class OutputsChangeFc(_Outputs): |
| 194 | + """Intermediate class used to get outputs from |
| 195 | + change_fc operator. |
| 196 | +
|
| 197 | + Examples |
| 198 | + -------- |
| 199 | + >>> from ansys.dpf import core as dpf |
| 200 | + >>> op = dpf.operators.scoping.change_fc() |
| 201 | + >>> # Connect inputs : op.inputs. ... |
| 202 | + >>> result_fields_container = op.outputs.fields_container() |
| 203 | + """ |
| 204 | + |
| 205 | + def __init__(self, op: Operator): |
| 206 | + super().__init__(change_fc._spec().outputs, op) |
| 207 | + self._fields_container = Output(change_fc._spec().output_pin(0), 0, op) |
| 208 | + self._outputs.append(self._fields_container) |
| 209 | + |
| 210 | + @property |
| 211 | + def fields_container(self): |
| 212 | + """Allows to get fields_container output of the operator |
| 213 | +
|
| 214 | + Returns |
| 215 | + ---------- |
| 216 | + my_fields_container : FieldsContainer |
| 217 | +
|
| 218 | + Examples |
| 219 | + -------- |
| 220 | + >>> from ansys.dpf import core as dpf |
| 221 | + >>> op = dpf.operators.scoping.change_fc() |
| 222 | + >>> # Connect inputs : op.inputs. ... |
| 223 | + >>> result_fields_container = op.outputs.fields_container() |
| 224 | + """ # noqa: E501 |
| 225 | + return self._fields_container |
0 commit comments