Disjksta::setDistance() now return a pointer to the copied object.

* Change: In Anabatic::Dijkstra the _distanceCb attribute got copied
    from the setDistance() argument. To be able to access the duplicated
    distance (and therefore access/modify it) the function now return a
    pointer to it. Done with the "target()" accessor of std::function<>.
* Change: In Katana::GlobalRouting::runGlobalRouter() use the new
    Disjkstra::setDistance() to be able to call setNet() on the right
    object.
This commit is contained in:
Jean-Paul Chaput 2017-02-06 21:59:15 +01:00
parent f8b9957d20
commit 3598c6d8f7
3 changed files with 10 additions and 8 deletions

View File

@ -295,7 +295,8 @@ namespace Anabatic {
inline bool isSourceVertex ( Vertex* ) const;
inline bool isTargetVertex ( Vertex* ) const;
inline DbU::Unit getSearchAreaHalo () const;
inline void setDistance ( distance_t );
template<typename DistanceT>
inline DistanceT* setDistance ( DistanceT );
inline void setSearchAreaHalo ( DbU::Unit );
void load ( Net* );
void run ( Mode mode=Mode::Standart );
@ -335,9 +336,10 @@ namespace Anabatic {
inline bool Dijkstra::isSourceVertex ( Vertex* v ) const { return (_sources.find(v) != _sources.end()); }
inline bool Dijkstra::isTargetVertex ( Vertex* v ) const { return (_targets.find(v) != _targets.end()); }
inline DbU::Unit Dijkstra::getSearchAreaHalo () const { return _searchAreaHalo; }
inline void Dijkstra::setDistance ( distance_t cb ) { _distanceCb = cb; }
inline void Dijkstra::setSearchAreaHalo ( DbU::Unit halo ) { _searchAreaHalo = halo; }
template<typename DistanceT>
inline DistanceT* Dijkstra::setDistance ( DistanceT cb ) { _distanceCb = cb; return _distanceCb.target<DistanceT>(); }
} // Anabatic namespace.

View File

@ -154,10 +154,10 @@ namespace Katana {
float edgeHInc = getConfiguration()->getEdgeHInc();
openSession();
Dijkstra* dijkstra = new Dijkstra ( this );
DigitalDistance distance ( getConfiguration()->getEdgeCostH()
, getConfiguration()->getEdgeCostK() );
dijkstra->setDistance( distance );
Dijkstra* dijkstra = new Dijkstra ( this );
DigitalDistance* distance =
dijkstra->setDistance( DigitalDistance( getConfiguration()->getEdgeCostH()
, getConfiguration()->getEdgeCostK() ));
size_t iteration = 0;
size_t netCount = 0;
@ -168,7 +168,7 @@ namespace Katana {
for ( NetData* netData : getNetOrdering() ) {
if (netData->isGlobalRouted()) continue;
distance.setNet( netData->getNet() );
distance->setNet( netData->getNet() );
dijkstra->load( netData->getNet() );
dijkstra->run();
++netCount;

View File

@ -1,4 +1,4 @@
// -*- C++ -*-
// -*- mode: C++; explicit-buffer-name: "RoutingEvent.cpp<katana>" -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC 2008-2016, All Rights Reserved