53 weights_[nodeI] = weight;
55 const labelList& myNeighbours = connections_[nodeI];
57 forAll(myNeighbours, neighbourI)
59 if (weights_[myNeighbours[neighbourI]] > weight + 1)
65 myNeighbours[neighbourI]
76 const label startNodeI,
90 const labelList& myNeighbours = connections_[nodeI];
92 forAll(myNeighbours, neighbourI)
94 label nbrNodeI = myNeighbours[neighbourI];
96 if (nbrNodeI != prevNodeI)
98 if (weights_[nbrNodeI] == 0)
104 else if (weights_[nbrNodeI] > 0)
106 if (weights_[nbrNodeI] < minDist)
108 minDist = weights_[nbrNodeI];
112 else if (weights_[nbrNodeI] == minDist)
129 <<
"Cannot route from node " << nodeI
130 <<
" since all neigbours of node "
131 <<
"already allocated:" <<
endl;
133 forAll(myNeighbours, neighbourI)
135 label nbrNodeI = myNeighbours[neighbourI];
138 <<
" weight:" << weights_[nbrNodeI] <<
endl;
148 vector n(coords_[endNodeI] - coords_[startNodeI]);
150 scalar maxCosAngle = -GREAT;
152 forAll(myNeighbours, neighbourI)
154 label nbrNodeI = myNeighbours[neighbourI];
156 if (weights_[nbrNodeI] == minDist)
158 vector n2(coords_[nbrNodeI] - coords_[startNodeI]);
160 scalar magN2 =
mag(n2);
166 scalar cosAngle =
n & n2;
168 if (cosAngle > maxCosAngle)
170 maxCosAngle = cosAngle;
194 if (weights_[nodeI] == pathValue)
206 const label startNodeI,
207 const label prevNodeI,
208 const label pathValue
211 const labelList& myNeighbours = connections_[startNodeI];
213 forAll(myNeighbours, neighbourI)
215 label nodeI = myNeighbours[neighbourI];
217 if (nodeI != prevNodeI)
219 if (weights_[nodeI] == pathValue)
221 return findEndNode(nodeI, startNodeI, pathValue);
234 const label startNodeI,
235 const label prevNodeI,
236 const label pathValue,
240 const labelList& myNeighbours = connections_[startNodeI];
242 forAll(myNeighbours, neighbourI)
244 label nodeI = myNeighbours[neighbourI];
246 if (nodeI != prevNodeI)
248 if (weights_[nodeI] == pathValue)
274 connections_(connections),
276 weights_(coords.
size(), 0)
293 if (weights_[nodeI] >= 0)
299 if (weights_[
path[0]] < 0)
305 setWeights(0,
path[0]);
308 for (
label leafI = 1; leafI <
path.size(); leafI++)
322 for (
label leafI = 1; leafI <
path.size(); leafI++)
332 if (leafI <
path.size() - 1)
337 if (weights_[nodeI]== 0)
340 setWeights(0, nodeI);
350 if (weights_[nodeI] == 0)
352 weights_[nodeI] = pathValue;
359 if (weights_[nodeI] > 0)
372 label pathNodeI = getValue(pathValue);
377 <<
"No route with value " << pathValue <<
endl;
381 label startNodeI = findEndNode(pathNodeI, -1, pathValue);
389 storeRoute(startNodeI, -1, pathValue, route);