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 ()
{
KiteEngine* kite = getForFramework( CreateEngine );
@ -282,6 +291,11 @@ namespace Kite {
);
_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"
, "Kite - Detailed Pre-Route"
, "Run the <b>Kite</b> detailed router on pre-routed nets"

View File

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

View File

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