Skip to content

Commit 6c8c476

Browse files
committed
Migrate the Fixed-via-topology from tscircuit/hypergraph to tscircuit/fixed-via-hypergraph-solver
1 parent 71dab61 commit 6c8c476

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

lib/solvers/FixedTopologyHighDensityIntraNodeSolver/FixedTopologyHighDensityIntraNodeSolver.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import {
55
type ViaData,
66
type ViaByNet,
77
type ViaTile,
8-
ViaGraphSolver,
8+
FixedViaHypergraphSolver,
99
createConvexViaGraphFromXYConnections,
10-
} from "@tscircuit/hypergraph"
10+
} from "@tscircuit/fixed-via-hypergraph-solver/lib/index"
1111
import { ConnectivityMap } from "circuit-json-to-connectivity-map"
12+
import type { GraphicsObject } from "graphics-debug"
1213
import type {
1314
HighDensityIntraNodeRoute,
1415
NodeWithPortPoints,
@@ -54,7 +55,7 @@ export class FixedTopologyHighDensityIntraNodeSolver extends BaseSolver {
5455
connMap?: ConnectivityMap
5556

5657
rootConnectionNameByConnectionId: Map<string, string | undefined> = new Map()
57-
lastActiveSubSolver: ViaGraphSolver | null = null
58+
lastActiveSubSolver: FixedViaHypergraphSolver | null = null
5859

5960
solvedRoutes: HighDensityIntraNodeRouteWithVias[] = []
6061
vias: ViaRegion[] = []
@@ -96,7 +97,7 @@ export class FixedTopologyHighDensityIntraNodeSolver extends BaseSolver {
9697
return 0.3
9798
}
9899

99-
private _initializeGraph(): ViaGraphSolver | null {
100+
private _initializeGraph(): FixedViaHypergraphSolver | null {
100101
// Build connections from port points
101102
const connectionMap = new Map<
102103
string,
@@ -136,7 +137,7 @@ export class FixedTopologyHighDensityIntraNodeSolver extends BaseSolver {
136137
const convexGraph = createConvexViaGraphFromXYConnections(inputConnections)
137138
this.tiledViasByNet = convexGraph.viaTile.viasByNet ?? {}
138139

139-
return new ViaGraphSolver({
140+
return new FixedViaHypergraphSolver({
140141
inputGraph: {
141142
regions: convexGraph.regions,
142143
ports: convexGraph.ports,
@@ -147,7 +148,8 @@ export class FixedTopologyHighDensityIntraNodeSolver extends BaseSolver {
147148
}
148149

149150
_step() {
150-
let activeSubSolver = this.activeSubSolver as ViaGraphSolver | null
151+
let activeSubSolver = this
152+
.activeSubSolver as FixedViaHypergraphSolver | null
151153
if (!activeSubSolver) {
152154
activeSubSolver = this._initializeGraph()
153155
if (!activeSubSolver) {
@@ -405,7 +407,7 @@ export class FixedTopologyHighDensityIntraNodeSolver extends BaseSolver {
405407
)
406408
}
407409

408-
private _processResults(viaGraphSolver: ViaGraphSolver) {
410+
private _processResults(viaGraphSolver: FixedViaHypergraphSolver) {
409411
this.solvedRoutes = []
410412
const viaTile = viaGraphSolver.viaTile
411413
const fallbackViaDiameter = viaTile
@@ -588,7 +590,7 @@ export class FixedTopologyHighDensityIntraNodeSolver extends BaseSolver {
588590
return this.vias
589591
}
590592

591-
override visualize() {
593+
override visualize(): GraphicsObject {
592594
if (this.activeSubSolver) {
593595
return this.activeSubSolver.visualize()
594596
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"scripts": {
1010
"start": "cosmos",
11-
"build": "tsup ./lib/index.ts --minify terser --external @tscircuit/core --external circuit-to-svg --format esm --dts --sourcemap",
11+
"build": "tsup ./lib/index.ts --minify terser --external @tscircuit/core --external circuit-to-svg --external @tscircuit/fixed-via-hypergraph-solver/lib/index --format esm --dts --sourcemap",
1212
"bench": "bun test tests/spatial-index-bench.test.ts",
1313
"format": "biome format --write .",
1414
"format:check": "biome format .",
@@ -28,6 +28,7 @@
2828
"@tscircuit/circuit-json-util": "^0.0.90",
2929
"@tscircuit/core": "^0.0.337",
3030
"@tscircuit/curvy-trace-solver": "^0.0.10",
31+
"@tscircuit/fixed-via-hypergraph-solver": "github:tscircuit/fixed-via-hypergraph-solver#7bd62d7db34f18d5ed892a8fce36dea59bf95b55",
3132
"@tscircuit/hypergraph": "^0.0.71",
3233
"@tscircuit/dataset-srj05": "git+https://github.com/tscircuit/dataset-srj05.git#9a49c126a89c083dc4d2b72cd17184735f637762",
3334
"@tscircuit/jumper-topology-generator": "^0.0.4",

0 commit comments

Comments
 (0)