More resilient KiteEngine::wipeoutRouting(). Added to graphic menus.

* Change: In KiteEngine::wipeoutRouting(), remove only the Contacts
    that are *not* anchored. Any other will be indirectly destroyed.
* New: In GraphicKiteEngine, add an encapsulation and a menu for
    wipeoutRouting().
This commit is contained in:
Jean-Paul Chaput 2015-06-22 23:04:54 +02:00
parent f0ebf8de6d
commit 61f2b8630f
4 changed files with 66 additions and 28 deletions

View File

@ -151,6 +151,15 @@ namespace Kite {
} }
void GraphicKiteEngine::_wipeoutRouting ()
{
if (getCell()) {
KiteEngine::wipeoutRouting( getCell() );
_viewer->getCellWidget()->refresh();
}
}
void GraphicKiteEngine::_loadGlobalSolution () void GraphicKiteEngine::_loadGlobalSolution ()
{ {
KiteEngine* kite = getForFramework( CreateEngine ); KiteEngine* kite = getForFramework( CreateEngine );
@ -282,6 +291,11 @@ namespace Kite {
); );
_viewer->addToMenu( "placeAndRoute.stepByStep.========" ); _viewer->addToMenu( "placeAndRoute.stepByStep.========" );
_viewer->addToMenu( "placeAndRoute.stepByStep.wipeoutRouting"
, "Kite - Erase Previous Routing"
, "Erase any previously routed wires"
, std::bind(&GraphicKiteEngine::_wipeoutRouting,this)
);
_viewer->addToMenu( "placeAndRoute.stepByStep.detailedPreRoute" _viewer->addToMenu( "placeAndRoute.stepByStep.detailedPreRoute"
, "Kite - Detailed Pre-Route" , "Kite - Detailed Pre-Route"
, "Run the <b>Kite</b> detailed router on pre-routed nets" , "Run the <b>Kite</b> detailed router on pre-routed nets"

View File

@ -65,6 +65,7 @@ namespace Kite {
using std::vector; using std::vector;
using std::make_pair; using std::make_pair;
using Hurricane::dbo_ptr; using Hurricane::dbo_ptr;
using Hurricane::UpdateSession;
using Hurricane::DebugSession; using Hurricane::DebugSession;
using Hurricane::tab; using Hurricane::tab;
using Hurricane::inltrace; using Hurricane::inltrace;
@ -78,6 +79,9 @@ namespace Kite {
using Hurricane::Box; using Hurricane::Box;
using Hurricane::Torus; using Hurricane::Torus;
using Hurricane::Layer; using Hurricane::Layer;
using Hurricane::Horizontal;
using Hurricane::Vertical;
using Hurricane::NetRoutingExtension;
using Hurricane::Cell; using Hurricane::Cell;
using CRL::System; using CRL::System;
using CRL::addMeasure; using CRL::addMeasure;
@ -212,38 +216,38 @@ namespace Kite {
void KiteEngine::wipeoutRouting ( Cell * cell ) void KiteEngine::wipeoutRouting ( Cell * cell )
{ {
if(KiteEngine::get(cell) != NULL or KatabaticEngine::get(cell) != NULL) if ( (KiteEngine::get(cell) != NULL) or (KatabaticEngine::get(cell) != NULL) )
throw Error("Trying to wipe out a routing with a routing engine\n"); throw Error( "KiteEngine::wipeoutRouting(): KiteEngine still active on %s"
using namespace Hurricane; , getString(cell->getName()).c_str() );
UpdateSession::open(); UpdateSession::open();
for ( Net* net : cell->getNets() ) { for ( Net* net : cell->getNets() ) {
if(NetRoutingExtension::isManualGlobalRoute(net)) if (NetRoutingExtension::isManualGlobalRoute(net)) continue;
continue;
// First pass: destroy the contacts // First pass: destroy the contacts
std::vector<Contact*> contactPointers; std::vector<Contact*> contacts;
for(Component* com : net->getComponents()){ for ( Component* component : net->getComponents() ) {
Contact * contact = dynamic_cast<Contact*>(com); Contact* contact = dynamic_cast<Contact*>(component);
if(contact){ if (contact and not contact->getAnchorHook()->isAttached())
contactPointers.push_back(contact); contacts.push_back( contact );
} }
} for ( Contact* contact : contacts )
for(Contact* contact : contactPointers)
contact->destroy(); contact->destroy();
// Second pass: destroy unconnected segments added by Knik as blockages // Second pass: destroy unconnected segments added by Knik as blockages
std::vector<Component*> compPointers; std::vector<Component*> segments;
for(Component* com : net->getComponents()){ for ( Component* component : net->getComponents() ) {
Horizontal * h = dynamic_cast<Horizontal*>(com); Horizontal* horizontal = dynamic_cast<Horizontal*>(component);
if(h){ if (horizontal) segments.push_back( horizontal );
compPointers.push_back(h);
Vertical* vertical = dynamic_cast<Vertical*>(component);
if (vertical) segments.push_back( vertical );
} }
Vertical * v = dynamic_cast<Vertical*>(com); for ( Component* segment : segments )
if(v){ segment->destroy();
compPointers.push_back(v);
}
}
for(Component* comp : compPointers)
comp->destroy();
} }
UpdateSession::close(); UpdateSession::close();
} }

View File

@ -82,6 +82,23 @@ extern "C" {
// +=================================================================+ // +=================================================================+
static PyObject* PyKiteEngine_wipeoutRouting ( PyObject*, PyObject* args )
{
trace << "PyKiteEngine_wipeoutRouting()" << endl;
HTRY
PyObject* arg0;
if (not ParseOneArg("Kite.wipeoutRouting", args, CELL_ARG, &arg0)) {
PyErr_SetString( ConstructorError, "Bad parameters given to Kite.wipeoutRouting()." );
return NULL;
}
KiteEngine::wipeoutRouting( PYCELL_O(arg0) );
HCATCH
Py_RETURN_NONE;
}
static PyObject* PyKiteEngine_get ( PyObject*, PyObject* args ) static PyObject* PyKiteEngine_get ( PyObject*, PyObject* args )
{ {
trace << "PyKiteEngine_get()" << endl; trace << "PyKiteEngine_get()" << endl;
@ -303,7 +320,9 @@ extern "C" {
PyMethodDef PyKiteEngine_Methods[] = PyMethodDef PyKiteEngine_Methods[] =
{ { "get" , (PyCFunction)PyKiteEngine_get , METH_VARARGS|METH_STATIC { { "wipeoutRouting" , (PyCFunction)PyKiteEngine_wipeoutRouting , METH_VARARGS|METH_STATIC
, "Remove any previous routing." }
, { "get" , (PyCFunction)PyKiteEngine_get , METH_VARARGS|METH_STATIC
, "Returns the Kite engine attached to the Cell, None if there isnt't." } , "Returns the Kite engine attached to the Cell, None if there isnt't." }
, { "create" , (PyCFunction)PyKiteEngine_create , METH_VARARGS|METH_STATIC , { "create" , (PyCFunction)PyKiteEngine_create , METH_VARARGS|METH_STATIC
, "Create a Kite engine on this cell." } , "Create a Kite engine on this cell." }

View File

@ -84,6 +84,7 @@ namespace Kite {
protected: protected:
GraphicKiteEngine (); GraphicKiteEngine ();
virtual ~GraphicKiteEngine (); virtual ~GraphicKiteEngine ();
void _wipeoutRouting ();
void _route (); void _route ();
void _loadGlobalSolution (); void _loadGlobalSolution ();
void _saveGlobalSolution (); void _saveGlobalSolution ();