Skip to content

Commit 4e476d6

Browse files
authored
Refactoring Boundary Class (#4536)
Co-authored-by: maxcapodi78 <Shark78>
1 parent 7bb9087 commit 4e476d6

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

_unittest/test_98_Icepak.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,8 +1148,8 @@ def test_61_assign_network(self, add_app):
11481148
net.add_face_node(ids[0])
11491149
net.add_face_node(ids[1], thermal_resistance="Specified", resistance=2)
11501150
net.add_face_node(ids[2], thermal_resistance="Specified", resistance="2cel_per_w")
1151-
net.add_face_node(ids[3], thermal_resistance="Compute", thickness=2, material="Al-Extruded")
1152-
net.add_face_node(ids[4], thermal_resistance="Compute", thickness="2mm", material="Al-Extruded")
1151+
net.add_face_node(ids[3], thermal_resistance="Compute", material="Al-Extruded", thickness=2)
1152+
net.add_face_node(ids[4], thermal_resistance="Compute", material="Al-Extruded", thickness="2mm")
11531153
net.add_face_node(ids[5], name="TestFace", thermal_resistance="Specified", resistance="20cel_per_w")
11541154
net.add_internal_node(name="TestInternal", power=2, mass=None, specific_heat=None)
11551155
net.add_internal_node(name="TestInternal2", power="4mW")

pyaedt/modules/Boundary.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3615,7 +3615,7 @@ def _clean_list(self, arg):
36153615
new_list.append(item)
36163616
return new_list
36173617

3618-
@pyaedt_function_handler
3618+
@pyaedt_function_handler()
36193619
def create(self):
36203620
"""
36213621
Create network in AEDT.
@@ -3645,7 +3645,7 @@ def create(self):
36453645
self._app.oboundary.AssignNetworkBoundary(clean_args)
36463646
return True
36473647

3648-
@pyaedt_function_handler
3648+
@pyaedt_function_handler()
36493649
def _update_from_props(self):
36503650
nodes = self.props.get("Nodes", None)
36513651
if nodes is not None:
@@ -4010,16 +4010,16 @@ def _add_to_props(self, new_node, type_dict="Nodes"):
40104010
except KeyError:
40114011
self.props[type_dict] = {new_node.name: new_node.props}
40124012

4013-
@pyaedt_function_handler()
4013+
@pyaedt_function_handler(face_id="assignment")
40144014
def add_face_node(
4015-
self, face_id, name=None, thermal_resistance="NoResistance", material=None, thickness=None, resistance=None
4015+
self, assignment, name=None, thermal_resistance="NoResistance", material=None, thickness=None, resistance=None
40164016
):
40174017
"""
40184018
Create a face node in the network.
40194019
40204020
Parameters
40214021
----------
4022-
face_id : int
4022+
assignment : int
40234023
Face ID.
40244024
name : str, optional
40254025
Name of the node. Default is ``None``.
@@ -4049,12 +4049,12 @@ def add_face_node(
40494049
>>> box = app.modeler.create_box([5, 5, 5], [20, 50, 80])
40504050
>>> faces_ids = [face.id for face in box.faces]
40514051
>>> network.add_face_node(faces_ids[0])
4052-
>>> network.add_face_node(faces_ids[1], name="TestNode", thermal_resistance="Compute",
4053-
>>> material="Al-Extruded", thickness="2mm")
4054-
>>> network.add_face_node(faces_ids[2], name="TestNode", thermal_resistance="Specified", resistance=2)
4052+
>>> network.add_face_node(faces_ids[1],name="TestNode",thermal_resistance="Compute",
4053+
... material="Al-Extruded",thickness="2mm")
4054+
>>> network.add_face_node(faces_ids[2],name="TestNode",thermal_resistance="Specified",resistance=2)
40554055
"""
40564056
props_dict = OrderedDict({})
4057-
props_dict["FaceID"] = face_id
4057+
props_dict["FaceID"] = assignment
40584058
if thermal_resistance is not None:
40594059
if thermal_resistance == "Compute":
40604060
if resistance is not None:
@@ -4090,20 +4090,20 @@ def add_face_node(
40904090
)
40914091

40924092
if name is None:
4093-
name = "FaceID" + str(face_id)
4093+
name = "FaceID" + str(assignment)
40944094
new_node = self._Node(name, self._app, node_type="FaceNode", props=props_dict, network=self)
40954095
self._nodes.append(new_node)
40964096
self._add_to_props(new_node)
40974097
return new_node
40984098

4099-
@pyaedt_function_handler()
4100-
def add_nodes_from_dictionaries(self, nodes_dict):
4099+
@pyaedt_function_handler(nodes_dict="nodes")
4100+
def add_nodes_from_dictionaries(self, nodes):
41014101
"""
41024102
Add nodes to the network from dictionary.
41034103
41044104
Parameters
41054105
----------
4106-
nodes_dict : list or dict
4106+
nodes : list or dict
41074107
A dictionary or list of dictionaries containing nodes to add to the network. Different
41084108
node types require different key and value pairs:
41094109
@@ -4177,12 +4177,12 @@ def add_nodes_from_dictionaries(self, nodes_dict):
41774177
>>> network.add_nodes_from_dictionaries(nodes_dict)
41784178
41794179
"""
4180-
if isinstance(nodes_dict, dict):
4181-
nodes_dict = [nodes_dict]
4182-
for node_dict in nodes_dict:
4180+
if isinstance(nodes, dict):
4181+
nodes = [nodes]
4182+
for node_dict in nodes:
41834183
if "FaceID" in node_dict.keys():
41844184
self.add_face_node(
4185-
face_id=node_dict["FaceID"],
4185+
assignment=node_dict["FaceID"],
41864186
name=node_dict.get("Name", None),
41874187
thermal_resistance=node_dict.get("ThermalResistance", None),
41884188
material=node_dict.get("Material", None),
@@ -4384,7 +4384,7 @@ def props(self):
43844384
"""
43854385
return [self.node_1, self.node_2] + self._link_type + [self.value]
43864386

4387-
@pyaedt_function_handler
4387+
@pyaedt_function_handler()
43884388
def delete_link(self):
43894389
"""
43904390
Delete link from network.
@@ -4401,7 +4401,7 @@ def __init__(self, name, app, network, node_type=None, props=None):
44014401
self._node_props()
44024402
self._network = network
44034403

4404-
@pyaedt_function_handler
4404+
@pyaedt_function_handler()
44054405
def delete_node(self):
44064406
"""
44074407
Delete node from network.
@@ -4570,7 +4570,7 @@ def props(self):
45704570
def _parse_value(self):
45714571
pass # pragma : no cover
45724572

4573-
@pyaedt_function_handler
4573+
@pyaedt_function_handler()
45744574
def __getitem__(self, k):
45754575
return self.props.get(k)
45764576

@@ -4597,7 +4597,7 @@ def __init__(self, intercept, slope):
45974597
self.intercept = intercept
45984598
self.slope = slope
45994599

4600-
@pyaedt_function_handler
4600+
@pyaedt_function_handler()
46014601
def _parse_value(self):
46024602
return [self.slope, self.intercept]
46034603

@@ -4628,7 +4628,7 @@ def __init__(self, intercept, coefficient, scaling_exponent):
46284628
self.coefficient = coefficient
46294629
self.scaling_exponent = scaling_exponent
46304630

4631-
@pyaedt_function_handler
4631+
@pyaedt_function_handler()
46324632
def _parse_value(self):
46334633
return [self.intercept, self.coefficient, self.scaling_exponent]
46344634

@@ -4659,7 +4659,7 @@ def __init__(self, vertical_offset, coefficient, exponent_coefficient):
46594659
self.coefficient = coefficient
46604660
self.exponent_coefficient = exponent_coefficient
46614661

4662-
@pyaedt_function_handler
4662+
@pyaedt_function_handler()
46634663
def _parse_value(self):
46644664
return [self.vertical_offset, self.coefficient, self.exponent_coefficient]
46654665

@@ -4694,7 +4694,7 @@ def __init__(self, vertical_offset, vertical_scaling, period, period_offset):
46944694
self.period = period
46954695
self.period_offset = period_offset
46964696

4697-
@pyaedt_function_handler
4697+
@pyaedt_function_handler()
46984698
def _parse_value(self):
46994699
return [self.vertical_offset, self.vertical_scaling, self.period, self.period_offset]
47004700

@@ -4725,7 +4725,7 @@ def __init__(self, on_value, initial_time_off, on_time, off_time, off_value):
47254725
self.off_time = off_time
47264726
self.off_value = off_value
47274727

4728-
@pyaedt_function_handler
4728+
@pyaedt_function_handler()
47294729
def _parse_value(self):
47304730
return [self.on_value, self.initial_time_off, self.on_time, self.off_time, self.off_value]
47314731

@@ -4751,7 +4751,7 @@ def __init__(self, assignment_type, ds, scale):
47514751
self._assignment_type = assignment_type
47524752
self.dataset = ds
47534753

4754-
@pyaedt_function_handler
4754+
@pyaedt_function_handler()
47554755
def _parse_value(self):
47564756
return [self.scale, self.dataset.name]
47574757

0 commit comments

Comments
 (0)