Skip to content

Commit

Permalink
Fix fatal error related to nodeSet constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
MuTsunTsai committed Aug 26, 2024
1 parent e8e7266 commit a5c6bad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/core/design/layout/nodeSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class NodeSet {

const heap = new MutableHeap<ITreeNode>(nodeComparator);
const coverage = new Map<ITreeNode, Quadrant[]>();
const numLeaves = this.$leaves.length;
const numQuadrants = quadrants.size;
for(const id of this.$leaves) {
const leaf = State.$tree.$nodes[id]!;
heap.$insert(leaf);
Expand All @@ -60,10 +60,10 @@ export class NodeSet {
if(junctions.length > 1) this._lcaMap = new IntDoubleMap();
while(!heap.$isEmpty) {
const node = heap.$pop()!;
const coveredLeaves = coverage.get(node)!;
const coveredQuadrants = coverage.get(node)!;

// Stop processing if we've reached the LCA
if(coveredLeaves.length == numLeaves) {
// Stop processing if we've covered everything (i.e. reached the LCA)
if(coveredQuadrants.length == numQuadrants) {
coverage.delete(node);
continue;
}
Expand All @@ -74,10 +74,10 @@ export class NodeSet {
const parentCoverage = getOrSetEmptyArray(coverage, parent, () => heap.$insert(parent));
if(this._lcaMap && parentCoverage.length) {
for(const A of parentCoverage) {
for(const B of coveredLeaves) this._lcaMap.set(A.$flap.id, B.$flap.id, parent);
for(const B of coveredQuadrants) this._lcaMap.set(A.$flap.id, B.$flap.id, parent);
}
}
parentCoverage.push(...coveredLeaves);
parentCoverage.push(...coveredQuadrants);
}

nodes.sort(minComparator);
Expand Down

0 comments on commit a5c6bad

Please sign in to comment.