@@ -94,24 +94,30 @@ def mapTrace(trace, net, delta, verbose=False, airDistFactor=2, fillGaps=0, gapP
94
94
result = ()
95
95
paths = {} # maps a path stub to a pair of current cost and the last mapping position on the last edge
96
96
lastPos = None
97
+ nPathCalls = 0
98
+ nNoCandidates = 0
97
99
if verbose :
98
- print ("mapping trace with %s points" % len (trace ))
100
+ print ("mapping trace with %s points ... " % len (trace ), end = "" , flush = True )
99
101
for idx , pos in enumerate (trace ):
102
+ x , y = pos
100
103
newPaths = {}
101
104
if vias and idx in vias :
102
105
candidates = []
103
106
for edgeID in vias [idx ]:
104
107
if net .hasEdge (edgeID ):
105
108
candidates .append ((net .getEdge (edgeID ), 0. ))
106
109
else :
107
- print ("Unknown via edge %s for %s,%s" % (edgeID , pos [ 0 ], pos [ 1 ] ))
110
+ print ("Unknown via edge %s for %s,%s" % (edgeID , x , y ))
108
111
else :
109
- candidates = net .getNeighboringEdges (pos [ 0 ], pos [ 1 ] , delta , not net .hasInternal )
112
+ candidates = net .getNeighboringEdges (x , y , delta , not net .hasInternal )
110
113
if debug :
111
- print ("\n \n pos:%s, %s" % (pos [ 0 ], pos [ 1 ] ))
114
+ print ("\n \n pos:%s, %s" % (x , y ))
112
115
print ("candidates:%s\n " % [(e .getID (), c ) for e , c in candidates ])
113
116
if verbose and not candidates :
114
- print ("Found no candidate edges for %s,%s" % pos )
117
+ if nNoCandidates == 0 :
118
+ print ()
119
+ print (" Found no candidate edges for %s,%s (index %s) " % (x , y , idx ))
120
+ nNoCandidates += 1
115
121
116
122
for edge , d in candidates :
117
123
if vClass is not None and not edge .allows (vClass ):
@@ -139,6 +145,7 @@ def mapTrace(trace, net, delta, verbose=False, airDistFactor=2, fillGaps=0, gapP
139
145
extension , cost = net .getOptimalPath (path [- 1 ], edge , maxCost = maxGap ,
140
146
reversalPenalty = reversalPenalty ,
141
147
fromPos = lastBase , toPos = base )
148
+ nPathCalls += 1
142
149
if extension is None :
143
150
airLineDist = euclidean (
144
151
path [- 1 ].getToNode ().getCoord (),
@@ -176,6 +183,10 @@ def mapTrace(trace, net, delta, verbose=False, airDistFactor=2, fillGaps=0, gapP
176
183
result += minPath
177
184
paths = newPaths
178
185
lastPos = pos
186
+ if verbose :
187
+ if nNoCandidates > 0 :
188
+ print ("%s Points had no candidates. " % nNoCandidates , end = "" )
189
+ print ("(%s router calls)" % nPathCalls )
179
190
if paths :
180
191
if debug :
181
192
print ("**************** result:" )
0 commit comments