Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring Boundary Class #4536

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,8 +1148,8 @@ def test_61_assign_network(self, add_app):
net.add_face_node(ids[0])
net.add_face_node(ids[1], thermal_resistance="Specified", resistance=2)
net.add_face_node(ids[2], thermal_resistance="Specified", resistance="2cel_per_w")
net.add_face_node(ids[3], thermal_resistance="Compute", thickness=2, material="Al-Extruded")
net.add_face_node(ids[4], thermal_resistance="Compute", thickness="2mm", material="Al-Extruded")
net.add_face_node(ids[3], thermal_resistance="Compute", material="Al-Extruded", thickness=2)
net.add_face_node(ids[4], thermal_resistance="Compute", material="Al-Extruded", thickness="2mm")
net.add_face_node(ids[5], name="TestFace", thermal_resistance="Specified", resistance="20cel_per_w")
net.add_internal_node(name="TestInternal", power=2, mass=None, specific_heat=None)
net.add_internal_node(name="TestInternal2", power="4mW")
Expand Down
52 changes: 26 additions & 26 deletions pyaedt/modules/Boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3615,7 +3615,7 @@ def _clean_list(self, arg):
new_list.append(item)
return new_list

@pyaedt_function_handler
@pyaedt_function_handler()
def create(self):
"""
Create network in AEDT.
Expand Down Expand Up @@ -3645,7 +3645,7 @@ def create(self):
self._app.oboundary.AssignNetworkBoundary(clean_args)
return True

@pyaedt_function_handler
@pyaedt_function_handler()
def _update_from_props(self):
nodes = self.props.get("Nodes", None)
if nodes is not None:
Expand Down Expand Up @@ -4010,16 +4010,16 @@ def _add_to_props(self, new_node, type_dict="Nodes"):
except KeyError:
self.props[type_dict] = {new_node.name: new_node.props}

@pyaedt_function_handler()
@pyaedt_function_handler(face_id="assignment")
def add_face_node(
self, face_id, name=None, thermal_resistance="NoResistance", material=None, thickness=None, resistance=None
self, assignment, name=None, thermal_resistance="NoResistance", material=None, thickness=None, resistance=None
):
"""
Create a face node in the network.

Parameters
----------
face_id : int
assignment : int
Face ID.
name : str, optional
Name of the node. Default is ``None``.
Expand Down Expand Up @@ -4049,12 +4049,12 @@ def add_face_node(
>>> box = app.modeler.create_box([5, 5, 5], [20, 50, 80])
>>> faces_ids = [face.id for face in box.faces]
>>> network.add_face_node(faces_ids[0])
>>> network.add_face_node(faces_ids[1], name="TestNode", thermal_resistance="Compute",
>>> material="Al-Extruded", thickness="2mm")
>>> network.add_face_node(faces_ids[2], name="TestNode", thermal_resistance="Specified", resistance=2)
>>> network.add_face_node(faces_ids[1],name="TestNode",thermal_resistance="Compute",
... material="Al-Extruded",thickness="2mm")
>>> network.add_face_node(faces_ids[2],name="TestNode",thermal_resistance="Specified",resistance=2)
"""
props_dict = OrderedDict({})
props_dict["FaceID"] = face_id
props_dict["FaceID"] = assignment
if thermal_resistance is not None:
if thermal_resistance == "Compute":
if resistance is not None:
Expand Down Expand Up @@ -4090,20 +4090,20 @@ def add_face_node(
)

if name is None:
name = "FaceID" + str(face_id)
name = "FaceID" + str(assignment)
new_node = self._Node(name, self._app, node_type="FaceNode", props=props_dict, network=self)
self._nodes.append(new_node)
self._add_to_props(new_node)
return new_node

@pyaedt_function_handler()
def add_nodes_from_dictionaries(self, nodes_dict):
@pyaedt_function_handler(nodes_dict="nodes")
def add_nodes_from_dictionaries(self, nodes):
"""
Add nodes to the network from dictionary.

Parameters
----------
nodes_dict : list or dict
nodes : list or dict
A dictionary or list of dictionaries containing nodes to add to the network. Different
node types require different key and value pairs:

Expand Down Expand Up @@ -4177,12 +4177,12 @@ def add_nodes_from_dictionaries(self, nodes_dict):
>>> network.add_nodes_from_dictionaries(nodes_dict)

"""
if isinstance(nodes_dict, dict):
nodes_dict = [nodes_dict]
for node_dict in nodes_dict:
if isinstance(nodes, dict):
nodes = [nodes]
for node_dict in nodes:
if "FaceID" in node_dict.keys():
self.add_face_node(
face_id=node_dict["FaceID"],
assignment=node_dict["FaceID"],
name=node_dict.get("Name", None),
thermal_resistance=node_dict.get("ThermalResistance", None),
material=node_dict.get("Material", None),
Expand Down Expand Up @@ -4384,7 +4384,7 @@ def props(self):
"""
return [self.node_1, self.node_2] + self._link_type + [self.value]

@pyaedt_function_handler
@pyaedt_function_handler()
def delete_link(self):
"""
Delete link from network.
Expand All @@ -4401,7 +4401,7 @@ def __init__(self, name, app, network, node_type=None, props=None):
self._node_props()
self._network = network

@pyaedt_function_handler
@pyaedt_function_handler()
def delete_node(self):
"""
Delete node from network.
Expand Down Expand Up @@ -4570,7 +4570,7 @@ def props(self):
def _parse_value(self):
pass # pragma : no cover

@pyaedt_function_handler
@pyaedt_function_handler()
def __getitem__(self, k):
return self.props.get(k)

Expand All @@ -4597,7 +4597,7 @@ def __init__(self, intercept, slope):
self.intercept = intercept
self.slope = slope

@pyaedt_function_handler
@pyaedt_function_handler()
def _parse_value(self):
return [self.slope, self.intercept]

Expand Down Expand Up @@ -4628,7 +4628,7 @@ def __init__(self, intercept, coefficient, scaling_exponent):
self.coefficient = coefficient
self.scaling_exponent = scaling_exponent

@pyaedt_function_handler
@pyaedt_function_handler()
def _parse_value(self):
return [self.intercept, self.coefficient, self.scaling_exponent]

Expand Down Expand Up @@ -4659,7 +4659,7 @@ def __init__(self, vertical_offset, coefficient, exponent_coefficient):
self.coefficient = coefficient
self.exponent_coefficient = exponent_coefficient

@pyaedt_function_handler
@pyaedt_function_handler()
def _parse_value(self):
return [self.vertical_offset, self.coefficient, self.exponent_coefficient]

Expand Down Expand Up @@ -4694,7 +4694,7 @@ def __init__(self, vertical_offset, vertical_scaling, period, period_offset):
self.period = period
self.period_offset = period_offset

@pyaedt_function_handler
@pyaedt_function_handler()
def _parse_value(self):
return [self.vertical_offset, self.vertical_scaling, self.period, self.period_offset]

Expand Down Expand Up @@ -4725,7 +4725,7 @@ def __init__(self, on_value, initial_time_off, on_time, off_time, off_value):
self.off_time = off_time
self.off_value = off_value

@pyaedt_function_handler
@pyaedt_function_handler()
def _parse_value(self):
return [self.on_value, self.initial_time_off, self.on_time, self.off_time, self.off_value]

Expand All @@ -4751,7 +4751,7 @@ def __init__(self, assignment_type, ds, scale):
self._assignment_type = assignment_type
self.dataset = ds

@pyaedt_function_handler
@pyaedt_function_handler()
def _parse_value(self):
return [self.scale, self.dataset.name]

Expand Down
Loading