|
1 | 1 | """ |
2 | 2 | to_elemental_nodal_fc |
3 | 3 | ===================== |
4 | | -Autogenerated DPF operator classes. |
5 | 4 | """ |
6 | | - |
7 | | -from warnings import warn |
8 | 5 | from ansys.dpf.core.dpf_operator import Operator |
9 | 6 | from ansys.dpf.core.inputs import Input, _Inputs |
10 | | -from ansys.dpf.core.outputs import Output, _Outputs |
| 7 | +from ansys.dpf.core.outputs import Output, _Outputs, _modify_output_spec_with_one_type |
11 | 8 | from ansys.dpf.core.operators.specification import PinSpecification, Specification |
12 | 9 |
|
| 10 | +"""Operators from "averaging" category |
| 11 | +""" |
13 | 12 |
|
14 | 13 | class to_elemental_nodal_fc(Operator): |
15 | | - """Transforms fields into Elemental Nodal fields using an averaging |
16 | | - process. The result is computed on a given element's scoping. |
17 | | -
|
18 | | - Parameters |
19 | | - ---------- |
20 | | - fields_container : FieldsContainer |
21 | | - mesh_scoping : Scoping, optional |
22 | | - mesh : MeshedRegion, optional |
23 | | -
|
24 | | -
|
25 | | - Examples |
26 | | - -------- |
27 | | - >>> from ansys.dpf import core as dpf |
28 | | -
|
29 | | - >>> # Instantiate operator |
30 | | - >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
31 | | -
|
32 | | - >>> # Make input connections |
33 | | - >>> my_fields_container = dpf.FieldsContainer() |
34 | | - >>> op.inputs.fields_container.connect(my_fields_container) |
35 | | - >>> my_mesh_scoping = dpf.Scoping() |
36 | | - >>> op.inputs.mesh_scoping.connect(my_mesh_scoping) |
37 | | - >>> my_mesh = dpf.MeshedRegion() |
38 | | - >>> op.inputs.mesh.connect(my_mesh) |
39 | | -
|
40 | | - >>> # Instantiate operator and connect inputs in one line |
41 | | - >>> op = dpf.operators.averaging.to_elemental_nodal_fc( |
42 | | - ... fields_container=my_fields_container, |
43 | | - ... mesh_scoping=my_mesh_scoping, |
44 | | - ... mesh=my_mesh, |
45 | | - ... ) |
46 | | -
|
47 | | - >>> # Get output data |
48 | | - >>> result_fields_container = op.outputs.fields_container() |
49 | | - """ |
50 | | - |
51 | | - def __init__( |
52 | | - self, |
53 | | - fields_container=None, |
54 | | - mesh_scoping=None, |
55 | | - mesh=None, |
56 | | - config=None, |
57 | | - server=None, |
58 | | - ): |
59 | | - super().__init__(name="to_elemental_nodal_fc", config=config, server=server) |
| 14 | + """Transforms fields into Elemental Nodal fields using an averaging process. The result is computed on a given element's scoping. |
| 15 | +
|
| 16 | + available inputs: |
| 17 | + - fields_container (FieldsContainer) |
| 18 | + - mesh_scoping (Scoping) (optional) |
| 19 | + - mesh (MeshedRegion) (optional) |
| 20 | +
|
| 21 | + available outputs: |
| 22 | + - fields_container (FieldsContainer) |
| 23 | +
|
| 24 | + Examples |
| 25 | + -------- |
| 26 | + >>> from ansys.dpf import core as dpf |
| 27 | +
|
| 28 | + >>> # Instantiate operator |
| 29 | + >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
| 30 | +
|
| 31 | + >>> # Make input connections |
| 32 | + >>> my_fields_container = dpf.FieldsContainer() |
| 33 | + >>> op.inputs.fields_container.connect(my_fields_container) |
| 34 | + >>> my_mesh_scoping = dpf.Scoping() |
| 35 | + >>> op.inputs.mesh_scoping.connect(my_mesh_scoping) |
| 36 | + >>> my_mesh = dpf.MeshedRegion() |
| 37 | + >>> op.inputs.mesh.connect(my_mesh) |
| 38 | +
|
| 39 | + >>> # Instantiate operator and connect inputs in one line |
| 40 | + >>> op = dpf.operators.averaging.to_elemental_nodal_fc(fields_container=my_fields_container,mesh_scoping=my_mesh_scoping,mesh=my_mesh) |
| 41 | +
|
| 42 | + >>> # Get output data |
| 43 | + >>> result_fields_container = op.outputs.fields_container()""" |
| 44 | + def __init__(self, fields_container=None, mesh_scoping=None, mesh=None, config=None, server=None): |
| 45 | + super().__init__(name="to_elemental_nodal_fc", config = config, server = server) |
60 | 46 | self._inputs = InputsToElementalNodalFc(self) |
61 | 47 | self._outputs = OutputsToElementalNodalFc(self) |
62 | | - if fields_container is not None: |
| 48 | + if fields_container !=None: |
63 | 49 | self.inputs.fields_container.connect(fields_container) |
64 | | - if mesh_scoping is not None: |
| 50 | + if mesh_scoping !=None: |
65 | 51 | self.inputs.mesh_scoping.connect(mesh_scoping) |
66 | | - if mesh is not None: |
| 52 | + if mesh !=None: |
67 | 53 | self.inputs.mesh.connect(mesh) |
68 | 54 |
|
69 | 55 | @staticmethod |
70 | 56 | def _spec(): |
71 | | - description = """Transforms fields into Elemental Nodal fields using an averaging |
72 | | - process. The result is computed on a given element's |
73 | | - scoping.""" |
74 | | - spec = Specification( |
75 | | - description=description, |
76 | | - map_input_pin_spec={ |
77 | | - 0: PinSpecification( |
78 | | - name="fields_container", |
79 | | - type_names=["fields_container"], |
80 | | - optional=False, |
81 | | - document="""""", |
82 | | - ), |
83 | | - 1: PinSpecification( |
84 | | - name="mesh_scoping", |
85 | | - type_names=["scoping"], |
86 | | - optional=True, |
87 | | - document="""""", |
88 | | - ), |
89 | | - 7: PinSpecification( |
90 | | - name="mesh", |
91 | | - type_names=["abstract_meshed_region"], |
92 | | - optional=True, |
93 | | - document="""""", |
94 | | - ), |
95 | | - }, |
96 | | - map_output_pin_spec={ |
97 | | - 0: PinSpecification( |
98 | | - name="fields_container", |
99 | | - type_names=["fields_container"], |
100 | | - optional=False, |
101 | | - document="""""", |
102 | | - ), |
103 | | - }, |
104 | | - ) |
| 57 | + spec = Specification(description="""Transforms fields into Elemental Nodal fields using an averaging process. The result is computed on a given element's scoping.""", |
| 58 | + map_input_pin_spec={ |
| 59 | + 0 : PinSpecification(name = "fields_container", type_names=["fields_container"], optional=False, document=""""""), |
| 60 | + 1 : PinSpecification(name = "mesh_scoping", type_names=["scoping"], optional=True, document=""""""), |
| 61 | + 7 : PinSpecification(name = "mesh", type_names=["abstract_meshed_region"], optional=True, document="""""")}, |
| 62 | + map_output_pin_spec={ |
| 63 | + 0 : PinSpecification(name = "fields_container", type_names=["fields_container"], optional=False, document="""""")}) |
105 | 64 | return spec |
106 | 65 |
|
107 | | - @staticmethod |
108 | | - def default_config(server=None): |
109 | | - """Returns the default config of the operator. |
110 | | -
|
111 | | - This config can then be changed to the user needs and be used to |
112 | | - instantiate the operator. The Configuration allows to customize |
113 | | - how the operation will be processed by the operator. |
114 | 66 |
|
115 | | - Parameters |
116 | | - ---------- |
117 | | - server : server.DPFServer, optional |
118 | | - Server with channel connected to the remote or local instance. When |
119 | | - ``None``, attempts to use the global server. |
120 | | - """ |
121 | | - return Operator.default_config(name="to_elemental_nodal_fc", server=server) |
| 67 | + @staticmethod |
| 68 | + def default_config(): |
| 69 | + return Operator.default_config(name = "to_elemental_nodal_fc") |
122 | 70 |
|
123 | 71 | @property |
124 | 72 | def inputs(self): |
125 | | - """Enables to connect inputs to the operator |
| 73 | + """Enables to connect inputs to the operator. |
126 | 74 |
|
127 | 75 | Returns |
128 | 76 | -------- |
129 | | - inputs : InputsToElementalNodalFc |
| 77 | + inputs : InputsToElementalNodalFc |
130 | 78 | """ |
131 | 79 | return super().inputs |
132 | 80 |
|
| 81 | + |
133 | 82 | @property |
134 | 83 | def outputs(self): |
135 | | - """Enables to get outputs of the operator by evaluating it |
| 84 | + """Enables to get outputs of the operator by evaluating it. |
136 | 85 |
|
137 | 86 | Returns |
138 | 87 | -------- |
139 | | - outputs : OutputsToElementalNodalFc |
| 88 | + outputs : OutputsToElementalNodalFc |
140 | 89 | """ |
141 | 90 | return super().outputs |
142 | 91 |
|
143 | 92 |
|
| 93 | +#internal name: to_elemental_nodal_fc |
| 94 | +#scripting name: to_elemental_nodal_fc |
144 | 95 | class InputsToElementalNodalFc(_Inputs): |
145 | | - """Intermediate class used to connect user inputs to |
146 | | - to_elemental_nodal_fc operator. |
147 | | -
|
148 | | - Examples |
149 | | - -------- |
150 | | - >>> from ansys.dpf import core as dpf |
151 | | - >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
152 | | - >>> my_fields_container = dpf.FieldsContainer() |
153 | | - >>> op.inputs.fields_container.connect(my_fields_container) |
154 | | - >>> my_mesh_scoping = dpf.Scoping() |
155 | | - >>> op.inputs.mesh_scoping.connect(my_mesh_scoping) |
156 | | - >>> my_mesh = dpf.MeshedRegion() |
157 | | - >>> op.inputs.mesh.connect(my_mesh) |
| 96 | + """Intermediate class used to connect user inputs to to_elemental_nodal_fc operator |
| 97 | +
|
| 98 | + Examples |
| 99 | + -------- |
| 100 | + >>> from ansys.dpf import core as dpf |
| 101 | +
|
| 102 | + >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
| 103 | + >>> my_fields_container = dpf.FieldsContainer() |
| 104 | + >>> op.inputs.fields_container.connect(my_fields_container) |
| 105 | + >>> my_mesh_scoping = dpf.Scoping() |
| 106 | + >>> op.inputs.mesh_scoping.connect(my_mesh_scoping) |
| 107 | + >>> my_mesh = dpf.MeshedRegion() |
| 108 | + >>> op.inputs.mesh.connect(my_mesh) |
158 | 109 | """ |
159 | | - |
160 | 110 | def __init__(self, op: Operator): |
161 | 111 | super().__init__(to_elemental_nodal_fc._spec().inputs, op) |
162 | | - self._fields_container = Input( |
163 | | - to_elemental_nodal_fc._spec().input_pin(0), 0, op, -1 |
164 | | - ) |
| 112 | + self._fields_container = Input(to_elemental_nodal_fc._spec().input_pin(0), 0, op, -1) |
165 | 113 | self._inputs.append(self._fields_container) |
166 | | - self._mesh_scoping = Input( |
167 | | - to_elemental_nodal_fc._spec().input_pin(1), 1, op, -1 |
168 | | - ) |
| 114 | + self._mesh_scoping = Input(to_elemental_nodal_fc._spec().input_pin(1), 1, op, -1) |
169 | 115 | self._inputs.append(self._mesh_scoping) |
170 | | - self._mesh = Input(to_elemental_nodal_fc._spec().input_pin(7), 7, op, -1) |
| 116 | + self._mesh = Input(to_elemental_nodal_fc._spec().input_pin(7), 7, op, -1) |
171 | 117 | self._inputs.append(self._mesh) |
172 | 118 |
|
173 | 119 | @property |
174 | 120 | def fields_container(self): |
175 | | - """Allows to connect fields_container input to the operator. |
| 121 | + """Allows to connect fields_container input to the operator |
176 | 122 |
|
177 | 123 | Parameters |
178 | 124 | ---------- |
179 | | - my_fields_container : FieldsContainer |
| 125 | + my_fields_container : FieldsContainer, |
180 | 126 |
|
181 | 127 | Examples |
182 | 128 | -------- |
183 | 129 | >>> from ansys.dpf import core as dpf |
| 130 | +
|
184 | 131 | >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
185 | 132 | >>> op.inputs.fields_container.connect(my_fields_container) |
186 | | - >>> # or |
| 133 | + >>> #or |
187 | 134 | >>> op.inputs.fields_container(my_fields_container) |
| 135 | +
|
188 | 136 | """ |
189 | 137 | return self._fields_container |
190 | 138 |
|
191 | 139 | @property |
192 | 140 | def mesh_scoping(self): |
193 | | - """Allows to connect mesh_scoping input to the operator. |
| 141 | + """Allows to connect mesh_scoping input to the operator |
194 | 142 |
|
195 | 143 | Parameters |
196 | 144 | ---------- |
197 | | - my_mesh_scoping : Scoping |
| 145 | + my_mesh_scoping : Scoping, |
198 | 146 |
|
199 | 147 | Examples |
200 | 148 | -------- |
201 | 149 | >>> from ansys.dpf import core as dpf |
| 150 | +
|
202 | 151 | >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
203 | 152 | >>> op.inputs.mesh_scoping.connect(my_mesh_scoping) |
204 | | - >>> # or |
| 153 | + >>> #or |
205 | 154 | >>> op.inputs.mesh_scoping(my_mesh_scoping) |
| 155 | +
|
206 | 156 | """ |
207 | 157 | return self._mesh_scoping |
208 | 158 |
|
209 | 159 | @property |
210 | 160 | def mesh(self): |
211 | | - """Allows to connect mesh input to the operator. |
| 161 | + """Allows to connect mesh input to the operator |
212 | 162 |
|
213 | 163 | Parameters |
214 | 164 | ---------- |
215 | | - my_mesh : MeshedRegion |
| 165 | + my_mesh : MeshedRegion, |
216 | 166 |
|
217 | 167 | Examples |
218 | 168 | -------- |
219 | 169 | >>> from ansys.dpf import core as dpf |
| 170 | +
|
220 | 171 | >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
221 | 172 | >>> op.inputs.mesh.connect(my_mesh) |
222 | | - >>> # or |
| 173 | + >>> #or |
223 | 174 | >>> op.inputs.mesh(my_mesh) |
| 175 | +
|
224 | 176 | """ |
225 | 177 | return self._mesh |
226 | 178 |
|
227 | | - |
228 | 179 | class OutputsToElementalNodalFc(_Outputs): |
229 | | - """Intermediate class used to get outputs from |
230 | | - to_elemental_nodal_fc operator. |
231 | | -
|
232 | | - Examples |
233 | | - -------- |
234 | | - >>> from ansys.dpf import core as dpf |
235 | | - >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
236 | | - >>> # Connect inputs : op.inputs. ... |
237 | | - >>> result_fields_container = op.outputs.fields_container() |
| 180 | + """Intermediate class used to get outputs from to_elemental_nodal_fc operator |
| 181 | + Examples |
| 182 | + -------- |
| 183 | + >>> from ansys.dpf import core as dpf |
| 184 | +
|
| 185 | + >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
| 186 | + >>> # Connect inputs : op.inputs. ... |
| 187 | + >>> result_fields_container = op.outputs.fields_container() |
238 | 188 | """ |
239 | | - |
240 | 189 | def __init__(self, op: Operator): |
241 | 190 | super().__init__(to_elemental_nodal_fc._spec().outputs, op) |
242 | | - self._fields_container = Output( |
243 | | - to_elemental_nodal_fc._spec().output_pin(0), 0, op |
244 | | - ) |
| 191 | + self._fields_container = Output(to_elemental_nodal_fc._spec().output_pin(0), 0, op) |
245 | 192 | self._outputs.append(self._fields_container) |
246 | 193 |
|
247 | 194 | @property |
248 | 195 | def fields_container(self): |
249 | 196 | """Allows to get fields_container output of the operator |
250 | 197 |
|
| 198 | +
|
251 | 199 | Returns |
252 | 200 | ---------- |
253 | | - my_fields_container : FieldsContainer |
| 201 | + my_fields_container : FieldsContainer, |
254 | 202 |
|
255 | 203 | Examples |
256 | 204 | -------- |
257 | 205 | >>> from ansys.dpf import core as dpf |
| 206 | +
|
258 | 207 | >>> op = dpf.operators.averaging.to_elemental_nodal_fc() |
259 | 208 | >>> # Connect inputs : op.inputs. ... |
260 | | - >>> result_fields_container = op.outputs.fields_container() |
261 | | - """ # noqa: E501 |
| 209 | + >>> result_fields_container = op.outputs.fields_container() |
| 210 | + """ |
262 | 211 | return self._fields_container |
| 212 | + |
0 commit comments