@@ -25,6 +25,9 @@ class elemental_nodal_to_nodal(Operator):
2525 Each nodal value is divided by the number of
2626 elements linked to this node (default
2727 is true for discrete quantities)
28+ extend_to_mid_nodes : bool, optional
29+ Compute mid nodes (when available) by
30+ averaging neighbour primary nodes
2831 mesh : MeshedRegion, optional
2932
3033
@@ -42,6 +45,8 @@ class elemental_nodal_to_nodal(Operator):
4245 >>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
4346 >>> my_should_average = bool()
4447 >>> op.inputs.should_average.connect(my_should_average)
48+ >>> my_extend_to_mid_nodes = bool()
49+ >>> op.inputs.extend_to_mid_nodes.connect(my_extend_to_mid_nodes)
4550 >>> my_mesh = dpf.MeshedRegion()
4651 >>> op.inputs.mesh.connect(my_mesh)
4752
@@ -50,18 +55,21 @@ class elemental_nodal_to_nodal(Operator):
5055 ... field=my_field,
5156 ... mesh_scoping=my_mesh_scoping,
5257 ... should_average=my_should_average,
58+ ... extend_to_mid_nodes=my_extend_to_mid_nodes,
5359 ... mesh=my_mesh,
5460 ... )
5561
5662 >>> # Get output data
5763 >>> result_field = op.outputs.field()
64+ >>> result_weight = op.outputs.weight()
5865 """
5966
6067 def __init__ (
6168 self ,
6269 field = None ,
6370 mesh_scoping = None ,
6471 should_average = None ,
72+ extend_to_mid_nodes = None ,
6573 mesh = None ,
6674 config = None ,
6775 server = None ,
@@ -75,6 +83,8 @@ def __init__(
7583 self .inputs .mesh_scoping .connect (mesh_scoping )
7684 if should_average is not None :
7785 self .inputs .should_average .connect (should_average )
86+ if extend_to_mid_nodes is not None :
87+ self .inputs .extend_to_mid_nodes .connect (extend_to_mid_nodes )
7888 if mesh is not None :
7989 self .inputs .mesh .connect (mesh )
8090
@@ -105,6 +115,13 @@ def _spec():
105115 document = """Each nodal value is divided by the number of
106116 elements linked to this node (default
107117 is true for discrete quantities)""" ,
118+ ),
119+ 4 : PinSpecification (
120+ name = "extend_to_mid_nodes" ,
121+ type_names = ["bool" ],
122+ optional = True ,
123+ document = """Compute mid nodes (when available) by
124+ averaging neighbour primary nodes""" ,
108125 ),
109126 7 : PinSpecification (
110127 name = "mesh" ,
@@ -120,6 +137,14 @@ def _spec():
120137 optional = False ,
121138 document = """""" ,
122139 ),
140+ 1 : PinSpecification (
141+ name = "weight" ,
142+ type_names = ["property_field" ],
143+ optional = False ,
144+ document = """Gives for each node, the number of times it
145+ was found in the elemental nodal
146+ field. can be used to average later.""" ,
147+ ),
123148 },
124149 )
125150 return spec
@@ -175,6 +200,8 @@ class InputsElementalNodalToNodal(_Inputs):
175200 >>> op.inputs.mesh_scoping.connect(my_mesh_scoping)
176201 >>> my_should_average = bool()
177202 >>> op.inputs.should_average.connect(my_should_average)
203+ >>> my_extend_to_mid_nodes = bool()
204+ >>> op.inputs.extend_to_mid_nodes.connect(my_extend_to_mid_nodes)
178205 >>> my_mesh = dpf.MeshedRegion()
179206 >>> op.inputs.mesh.connect(my_mesh)
180207 """
@@ -191,6 +218,10 @@ def __init__(self, op: Operator):
191218 elemental_nodal_to_nodal ._spec ().input_pin (2 ), 2 , op , - 1
192219 )
193220 self ._inputs .append (self ._should_average )
221+ self ._extend_to_mid_nodes = Input (
222+ elemental_nodal_to_nodal ._spec ().input_pin (4 ), 4 , op , - 1
223+ )
224+ self ._inputs .append (self ._extend_to_mid_nodes )
194225 self ._mesh = Input (elemental_nodal_to_nodal ._spec ().input_pin (7 ), 7 , op , - 1 )
195226 self ._inputs .append (self ._mesh )
196227
@@ -257,6 +288,27 @@ def should_average(self):
257288 """
258289 return self ._should_average
259290
291+ @property
292+ def extend_to_mid_nodes (self ):
293+ """Allows to connect extend_to_mid_nodes input to the operator.
294+
295+ Compute mid nodes (when available) by
296+ averaging neighbour primary nodes
297+
298+ Parameters
299+ ----------
300+ my_extend_to_mid_nodes : bool
301+
302+ Examples
303+ --------
304+ >>> from ansys.dpf import core as dpf
305+ >>> op = dpf.operators.averaging.elemental_nodal_to_nodal()
306+ >>> op.inputs.extend_to_mid_nodes.connect(my_extend_to_mid_nodes)
307+ >>> # or
308+ >>> op.inputs.extend_to_mid_nodes(my_extend_to_mid_nodes)
309+ """
310+ return self ._extend_to_mid_nodes
311+
260312 @property
261313 def mesh (self ):
262314 """Allows to connect mesh input to the operator.
@@ -286,12 +338,15 @@ class OutputsElementalNodalToNodal(_Outputs):
286338 >>> op = dpf.operators.averaging.elemental_nodal_to_nodal()
287339 >>> # Connect inputs : op.inputs. ...
288340 >>> result_field = op.outputs.field()
341+ >>> result_weight = op.outputs.weight()
289342 """
290343
291344 def __init__ (self , op : Operator ):
292345 super ().__init__ (elemental_nodal_to_nodal ._spec ().outputs , op )
293346 self ._field = Output (elemental_nodal_to_nodal ._spec ().output_pin (0 ), 0 , op )
294347 self ._outputs .append (self ._field )
348+ self ._weight = Output (elemental_nodal_to_nodal ._spec ().output_pin (1 ), 1 , op )
349+ self ._outputs .append (self ._weight )
295350
296351 @property
297352 def field (self ):
@@ -309,3 +364,20 @@ def field(self):
309364 >>> result_field = op.outputs.field()
310365 """ # noqa: E501
311366 return self ._field
367+
368+ @property
369+ def weight (self ):
370+ """Allows to get weight output of the operator
371+
372+ Returns
373+ ----------
374+ my_weight : PropertyField
375+
376+ Examples
377+ --------
378+ >>> from ansys.dpf import core as dpf
379+ >>> op = dpf.operators.averaging.elemental_nodal_to_nodal()
380+ >>> # Connect inputs : op.inputs. ...
381+ >>> result_weight = op.outputs.weight()
382+ """ # noqa: E501
383+ return self ._weight
0 commit comments