|
| 1 | +""" |
| 2 | +prepare_mapping_workflow |
| 3 | +======================== |
| 4 | +Autogenerated DPF operator classes. |
| 5 | +""" |
| 6 | +from warnings import warn |
| 7 | +from ansys.dpf.core.dpf_operator import Operator |
| 8 | +from ansys.dpf.core.inputs import Input, _Inputs |
| 9 | +from ansys.dpf.core.outputs import Output, _Outputs |
| 10 | +from ansys.dpf.core.operators.specification import PinSpecification, Specification |
| 11 | + |
| 12 | + |
| 13 | +class prepare_mapping_workflow(Operator): |
| 14 | + """Generate a workflow that can map results from a support to another |
| 15 | + one. |
| 16 | +
|
| 17 | + Parameters |
| 18 | + ---------- |
| 19 | + input_support : Field or MeshedRegion |
| 20 | + output_support : Field or MeshedRegion |
| 21 | + filter_radius : float |
| 22 | + Radius size for the rbf filter |
| 23 | + influence_box : float, optional |
| 24 | +
|
| 25 | +
|
| 26 | + Examples |
| 27 | + -------- |
| 28 | + >>> from ansys.dpf import core as dpf |
| 29 | +
|
| 30 | + >>> # Instantiate operator |
| 31 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 32 | +
|
| 33 | + >>> # Make input connections |
| 34 | + >>> my_input_support = dpf.Field() |
| 35 | + >>> op.inputs.input_support.connect(my_input_support) |
| 36 | + >>> my_output_support = dpf.Field() |
| 37 | + >>> op.inputs.output_support.connect(my_output_support) |
| 38 | + >>> my_filter_radius = float() |
| 39 | + >>> op.inputs.filter_radius.connect(my_filter_radius) |
| 40 | + >>> my_influence_box = float() |
| 41 | + >>> op.inputs.influence_box.connect(my_influence_box) |
| 42 | +
|
| 43 | + >>> # Instantiate operator and connect inputs in one line |
| 44 | + >>> op = dpf.operators.geo.prepare_mapping_workflow( |
| 45 | + ... input_support=my_input_support, |
| 46 | + ... output_support=my_output_support, |
| 47 | + ... filter_radius=my_filter_radius, |
| 48 | + ... influence_box=my_influence_box, |
| 49 | + ... ) |
| 50 | +
|
| 51 | + >>> # Get output data |
| 52 | + >>> result_mapping_workflow = op.outputs.mapping_workflow() |
| 53 | + """ |
| 54 | + |
| 55 | + def __init__( |
| 56 | + self, |
| 57 | + input_support=None, |
| 58 | + output_support=None, |
| 59 | + filter_radius=None, |
| 60 | + influence_box=None, |
| 61 | + config=None, |
| 62 | + server=None, |
| 63 | + ): |
| 64 | + super().__init__(name="prepare_mapping_workflow", config=config, server=server) |
| 65 | + self._inputs = InputsPrepareMappingWorkflow(self) |
| 66 | + self._outputs = OutputsPrepareMappingWorkflow(self) |
| 67 | + if input_support is not None: |
| 68 | + self.inputs.input_support.connect(input_support) |
| 69 | + if output_support is not None: |
| 70 | + self.inputs.output_support.connect(output_support) |
| 71 | + if filter_radius is not None: |
| 72 | + self.inputs.filter_radius.connect(filter_radius) |
| 73 | + if influence_box is not None: |
| 74 | + self.inputs.influence_box.connect(influence_box) |
| 75 | + |
| 76 | + @staticmethod |
| 77 | + def _spec(): |
| 78 | + description = """Generate a workflow that can map results from a support to another |
| 79 | + one.""" |
| 80 | + spec = Specification( |
| 81 | + description=description, |
| 82 | + map_input_pin_spec={ |
| 83 | + 0: PinSpecification( |
| 84 | + name="input_support", |
| 85 | + type_names=["field", "abstract_meshed_region"], |
| 86 | + optional=False, |
| 87 | + document="""""", |
| 88 | + ), |
| 89 | + 1: PinSpecification( |
| 90 | + name="output_support", |
| 91 | + type_names=["field", "abstract_meshed_region"], |
| 92 | + optional=False, |
| 93 | + document="""""", |
| 94 | + ), |
| 95 | + 2: PinSpecification( |
| 96 | + name="filter_radius", |
| 97 | + type_names=["double"], |
| 98 | + optional=False, |
| 99 | + document="""Radius size for the rbf filter""", |
| 100 | + ), |
| 101 | + 3: PinSpecification( |
| 102 | + name="influence_box", |
| 103 | + type_names=["double"], |
| 104 | + optional=True, |
| 105 | + document="""""", |
| 106 | + ), |
| 107 | + }, |
| 108 | + map_output_pin_spec={ |
| 109 | + 0: PinSpecification( |
| 110 | + name="mapping_workflow", |
| 111 | + type_names=["workflow"], |
| 112 | + optional=False, |
| 113 | + document="""""", |
| 114 | + ), |
| 115 | + }, |
| 116 | + ) |
| 117 | + return spec |
| 118 | + |
| 119 | + @staticmethod |
| 120 | + def default_config(server=None): |
| 121 | + """Returns the default config of the operator. |
| 122 | +
|
| 123 | + This config can then be changed to the user needs and be used to |
| 124 | + instantiate the operator. The Configuration allows to customize |
| 125 | + how the operation will be processed by the operator. |
| 126 | +
|
| 127 | + Parameters |
| 128 | + ---------- |
| 129 | + server : server.DPFServer, optional |
| 130 | + Server with channel connected to the remote or local instance. When |
| 131 | + ``None``, attempts to use the global server. |
| 132 | + """ |
| 133 | + return Operator.default_config(name="prepare_mapping_workflow", server=server) |
| 134 | + |
| 135 | + @property |
| 136 | + def inputs(self): |
| 137 | + """Enables to connect inputs to the operator |
| 138 | +
|
| 139 | + Returns |
| 140 | + -------- |
| 141 | + inputs : InputsPrepareMappingWorkflow |
| 142 | + """ |
| 143 | + return super().inputs |
| 144 | + |
| 145 | + @property |
| 146 | + def outputs(self): |
| 147 | + """Enables to get outputs of the operator by evaluationg it |
| 148 | +
|
| 149 | + Returns |
| 150 | + -------- |
| 151 | + outputs : OutputsPrepareMappingWorkflow |
| 152 | + """ |
| 153 | + return super().outputs |
| 154 | + |
| 155 | + |
| 156 | +class InputsPrepareMappingWorkflow(_Inputs): |
| 157 | + """Intermediate class used to connect user inputs to |
| 158 | + prepare_mapping_workflow operator. |
| 159 | +
|
| 160 | + Examples |
| 161 | + -------- |
| 162 | + >>> from ansys.dpf import core as dpf |
| 163 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 164 | + >>> my_input_support = dpf.Field() |
| 165 | + >>> op.inputs.input_support.connect(my_input_support) |
| 166 | + >>> my_output_support = dpf.Field() |
| 167 | + >>> op.inputs.output_support.connect(my_output_support) |
| 168 | + >>> my_filter_radius = float() |
| 169 | + >>> op.inputs.filter_radius.connect(my_filter_radius) |
| 170 | + >>> my_influence_box = float() |
| 171 | + >>> op.inputs.influence_box.connect(my_influence_box) |
| 172 | + """ |
| 173 | + |
| 174 | + def __init__(self, op: Operator): |
| 175 | + super().__init__(prepare_mapping_workflow._spec().inputs, op) |
| 176 | + self._input_support = Input( |
| 177 | + prepare_mapping_workflow._spec().input_pin(0), 0, op, -1 |
| 178 | + ) |
| 179 | + self._inputs.append(self._input_support) |
| 180 | + self._output_support = Input( |
| 181 | + prepare_mapping_workflow._spec().input_pin(1), 1, op, -1 |
| 182 | + ) |
| 183 | + self._inputs.append(self._output_support) |
| 184 | + self._filter_radius = Input( |
| 185 | + prepare_mapping_workflow._spec().input_pin(2), 2, op, -1 |
| 186 | + ) |
| 187 | + self._inputs.append(self._filter_radius) |
| 188 | + self._influence_box = Input( |
| 189 | + prepare_mapping_workflow._spec().input_pin(3), 3, op, -1 |
| 190 | + ) |
| 191 | + self._inputs.append(self._influence_box) |
| 192 | + |
| 193 | + @property |
| 194 | + def input_support(self): |
| 195 | + """Allows to connect input_support input to the operator. |
| 196 | +
|
| 197 | + Parameters |
| 198 | + ---------- |
| 199 | + my_input_support : Field or MeshedRegion |
| 200 | +
|
| 201 | + Examples |
| 202 | + -------- |
| 203 | + >>> from ansys.dpf import core as dpf |
| 204 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 205 | + >>> op.inputs.input_support.connect(my_input_support) |
| 206 | + >>> # or |
| 207 | + >>> op.inputs.input_support(my_input_support) |
| 208 | + """ |
| 209 | + return self._input_support |
| 210 | + |
| 211 | + @property |
| 212 | + def output_support(self): |
| 213 | + """Allows to connect output_support input to the operator. |
| 214 | +
|
| 215 | + Parameters |
| 216 | + ---------- |
| 217 | + my_output_support : Field or MeshedRegion |
| 218 | +
|
| 219 | + Examples |
| 220 | + -------- |
| 221 | + >>> from ansys.dpf import core as dpf |
| 222 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 223 | + >>> op.inputs.output_support.connect(my_output_support) |
| 224 | + >>> # or |
| 225 | + >>> op.inputs.output_support(my_output_support) |
| 226 | + """ |
| 227 | + return self._output_support |
| 228 | + |
| 229 | + @property |
| 230 | + def filter_radius(self): |
| 231 | + """Allows to connect filter_radius input to the operator. |
| 232 | +
|
| 233 | + Radius size for the rbf filter |
| 234 | +
|
| 235 | + Parameters |
| 236 | + ---------- |
| 237 | + my_filter_radius : float |
| 238 | +
|
| 239 | + Examples |
| 240 | + -------- |
| 241 | + >>> from ansys.dpf import core as dpf |
| 242 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 243 | + >>> op.inputs.filter_radius.connect(my_filter_radius) |
| 244 | + >>> # or |
| 245 | + >>> op.inputs.filter_radius(my_filter_radius) |
| 246 | + """ |
| 247 | + return self._filter_radius |
| 248 | + |
| 249 | + @property |
| 250 | + def influence_box(self): |
| 251 | + """Allows to connect influence_box input to the operator. |
| 252 | +
|
| 253 | + Parameters |
| 254 | + ---------- |
| 255 | + my_influence_box : float |
| 256 | +
|
| 257 | + Examples |
| 258 | + -------- |
| 259 | + >>> from ansys.dpf import core as dpf |
| 260 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 261 | + >>> op.inputs.influence_box.connect(my_influence_box) |
| 262 | + >>> # or |
| 263 | + >>> op.inputs.influence_box(my_influence_box) |
| 264 | + """ |
| 265 | + return self._influence_box |
| 266 | + |
| 267 | + |
| 268 | +class OutputsPrepareMappingWorkflow(_Outputs): |
| 269 | + """Intermediate class used to get outputs from |
| 270 | + prepare_mapping_workflow operator. |
| 271 | +
|
| 272 | + Examples |
| 273 | + -------- |
| 274 | + >>> from ansys.dpf import core as dpf |
| 275 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 276 | + >>> # Connect inputs : op.inputs. ... |
| 277 | + >>> result_mapping_workflow = op.outputs.mapping_workflow() |
| 278 | + """ |
| 279 | + |
| 280 | + def __init__(self, op: Operator): |
| 281 | + super().__init__(prepare_mapping_workflow._spec().outputs, op) |
| 282 | + self._mapping_workflow = Output( |
| 283 | + prepare_mapping_workflow._spec().output_pin(0), 0, op |
| 284 | + ) |
| 285 | + self._outputs.append(self._mapping_workflow) |
| 286 | + |
| 287 | + @property |
| 288 | + def mapping_workflow(self): |
| 289 | + """Allows to get mapping_workflow output of the operator |
| 290 | +
|
| 291 | + Returns |
| 292 | + ---------- |
| 293 | + my_mapping_workflow : Workflow |
| 294 | +
|
| 295 | + Examples |
| 296 | + -------- |
| 297 | + >>> from ansys.dpf import core as dpf |
| 298 | + >>> op = dpf.operators.geo.prepare_mapping_workflow() |
| 299 | + >>> # Connect inputs : op.inputs. ... |
| 300 | + >>> result_mapping_workflow = op.outputs.mapping_workflow() |
| 301 | + """ # noqa: E501 |
| 302 | + return self._mapping_workflow |
0 commit comments