We use an array of \fIregularly spaced\fP\fBTrack\fP as a geometrical fast access structure\&. It allows to know whether an area is used or not\&. The whole area may be seen as a set of adjoining tiles of fixed \fIwidth\fP but variable \fIlength\fP\&.
.PP
The figure \fB(1\&.b)\fP show, for an horizontal, track the relation between \fCy,min,max\fP and the occupied area of the plane\&. \fCmin\fP and \fCmax\fP must take into account segment extensions (\fCe\fP) and the minimal distance between two rectangles (\fCMD\fP) of the same layer\&. We assume that the width of the segment, augmented of all it's contraints is no greater than \fCTS\fP (in fact it's how \fCTS\fP must be calculated)\&.
.PP
For the whole track array, see \fBRoutingPlane\fP\&.
.PP
Fig 1: Track Area
.SH"Track Implementation"
.PP
A \fBTrack\fP is implemented with a sorted vector of \fBTrackElement\fP\&. TrackElements from differents nets must not overlap\&. The sorting order is defined as follow:
.IP"\(bu"2
TrackElements are sorted by increasing source (\fImin\fP) positions\&.
.IP"\(bu"2
In case of overlap (i\&.e\&. belongs to the same net), if they share the same source position, then they are sorted by \fIdecreasing\fP length\&. This way, the longest one will be the first encountered when walking through the \fBTrack\fP in increasing index order\&.
.PP
.PP
Figure \fB2\&.b\fP shows the details of the \fBTrack\fP\fB[1]\fP of figure \fB1\&.a\fP\&. Net \fB<d>\fP show an exemple of overlapping\&.
.PP
Fig 2: Track Structure Track Structure
.PP
In addition to the TrackSegments, the \fBTrack\fP also manage additionnal informations through a second vector of TrackMarkers\&. \fBTrackMarker\fP are currently used only to hints at how strongly a terminal is dependant on that portion of \fBTrack\fP to be accessed\&.
.SS"Indexes vs\&. Iterators"
Numerical indexes have been prefered over iterators because they can be used more easily by objects other the \fBTrack\fP itself for referencing\&. So internal managment follow the same rule, handling indexes or reference to indexes\&.
.SS"Update Mechanism"
When a \fBTrackElement\fP is normaly inserted in a \fBTrack\fP, a two way link is established\&. The \fBTrack\fP has an entry in it's vector refering to \fBTrackElement\fP, and conversely, the \fBTrackElement\fP has it's \fCtrack\fP field pointing to it's owning \fBTrack\fP\&.
.PP
\fB\fBTrackElement\fP Removal\fP
.PP
To remove a \fBTrackElement\fP from a \fBTrack\fP, we break one of those two links: the \fBTrackElement\fP cease to refer to the owning \fBTrack\fP, marking him for removal which will occurs at the next track revalidation (\fBTrack::doRemoval()\fP)\&. In figure \fB3\fP, the \fBTrackElement\fP belonging to net \fB<b>\fP is marked for removal\&.
When a \fBTrackElement\fP is inserted into a \fBTrack\fP, the two way link is immediatly created (but the \fBTrackElement\fP is not yet at it's final place in the \fBTrack\fP's vector)\&. Before inserting a \fBTrackElement\fP we check that it's been already detached (\fCtrack\fP field to \fCNULL\fP)\&.
.PP
It is at that step that the \fBTrackElement\fP axis is actually updated through a call to \fBTrackElement::setAxis()\fP\&.
.PP
\fBRevalidation Sequence\fP
.PP
After a \fBTrack\fP has been modificated either the \fBTrack\fP element vector or the MarkerElement vector (or both) has been invalidateds\&. Revalidation take place in three steps:
.IP"\(bu"2
\fBTrack::doRemoval()\fP, remove all \fBTrackElement\fP marked for removal\&.
.IP"\(bu"2
\fBTrack::insert()\fP, insert the \fBTrackElement\fP into their new \fBTrack\fP\&.
.IP"\(bu"2
\fBTrack::doReorder()\fP, sort the \fBTrackElement\fP of the vector, that is, put the newly inserted elements at their right place\&.
.PP
.PP
Each step must be done \fIfor all Tracks\fP before proceeding to the next\&. This way a \fBTrackElement\fP\fCtrack\fP field doesn't get set \fIbefore\fP it has been actually removed from it's previous \fBTrack\fP\&.
Return in \fCbegin\fP the index of the \fBTrackElement\fP whose minimum is immediately below the requested \fCposition\fP on the \fBTrack\fP axis\&. The second returned parameter \fCstate\fP is a set of flags to tell how the \fCbegin\fP index has to be interpreted\&.
Returns the complete interval of a set of overlapping \fBTrackElement\fP from the same net\&.
.SH"Member Enumeration Documentation"
.PP
.SS"enum \fBIndexState\fP"
Indicates how to compute the bounds of the interval enclosing a given \fCposition\fP on track axis\&.
.PP
\fBNote:\fP
.RS4
According to \fIposition\fP, the interval can be a free interval or a used interval\&.
.RE
.PP
.PP
\fBEnumerator\fP
.in+1c
.TP
\fB\fIBeginIsTrackMin \fP\fP
(implies \fCbegin=0\fP) there is no \fBTrackElement\fP\fIbefore\fP\fCposition\fP
.TP
\fB\fIBeginIsSegmentMin \fP\fP
The \fCbegin\fP segment starts \fIbefore\fP\fCposition\fP and ends \fIafter\fP\&.
.TP
\fB\fIBeginIsSegmentMax \fP\fP
The \fCbegin\fP segment starts and ends \fIbefore\fP\fCposition\fP\&.
.TP
\fB\fIEndIsTrackMax \fP\fP
There is no \fBTrackElement\fP\fIafter\fP\fCposition\fP\&.
.TP
\fB\fIEndIsSegmentMin \fP\fP
The \fCbegin\fP segment starts \fIbefore\fP\fCposition\fP\&.
.TP
\fB\fIEndIsNextSegmentMin \fP\fP
The \fCbegin\fP segment starts and ends \fIbefore\fP\fCposition\fP\&. So the maximum is given by the \fCminimum\fP of the \fInext\fP\fBTrackElement\fP\&.
.TP
\fB\fIEndIsSegmentMax \fP\fP
The \fCbegin\fP segment starts \fIbefore\fP\fCposition\fP and ends \fIafter\fP\&.
.TP
\fB\fIBeforeFirstElement \fP\fP
the \fCposition\fP is before the first \fBTrackElement\fP\&.
.TP
\fB\fIInsideElement \fP\fP
the \fCposition\fP is inside a \fBTrackElement\fP\&.
.TP
\fB\fIOutsideElement \fP\fP
the \fCposition\fP is in free zone between two TrackElements\&.
.TP
\fB\fIAfterLastElement \fP\fP
the position is after the end of the last element\&.
.TP
\fB\fIEmptyTrack \fP\fP
the track is still empty\&.
.TP
\fB\fIBeginMask \fP\fP
To extract the \fIbegin\fP part from a combination of flags\&.
.TP
\fB\fIEndMask \fP\fP
To extract the \fIend\fP part from a combination of flags\&.
\fBReturns:\fP the point at \fC\fP(position,\fBgetAxis()\fP) for horizontal \fBTrack\fP at or \fC\fP(\fBgetAxis()\fP,position) for vertical \fBTrack\fP\&.
.PP
Implemented in \fBHorizontalTrack\fP, and \fBVerticalTrack\fP\&.
\fIindex\fP Index of the starting \fBTrackSegment\fP\&.
.br
\fInet\fP A \fCNet\fP to ignore\&.
.RE
.PP
\fBReturns:\fP
.RS4
The next \fBTrackSegment\fP (\fCNULL\fP if not found)\&.
.RE
.PP
Find, starting from \fBTrackSegment\fP at \fIindex\fP the next \fBTrackSegment\fP ignoring \fBTrackSegment\fP from \fInet\fP\&. \fIindex\fP is modified to point on the returned \fBTrackSegment\fP\&. If there's no next \fBTrackSegment\fP (\fCNULL\fP) then index is set to \fBTrack::npos\fP\&.
.PP
Referenced by Track::expandFreeInterval(), TrackFixedSegment::getNext(), TrackSegment::getNext(), TrackElement::getNext(), and Track::getNextFixed()\&.
\fIindex\fP Index of the starting \fBTrackSegment\fP\&.
.br
\fInet\fP A \fCNet\fP to ignore\&.
.RE
.PP
\fBReturns:\fP
.RS4
The previous \fBTrackSegment\fP (\fCNULL\fP if not found)\&.
.RE
.PP
find, starting from \fBTrackSegment\fP at \fIindex\fP the previous \fBTrackSegment\fP ignoring \fBTrackSegment\fP from \fInet\fP\&. \fIindex\fP is modified to point on the returned \fBTrackSegment\fP\&. If there's no previous \fBTrackSegment\fP (\fCNULL\fP) then index is set to \fBTrack::npos\fP\&.
.PP
Referenced by Track::expandFreeInterval(), TrackFixedSegment::getPrevious(), TrackSegment::getPrevious(), and TrackElement::getPrevious()\&.
\fIindex\fP Index of the starting \fBTrackSegment\fP\&.
.RE
.PP
\fBReturns:\fP
.RS4
The first previous \fIFixed\fP\fBTrackSegment\fP\&.
.RE
.PP
find, starting from \fBTrackSegment\fP at \fIindex\fP the first previous with a \fIFixed\fP attribute set\&. \fIindex\fP is modified to point on the returned \fBTrackSegment\fP\&. If there's no previous \fBTrackSegment\fP (\fCNULL\fP) then index is set to \fBTrack::npos\fP\&.
\fBReturns:\fP the \fIindex\fP of \fIelement\fP inside the \fBTrack\fP\&. If the \fIelement\fP do not belongs to the \fBTrack\fP, return \fBTrack::npos\fP\&.
\fIbegin\fP index of one of the \fBTrackElement\fP set\&. May be modificated\&. \fBReturns:\fP the whole interval used by a set of overlaping \fBTrackSegment\fP\&.
.RE
.PP
As \fBTrackElement\fP from a same net can overlap, the interval of one of them do not give the full extend of the \fBTrack\fP occupation at this point\&. This function looks for all overlaping segments and returns the merged interval\&. Additionnaly it sets \fCbegin\fP to the index of the lowest \fBTrackElement\fP of the set\&.
.PP
Fig 4: Track::getOccuppiedInterval()
.PP
Referenced by Track::expandFreeInterval(), Track::getBeginIndex(), and Track::getOverlapBounds()\&.
\fIstate\fP tells how to interpret the \fCbegin\fP & \fCend\fP indexes\&.
.br
\fInet\fP the for wich we seek place\&. \fBReturns:\fP The longuest free interval between \fC\fP]begin,end[ \&.
.RE
.PP
Starting from the initial \fC[begin,end]\fP interval, expand the interval to encompass all free space or segments belonging to \fCnet\fP\&. \fCstate\fP may be used to compute the interval bounds from \fCbegin\fP and \fCend\fP instead of directly using the returned \fCinterval\fP\&.
.PP
\fBNote:\fP
.RS4
\fC\fP]begin,end[ must define a free interval between two \fBTrackSegment\fP\&.
\fIbegin\fP Index of the immediatly inferior \fBTrackElement\fP\&.
.br
\fIstate\fP how to interpret the returned \fCbegin\fP\&.
.RE
.PP
Return in \fCbegin\fP the index of the \fBTrackElement\fP whose minimum is immediately below the requested \fCposition\fP on the \fBTrack\fP axis\&. The second returned parameter \fCstate\fP is a set of flags to tell how the \fCbegin\fP index has to be interpreted\&.
.PP
Flags for the \fCstate\fP are:
.IP"\(bu"2
\fBTrack::BeginIsTrackMin\fP : (implies \fCbegin=0\fP) there is no \fBTrackElement\fP\fIbefore\fP\fCposition\fP\&.
.IP"\(bu"2
\fBTrack::EndIsSegmentMin\fP : The \fCbegin\fP segment starts \fIbefore\fP\fCposition\fP\&.
.IP"\(bu"2
\fBTrack::BeginIsSegmentMin\fP : The \fCbegin\fP segment starts \fIbefore\fP\fCposition\fP and ends \fIafter\fP\&.
.IP"\(bu"2
\fBTrack::EndIsSegmentMax\fP : The \fCbegin\fP segment starts \fIbefore\fP\fCposition\fP and ends \fIafter\fP\&.
.IP"\(bu"2
\fBTrack::BeginIsSegmentMax\fP : The \fCbegin\fP segment starts and ends \fIbefore\fP\fCposition\fP\&.
.IP"\(bu"2
\fBTrack::EndIsNextSegmentMin\fP : The \fCbegin\fP segment starts and ends \fIbefore\fP\fCposition\fP\&. So the maximum is given by the \fCminimum\fP of the \fInext\fP\fBTrackElement\fP\&.
.IP"\(bu"2
\fBTrack::EndIsTrackMax\fP : There is no \fBTrackElement\fP\fIafter\fP\fCposition\fP\&.
.PP
.PP
Based on the previous flags, we build the \fCstate\fP parameter:
.IP"\(bu"2
\fBTrack::BeforeFirstElement\fP : the \fCposition\fP is before the first \fBTrackElement\fP\&.
.IP"\(bu"2
\fBTrack::InsideElement\fP : the \fCposition\fP is inside a \fBTrackElement\fP\&.
.IP"\(bu"2
\fBTrack::OutsideElement\fP : the \fCposition\fP is in free zone between two TrackElements\&.
.IP"\(bu"2
\fBTrack::AfterLastElement\fP : the position is after the end of the last element\&.
.IP"\(bu"2
\fBTrack::EmptyTrack\fP : the track is still empty\&.
.PP
.PP
To separate flags relevant to \fIbegin\fP and \fIend\fP informations, two masks are provideds:
.IP"\(bu"2
\fBTrack::BeginMask\fP
.IP"\(bu"2
\fBTrack::EndMask\fP
.PP
.PP
Fig 3: Track::getBeginIndex() \fBReminder for myself:\fP The \fBTrack::getBeginIndex()\fP function relies on the \fCSTL\fP\fClower_bound()\fP function\&. \fClower_bound()\fP finds the \fBTrackElement\fP immediately \fIsuperior\fP to \fCposition\fP (shown on Figure \fB3\fP by the \fCLB\fP label in white on black)\&.
.PP
The relation between the returned \fCbegin\fP index and the position is given through the \fCstate\fP parameter\&.
.PP
Referenced by Track::getFreeInterval(), Track::getOverlapBounds(), and Track::getSegment()\&.
find the range of \fBTrackSegment\fP intersecting \fIinterval\fP\&. Note that when the \fIinterval\fP lower bound crosses a set of overlaping intervals from the same \fCNet\fP, the interval at \fIbegin\fP will crosses the lower bound but some following of the same \fCNet\fP may not\&.
.PP
Referenced by NegociateWindow::createTrackSegment(), and Track::getOverlapCost()\&.
\fIflags\fP passed to the overlap cost function\&.
.RE
.PP
\fBReturns:\fP
.RS4
The cost of the overlap\&.
.RE
.PP
Compute the cost of the overlap of \fIinterval\fP with the range \fC\fP[begin,end] of \fBTrackSegment\fP\&. Any \fBTrackSegment\fP belonging to \fInet\fP will be ignored\&.
\fIinterval\fP under which to compute terminal weight\&.
.br
\fInet\fP a net to be ignored\&.
.br
\fIcount\fP incremented of the number of track markers under the \fCinterval\fP\&.
.br
\fIweight\fP incremented of the sum of the weight of the track markers under the \fCinterval\fP\&.
.RE
.PP
Compute and return the sum of the weight of the track markers (see \fBTrackMarker\fP) under \fCinterval\fP ignoring \fCnet\fP (that is, \fIfor\fP\fCnet\fP)\&.
.PP
\fBRemark: The referenced variables \fCcount\fP and \fCweight\fP are not reset to\fP
.RS4
zero by this function\&. It is of the caller's responsability\&.
\fIoverlaps\fP The number of overlaping segments\&.
.br
\fImessage\fP An iformative message, only printed if an error occurs\&.
.RE
.PP
\fBReturns:\fP
.RS4
\fBtrue\fP if the \fBTrack\fP contains no incoherencies\&.
.RE
.PP
Perform a complete \fBTrack\fP check\&. Looks for the following incoherencies :
.IP"\(bu"2
\fBTrackSegment\fP do not refers this \fBTrack\fP\&.
.IP"\(bu"2
\fBTrackSegment\fP is detached (\fBTrackSegment::getTrack()\fP is \fCNULL\fP)\&.
.IP"\(bu"2
\fBTrackSegment\fP is hollow, this one is very unlikely as hollow \fBTrackSegment\fP are only created for the \fClower_bound()\fP\&.
.IP"\(bu"2
\fCNULL\fP pointers (should never occurs, nevertheless\&.\&.\&.)
.IP"\(bu"2
Two consecutive \fBTrackSegment\fP from different \fCNet\fP must not overlap\&.
.IP"\(bu"2
For \fBTrackSegment\fP starting from the same position, the longuest must be first\&.
.PP
.SS"void invalidate ()"
Inconditionnaly invalidate the \fBTrack\fP, regardless if it has been modificated\&. The \fBTrack\fP will be forced to be revalidated on closure of the current session\&.
.SS"void insert (\fBTrackElement\fP * segment)"
Adds \fIsegment\fP to the \fBTrack\fP\&. Must only be used inside a \fBSession\fP\&. They must appears \fIafter\fP\fBTrack::doRemoval()\fP and \fIbefore\fP\fBTrack::doReorder()\fP\&.
.PP
\fBSee also:\fP\fBKite::Session\fP\&.
.SS"void insert (\fBTrackMarker\fP * marker)"
Adds \fImarker\fP to the \fBTrack\fP\&. Must only be used inside a \fBSession\fP\&.
Directly affect the \fBTrack\fP entry at position \fCindex\fP to \fCelement\fP (use with great care)\&.
.PP
\fBSee also:\fP\fBKite::Session\fP\&.
.PP
Referenced by TrackSegment::swapTrack()\&.
.SS"size_t doRemoval ()"
\fBReturns:\fP The number of removeds \fBTrackSegment\fP\&.
.PP
Suppress all the \fBTrackSegment\fP that have been withdraw from the \fBTrack\fP\&. \fBTrackSegment\fP must be withdraw trough the \fBTrackSegment::detach()\fP method which sets their owning \fBTrack\fP to \fCNULL\fP (the removal criterion)\&. It uses the \fCSTL\fP\fIremove_if\fP algorithm that put all the to be removed elements at the end of the vector\&.
.PP
\fBSee also:\fP\fBKite::Session\fP\&.
.SS"void doReorder ()"
(Re)sort the \fBTrackElement\fP of the vector\&. Must be called \fIafter:\fP
.IP"\(bu"2
\fBTrack::doRemoval()\fP so no detached \fBTrackSegment\fP are presents\&.
.IP"\(bu"2
All calls to \fBTrack::insert()\fP, as the newly inserted elements are put at the back of the vector\&.
.PP
.PP
\fBSee also:\fP\fBKite::Session\fP\&.
.SH"Member Data Documentation"
.PP
.SS"npos = (size_t)\-1\fC [static]\fP"
A special index value (greatest integer) meaning that an index is invalid\&.
.PP
Referenced by Track::expandFreeInterval(), Track::find(), Track::getNext(), Track::getOccupiedInterval(), Track::getOverlapBounds(), Track::getOverlapCost(), Track::getPrevious(), Track::getSegment(), and Track::getSourcePosition()\&.
.SH"Author"
.PP
Generated automatically by Doxygen for Kite - Detailed Router from the source code\&.