GCellDensitySet(3)

NAME
GCellDensitySet - GCell Set, sorted by density.

SYNOPSIS

  Public Member Functions
GCellDensitySet (unsigned int depth)
GCellDensitySet (unsigned int depth, const std::vector< GCell *> &)
~GCellDensitySet ()
bool empty () const
size_t size () const
const std::set< GCell *, GCell::CompareByKey > & getGCells () const
void insert (GCell *)
void erase (GCell *)
void unqueue (GCell *)
void requeue ()

Detailed Description

GCell Set, sorted by density. A small container helper to manage a set of GCell sorted by density on a specific layer depth.

The helper is implemented in term of a set. Once inserted in a set an element must not have is sorting key changed. But GCell density may change due to AutoSegment modifications during the lifetime of the set. To circumvent this problem, the GCell provide a key attribute to be used specifically with GCellDensitySet. This key act as a cached copy of the GCell density which is updated only by a call to GCell::updateKey() (and not GCell::updateDensity()). GCell which density have changed and key has to be updated must be signaled to set with the GCellDensityQueue::unqueue() method. When we want to update the sorting of the set on the new densities, we call GCellDensitySet::requeue() which, for each invalidated GCell do:

•   Remove the GCell from the set.

•   Update the key (call GCell::updateKey()).

•   Reinsert the GCell in the set (thus with the updated key).

Typical usage:

GCellDensitySet gcells ( 2, *(getGCellGrid()->getGCellVector()) );
while ( true ) {
    bool optimized = false;
    std::set<GCell*,GCell::CompareByKey>::const_iterator igcell = gcells.getGCells().begin();
    for ( ; igcell != gcells.getGCells().end() ; ++igcell ) {
        if ( doSomeOptimization(*igcell) ) {
          optimized = true;
          gcells.unqueue( *igcell );
        }
    }
    if (not optimized) break;
    gcells.requeue();
}

Constructor & Destructor Documentation

  GCellDensitySet (unsigned int depth)
Create a new empty GCellDensitySet, sorting on density of layer depth.

  GCellDensitySet (unsigned int depth, const std::vector< GCell *> & gcells)
Create a new empty GCellDensitySet, sorting on density of layer depth. Load the queue with the GCells supplied in the gcells vector.

References GCellDensitySet::requeue().

  ~GCellDensitySet ()
Delete a GCellDensitySet, if the queue is not empty, issue a warning.

Member Function Documentation

  bool empty () const [inline]
Returns: true if the queue is empty.

  size_t size () const [inline]
Returns: the numbers of elements in the queue.

  const std::set< GCell *, GCell::CompareByKey > & getGCells () const [inline]
Returns: the list of GCells currently in the queue.

  size_t insert (GCell * gcell) [inline]
Insert gcell into the set.

  size_t erase (GCell * gcell) [inline]
Remove gcell from the set.

  void unqueue (GCell * gcell) [inline]
Invalidate gcell. The density of gcell may have changed and needs to be reinserted into the queue. It is temporarily set asides until the next call to GCellDensitySet::requeue().

  void requeue ()
Reinsert in the queue all the GCells that have been previously invalidated by a call to GCellDensitySet::unqueue(). This function calls GCell::updateKey() before reinserting the GCell.

Referenced by GCellDensitySet::GCellDensitySet().

Author

Generated automatically by Doxygen for Katabatic - Routing Toolbox from the source code.