From 3598c6d8f76a780ef9b96ef5f499b8ca296a5fa6 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Mon, 6 Feb 2017 21:59:15 +0100 Subject: [PATCH] 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. --- anabatic/src/anabatic/Dijkstra.h | 6 ++++-- katana/src/GlobalRoute.cpp | 10 +++++----- katana/src/RoutingEvent.cpp | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/anabatic/src/anabatic/Dijkstra.h b/anabatic/src/anabatic/Dijkstra.h index 35982112..6ffa4224 100644 --- a/anabatic/src/anabatic/Dijkstra.h +++ b/anabatic/src/anabatic/Dijkstra.h @@ -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 + 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 + inline DistanceT* Dijkstra::setDistance ( DistanceT cb ) { _distanceCb = cb; return _distanceCb.target(); } } // Anabatic namespace. diff --git a/katana/src/GlobalRoute.cpp b/katana/src/GlobalRoute.cpp index 27fc582f..a5758363 100644 --- a/katana/src/GlobalRoute.cpp +++ b/katana/src/GlobalRoute.cpp @@ -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; diff --git a/katana/src/RoutingEvent.cpp b/katana/src/RoutingEvent.cpp index 77851505..79c9dfc4 100644 --- a/katana/src/RoutingEvent.cpp +++ b/katana/src/RoutingEvent.cpp @@ -1,4 +1,4 @@ -// -*- C++ -*- +// -*- mode: C++; explicit-buffer-name: "RoutingEvent.cpp" -*- // // This file is part of the Coriolis Software. // Copyright (c) UPMC 2008-2016, All Rights Reserved