mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
remove_deep2 - fix traversing same element twice
(I hope I don't miss anything, no tests seem to fail and performance is increased significantly) but because `subelement_queue` initiated with the `traverse` all `element`'s subelements will be traversed inside `while` loop twice - once as a part of initial queue and another time when `element` is traversed inside the loop and all those elements added to the queue again. Now we just initiate the `queue` with the `element` and it will be traversed inside the loop like any other element.
This commit is contained in:
@@ -1489,7 +1489,7 @@ def remove_deep2(
|
||||
subgraph = list(ifc_file.traverse(element, breadth_first=True))
|
||||
subgraph.extend(also_consider)
|
||||
subgraph_set = set(subgraph)
|
||||
subelement_queue = ifc_file.traverse(element, max_levels=1)
|
||||
subelement_queue = [element]
|
||||
while subelement_queue:
|
||||
subelement = subelement_queue.pop(0)
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user