Lee's PCB routing algorithm. Construct with list of connections between nodes (i.e. topology) and list of coordinates of nodes (can be vector::zero) More...
Public Member Functions | |
router (const labelListList &connections, const List< point > &coords) | |
Construct from connections, route later. More... | |
const labelList & | weights () const |
bool | route (const labelList &path, const label pathValue) |
Find path from first element in path to all other elements. More... | |
labelList | getRoute (const label pathValue) const |
Extract labels of route with given value. More... | |
Private Member Functions | |
label | count (const label weight) const |
Return number of weights. Utility function. More... | |
void | setWeights (const label weight, const label nodeI) |
Set distance from nodeI. More... | |
void | fixWeights (const label startNodeI, const label endNodeI, const label nodeI, const label prevNodeI) |
Finds path from nodeI to startNodeI by travelling in direction. More... | |
bool | shortestPath (const labelList &path, const label pathValue) |
Routes single path. More... | |
label | getValue (const label) const |
Linear search for element with weight. More... | |
label | findEndNode (const label startNodeI, const label prevNodeI, const label pathValue) const |
Find node which has no neighbours with pathValue. More... | |
void | storeRoute (const label startNodeI, const label prevNodeI, const label pathValue, DynamicList< label > &route) const |
Append all pathValue weights to route. More... | |
router (const router &) | |
Disallow default bitwise copy construct. More... | |
void | operator= (const router &) |
Disallow default bitwise assignment. More... | |
Private Attributes | |
const labelListList | connections_ |
Connections. More... | |
const pointField | coords_ |
Coordinates of nodes. More... | |
labelList | weights_ |
Routing table. More... | |
Lee's PCB routing algorithm. Construct with list of connections between nodes (i.e. topology) and list of coordinates of nodes (can be vector::zero)
Enter topology/geometry router cellRouter ( mesh().cellCells(), mesh().cellCentres() );
Try to route connections one by one. Specify unique value (<0) to mark path with. forAll(wantedConnections, i) { bool success = cellRouter.route(wantedConnections[i], -(i+1)); }
The coordinates are only used at the moment for diagonal preference of routing:
So not:
+A | | | | ——+B
But:
+ A |_ |_ |_ |_ | + B
Lee algo: take array with same dimensions as grid of nodes. Initialize to large number. Put 0 at starting point. Now recursively assign neighbours as current value plus one. Stop if you hit node which has smaller number. Phase two is where you search path with lowest value. These are assigned negative number so they for next route are not overwritten.
router | ( | const labelListList & | connections, |
const List< point > & | coords | ||
) |
|
private |
Return number of weights. Utility function.
Definition at line 32 of file router.C.
References forAll, and router::weights_.
|
private |
Finds path from nodeI to startNodeI by travelling in direction.
of lowest weight
Definition at line 75 of file router.C.
References Foam::endl(), forAll, Foam::labelMax, Foam::mag(), n, and WarningInFunction.
|
private |
|
private |
|
private |
Append all pathValue weights to route.
Definition at line 233 of file router.C.
References DynamicList::append(), and forAll.
|
private |
Disallow default bitwise assignment.
|
inline |
Definition at line 184 of file router.H.
References router::weights_.
Find path from first element in path to all other elements.
Mark resulting path in weights with (negative) pathValue. Returns false and does not mark any elements if cannot route.
Definition at line 282 of file router.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::labelMax, and path().
Referenced by main().
Foam::labelList getRoute | ( | const label | pathValue | ) | const |
Extract labels of route with given value.
Definition at line 369 of file router.C.
References DynamicList::append(), Foam::endl(), FatalErrorInFunction, and DynamicList::shrink().
Referenced by main().
|
private |
|
private |
|
private |
Routing table.
Definition at line 110 of file router.H.
Referenced by router::count(), and router::weights().
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.