diff --git a/anabatic/src/Dijkstra.cpp b/anabatic/src/Dijkstra.cpp index e3f8cfb6..d5d44d29 100644 --- a/anabatic/src/Dijkstra.cpp +++ b/anabatic/src/Dijkstra.cpp @@ -58,22 +58,31 @@ namespace Anabatic { _min = Vertex::unreached; _max = Vertex::unreached; _axis = Vertex::unreached; + _flags = 0; + } + + + IntervalC::IntervalC(IntervalC& i) + { + _min = i.getMin(); + _max = i.getMax(); + _axis = i.getAxis(); + setFlags(i.getFlags()); + } + + + IntervalC::IntervalC(const IntervalC& i) + { + _min = i.getMin(); + _max = i.getMax(); + _axis = i.getAxis(); + setFlags(i.getFlags()); } IntervalC::~IntervalC() {} - IntervalC* IntervalC::create() - { - return new IntervalC(); - } - - void IntervalC::destroy () - { - delete (this); - } - void IntervalC::set ( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) { _min = min; @@ -108,9 +117,10 @@ namespace Anabatic { if (_max < vmax) _max = vmax; } + void IntervalC::print() const { - cerr << "[IntervalC]: typeH: " << isH() << ", typeV: " << isV() << ", min: " << DbU::getValueString(_min) << ", max:" << DbU::getValueString(_max) << ", axis:" << DbU::getValueString(_axis) << endl; + cdebug_log(112,0) << "[IntervalC]: min: " << DbU::getValueString(_min) << ", max:" << DbU::getValueString(_max) << ", axis:" << DbU::getValueString(_axis) << endl; } @@ -122,6 +132,37 @@ namespace Anabatic { _flags &= ~iSet; } +// ------------------------------------------------------------------- +// Class : "Anabatic::GRAData". + GRAData::GRAData () + : _intervfrom (IntervalC()) + , _interv (IntervalC()) + , _from2 (NULL) + , _intervfrom2 (IntervalC()) + {} + + + GRAData::~GRAData() {} + + + GRAData* GRAData::create() + { + return new GRAData(); + } + + + void GRAData::resetIntervals() + { + _interv.reset(); + _intervfrom.reset(); + } + + + void GRAData::clearFrom2 () + { + _from2 = NULL; + } + // ------------------------------------------------------------------- // Class : "Anabatic::Vertex". @@ -190,7 +231,7 @@ namespace Anabatic { } - bool Vertex::isRestricted ( const Vertex* v1, const Vertex* v2 ) + bool Vertex::isRestricted ( const Vertex* v1, const Vertex* v2, DbU::Unit hpitch, DbU::Unit vpitch ) { bool restricted = true; GCell* c1 = v1->getGCell(); @@ -209,34 +250,38 @@ namespace Anabatic { cerr << Error( "GCells are not side by side." ) << endl; return true; } - - if (restricted) return true; + + if ( (c1->getWidth() < hpitch) + ||(c1->getHeight() < vpitch) + ||(restricted) + ) return true; else { + restricted = true; // Check from GCell 2 if ( c2->isNorth(c1) ) { - if ( v2->isNRestricted() ) return true; - else return false; + if ( !v2->isNRestricted() ) restricted = false; } else if ( c2->isSouth(c1) ) { - if ( v2->isSRestricted() ) return true; - else return false; + if ( !v2->isSRestricted() ) restricted = false; } else if ( c2->isEast (c1) ) { - if ( v2->isERestricted() ) return true; - else return false; + if ( !v2->isERestricted() ) restricted = false; } else if ( c2->isWest (c1) ) { - if ( v2->isWRestricted() ) return true; - else return false; + if ( !v2->isWRestricted() ) restricted = false; } else { cerr << Error( "GCells are not side by side." ) << endl; return true; } + if ( (c2->getWidth() < hpitch) + ||(c2->getHeight() < vpitch) + ||(restricted) + ) return true; + else return false; } } Point Vertex::getNextPathPoint( Point pcurr, const Vertex* vnext ) const { - //cdebug_log(112,1) << "Point Dijkstra::getNextPathPoint( IntervalC* interv, IntervalC* intervfrom, Vertex* next )" << endl; - // done in vcurr + cdebug_log(112,1) << "Point Dijkstra::getNextPathPoint( Point pcurr, const Vertex* vnext )" << endl; if (vnext == NULL){ cdebug_tabw(112,-1); return Point(0,0); @@ -247,7 +292,6 @@ namespace Anabatic { return Point(vnext->getGCell()->getXCenter(), vnext->getGCell()->getYCenter()); } - //Point pcurr = getStartPathPoint(interv, intervfrom, next); GCell* gnext = vnext->getGCell(); GCell* gcurr = getGCell(); DbU::Unit x = 0; @@ -255,9 +299,9 @@ namespace Anabatic { if (vnext->isV()){ - //cdebug_log(112,0) << "Case next: Vertical: " << vnext->isiSet() << endl; //", d:" << vnext->getDistance() << endl; + cdebug_log(112,0) << "Case next: Vertical: " << vnext->isiSet() << endl; //", d:" << vnext->getDistance() << endl; if ((vnext->isiSet())&&(vnext->hasValidStamp())){ - //cdebug_log(112,0) << "Case set" << endl; + cdebug_log(112,0) << "Case set" << endl; x = vnext->getIAxis(); if (isNorth(vnext)) y = vnext->getIMin(); else if (isSouth(vnext)) y = vnext->getIMax(); @@ -267,7 +311,7 @@ namespace Anabatic { else y = pcurr.getY(); } else cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.1" << endl; } else { - //cdebug_log(112,0) << "Case not set" << endl; + cdebug_log(112,0) << "Case not set" << endl; if (isNorth(vnext)){ y = gcurr->getYMax(); if (pcurr.getX() < gnext->getXMin()) x = gnext->getXMin(); @@ -293,10 +337,10 @@ namespace Anabatic { } } else if (vnext->isH()) { - //cdebug_log(112,0) << "Case next: Horizontal: " << vnext->isiSet() << endl; //", d:" << vnext->getDistance() << endl; + cdebug_log(112,0) << "Case next: Horizontal: " << vnext->isiSet() << endl; //", d:" << vnext->getDistance() << endl; if ((vnext->isiSet())&&(vnext->hasValidStamp())){ - //cdebug_log(112,0) << "Case set" << endl; + cdebug_log(112,0) << "Case set" << endl; y = vnext->getIAxis(); if (isEast (vnext)) x = vnext->getIMin(); else if (isWest (vnext)) x = vnext->getIMax(); @@ -307,7 +351,7 @@ namespace Anabatic { } else cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.3" << endl; } else { - //cdebug_log(112,0) << "Case not set" << endl; + cdebug_log(112,0) << "Case not set" << endl; if (isNorth(vnext)){ y = gcurr->getYMax(); if (pcurr.getX() < gnext->getXMin()) x = gnext->getXMin(); @@ -334,7 +378,7 @@ namespace Anabatic { } else { cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.5" << endl; } - //cdebug_tabw(112,-1); + cdebug_tabw(112,-1); return Point(x,y); } @@ -343,152 +387,102 @@ namespace Anabatic { { cdebug_log(112,1) << "Point Vertex::getStartPathPoint( const Vertex* next ) const:" << this << endl; - GCell* gcurr = getGCell(); - GCell* gnext = next->getGCell(); - DbU::Unit x = 0; - DbU::Unit y = 0; - - IntervalC* interv = _interv; - IntervalC* intervfrom = NULL; - /*GCell* gprev = NULL; - if (isFrom2Mode()){ - cdebug_log(112,0) << "UseFrom2Mode" << endl; - intervfrom = _intervfrom2; - if (_from2) gprev = _from2->getOpposite(gcurr); - } else { - cdebug_log(112,0) << "UseFrom1Mode" << endl; - intervfrom = _intervfrom; - if (_from) gprev = _from->getOpposite(gcurr); - } - Vertex* prev = gprev->getObserver(GCell::Observable::Vertex);*/ + GCell* gcurr = getGCell(); + GCell* gnext = next->getGCell(); + DbU::Unit x = 0; + DbU::Unit y = 0; + IntervalC intervfrom = IntervalC(); + if (_adata == NULL){ + cdebug_log(112,1) << "Point Vertex::getStartPathPoint( const Vertex* next ) const: GRAData unset." << endl; + return Point(0,0); + } if (gcurr->isDevice ()){ cdebug_log(112,0) << "Case device" << endl; if (isH()){ - cdebug_log(112,0) << "hinterval: " << DbU::getValueString(interv->getAxis()) << endl; - y = interv->getAxis(); - if ((gnext->getXMax() < interv->getMin())||(isWest (next))) x = interv->getMin(); - else if ((gnext->getXMin() > interv->getMax())||(isEast (next))) x = interv->getMax(); - else x = (max(gnext->getXMin(), interv->getMin())+min(gnext->getXMax(), interv->getMax()))/2; + cdebug_log(112,0) << "hinterval: " << DbU::getValueString(getIAxis()) << endl; + y = getIAxis(); + if ((gnext->getXMax() < getIMin())||(isWest (next))) x = getIMin(); + else if ((gnext->getXMin() > getIMax())||(isEast (next))) x = getIMax(); + else x = (max(gnext->getXMin(), getIMin())+min(gnext->getXMax(), getIMax()))/2; } else if (isV()){ cdebug_log(112,0) << "vinterval" << endl; - x = interv->getAxis(); - if ((gnext->getYMax() < interv->getMin())||(isSouth(next))) y = interv->getMin(); - else if ((gnext->getYMin() > interv->getMax())||(isNorth(next))) y = interv->getMax(); - else y = (max(gnext->getYMin(), interv->getMin())+min(gnext->getYMax(), interv->getMax()))/2 ; + x = getIAxis(); + if ((gnext->getYMax() < getIMin())||(isSouth(next))) y = getIMin(); + else if ((gnext->getYMin() > getIMax())||(isNorth(next))) y = getIMax(); + else y = (max(gnext->getYMin(), getIMin())+min(gnext->getYMax(), getIMax()))/2 ; } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; + cdebug_log(112,0) << "[ERROR](Point Vertex::getStartPathPoint( const Vertex * next ) const: Something is wrong." << endl; cdebug_tabw(112,-1); return Point(0,0); } } else if (isH()) { - cdebug_log(112,0) << "Case horizontal: " << isiSet() << endl; - GCell* gprev = NULL; - if (isFrom2Mode()){ - cdebug_log(112,0) << "UseFrom2Mode" << endl; - intervfrom = _intervfrom2; - if (_from2) gprev = _from2->getOpposite(gcurr); - } else { - cdebug_log(112,0) << "UseFrom1Mode" << endl; - intervfrom = _intervfrom; - if (_from) gprev = _from->getOpposite(gcurr); - } + cdebug_log(112,0) << "Case horizontal: " << isiSet() << endl; + GCell* gprev = getGPrev(Vertex::From2Mode); + intervfrom = getIntervFrom(From2Mode); Vertex* prev = gprev->getObserver(GCell::Observable::Vertex); cdebug_log(112,0) << "PREV: " << prev << " "; - intervfrom->print(); - - + intervfrom.print(); + if (isiSet()){ cdebug_log(112,0) << "isiSet: "; - interv->print(); - y = interv->getAxis(); - if ((gnext->getXMax() < interv->getMin())||(isWest (next))) x = interv->getMin(); - else if ((gnext->getXMin() > interv->getMax())||(isEast (next))) x = interv->getMax(); - else x = (max(gnext->getXMin(), interv->getMin())+min(gnext->getXMax(), interv->getMax()))/2; + printInterv(); + y = getIAxis(); + if ((gnext->getXMax() < getIMin())||(isWest (next))) x = getIMin(); + else if ((gnext->getXMin() > getIMax())||(isEast (next))) x = getIMax(); + else x = (max(gnext->getXMin(), getIMin())+min(gnext->getXMax(), getIMax()))/2; } else { if (prev->isH()){ cdebug_log(112,0) << "prev is H" << endl; - if (gnext->getXMax() < intervfrom->getMin()) x = intervfrom->getMin(); - else if (gnext->getXMin() > intervfrom->getMax()) x = intervfrom->getMax(); - else x = (max(gnext->getXMin(), intervfrom->getMin())+min(gnext->getXMax(), intervfrom->getMax()))/2; + if (gnext->getXMax() < intervfrom.getMin()) x = intervfrom.getMin(); + else if (gnext->getXMin() > intervfrom.getMax()) x = intervfrom.getMax(); + else x = (max(gnext->getXMin(), intervfrom.getMin())+min(gnext->getXMax(), intervfrom.getMax()))/2; if (isNorth(prev)) y = gcurr->getYMax(); else if (isSouth(prev)) y = gcurr->getYMin(); - else y = intervfrom->getAxis(); - - /*if (isNorth(prev)){ - x = (max(intervfrom->getMin(), gcurr->getXMin())+min(intervfrom->getMax(), gcurr->getXMax()))/2 ; - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - x = (max(intervfrom->getMin(), gcurr->getXMin())+min(intervfrom->getMax(), gcurr->getXMax()))/2 ; - y = gcurr->getYMin(); - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = intervfrom->getAxis(); - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = intervfrom->getAxis(); - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - cdebug_tabw(112,-1); - return Point(0,0); - }*/ + else y = intervfrom.getAxis(); } else if (prev->isV()){ cdebug_log(112,0) << "prev is V" << endl; if (isNorth(prev)){ - cdebug_log(112,0) << "1" << endl; - x = intervfrom->getAxis(); + //cdebug_log(112,0) << "1" << endl; + x = intervfrom.getAxis(); y = gcurr->getYMax(); } else if (isSouth(prev)){ - cdebug_log(112,0) << "2" << endl; - x = intervfrom->getAxis(); + //cdebug_log(112,0) << "2" << endl; + x = intervfrom.getAxis(); y = gcurr->getYMin(); } else if (isWest (prev)){ - cdebug_log(112,0) << "3" << endl; + //cdebug_log(112,0) << "3" << endl; x = gcurr->getXMin(); if (isNorth(next)){ - if (intervfrom->getMax() > gcurr->getYMax()) y = gcurr->getYMax(); - else y = intervfrom->getMax(); + if (intervfrom.getMax() > gcurr->getYMax()) y = gcurr->getYMax(); + else y = intervfrom.getMax(); } else if (isSouth(next)){ - if (intervfrom->getMin() < gcurr->getYMin()) y = gcurr->getYMin(); - else y = intervfrom->getMin(); + if (intervfrom.getMin() < gcurr->getYMin()) y = gcurr->getYMin(); + else y = intervfrom.getMin(); } else { // East side - if ( intervfrom->getMin() < gcurr->getYMin() ){ y = gcurr->getYMin(); - } else if ( intervfrom->getMax() > gcurr->getYMax() ){ y = gcurr->getYMax(); - } else { y = (intervfrom->getMin() + intervfrom->getMax())/2 ; + if ( intervfrom.getMin() < gcurr->getYMin() ){ y = gcurr->getYMin(); + } else if ( intervfrom.getMax() > gcurr->getYMax() ){ y = gcurr->getYMax(); + } else { y = (intervfrom.getMin() + intervfrom.getMax())/2 ; } } - /*if ( intervfrom->getMin() > gcurr->getYMax() ){ - y = gcurr->getYMax(); - } else if ( intervfrom->getMax() < gcurr->getYMin() ){ - y = gcurr->getYMin(); - } else { - y = (max(intervfrom->getMin(), gcurr->getYMin())+min(intervfrom->getMax(), gcurr->getYMax()))/2 ; - }*/ } else if (isEast (prev)){ - cdebug_log(112,0) << "4" << endl; + //cdebug_log(112,0) << "4" << endl; x = gcurr->getXMax(); if (isNorth(next)){ - if (intervfrom->getMax() > gcurr->getYMax()) y = gcurr->getYMax(); - else y = intervfrom->getMax(); + if (intervfrom.getMax() > gcurr->getYMax()) y = gcurr->getYMax(); + else y = intervfrom.getMax(); } else if (isSouth(next)){ - if (intervfrom->getMin() < gcurr->getYMin()) y = gcurr->getYMin(); - else y = intervfrom->getMin(); + if (intervfrom.getMin() < gcurr->getYMin()) y = gcurr->getYMin(); + else y = intervfrom.getMin(); } else { // West side - if ( intervfrom->getMin() < gcurr->getYMin() ){ y = gcurr->getYMin(); - } else if ( intervfrom->getMax() > gcurr->getYMax() ){ y = gcurr->getYMax(); - } else { y = (intervfrom->getMin() + intervfrom->getMax())/2 ; + if ( intervfrom.getMin() < gcurr->getYMin() ){ y = gcurr->getYMin(); + } else if ( intervfrom.getMax() > gcurr->getYMax() ){ y = gcurr->getYMax(); + } else { y = (intervfrom.getMin() + intervfrom.getMax())/2 ; } } - /*if ( intervfrom->getMin() > gcurr->getYMax() ){ - y = gcurr->getYMax(); - } else if ( intervfrom->getMax() < gcurr->getYMin() ){ - y = gcurr->getYMin(); - } else { - y = (max(intervfrom->getMin(), gcurr->getYMin())+min(intervfrom->getMax(), gcurr->getYMax()))/2 ; - }*/ } else { cdebug_log(112,0) << "[ERROR](Point Vertex::getStartPathPoint() const: Something is wrong." << endl; cdebug_tabw(112,-1); @@ -503,35 +497,25 @@ namespace Anabatic { } } else if (isV()) { cdebug_log(112,0) << "Case vertical: " << isiSet() << endl; - GCell* gprev = NULL; - if (isFrom2Mode()){ - cdebug_log(112,0) << "UseFrom2Mode" << endl; - intervfrom = _intervfrom2; - if (_from2) gprev = _from2->getOpposite(gcurr); - } else { - cdebug_log(112,0) << "UseFrom1Mode" << endl; - intervfrom = _intervfrom; - if (_from) gprev = _from->getOpposite(gcurr); - } + //GCell* gprev = NULL; + GCell* gprev = getGPrev(Vertex::From2Mode); + intervfrom = getIntervFrom(From2Mode); Vertex* prev = gprev->getObserver(GCell::Observable::Vertex); cdebug_log(112,0) << "PREV: " << prev << " "; - intervfrom->print(); + intervfrom.print(); if (isiSet()){ cdebug_log(112,0) << "isiSet: "; - interv->print(); - x = interv->getAxis(); - if ((gnext->getYMax() <= interv->getMin())||(isSouth(next))){ - y = interv->getMin(); - cdebug_log(112,0) << "1" << endl; + printInterv(); + x = getIAxis(); + if ((gnext->getYMax() <= getIMin())||(isSouth(next))){ + y = getIMin(); } - else if ((gnext->getYMin() >= interv->getMax())||(isNorth(next))){ - y = interv->getMax(); - cdebug_log(112,0) << "2" << endl; + else if ((gnext->getYMin() >= getIMax())||(isNorth(next))){ + y = getIMax(); } else { - y = (max(gnext->getYMin(), interv->getMin())+min(gnext->getYMax(), interv->getMax()))/2 ; - cdebug_log(112,0) << "3" << endl; + y = (max(gnext->getYMin(), getIMin())+min(gnext->getYMax(), getIMax()))/2 ; } } else { if (prev->isH()){ @@ -539,54 +523,37 @@ namespace Anabatic { if (isNorth(prev)){ y = gcurr->getYMax(); if (isNorth(next)){ - if (intervfrom->getMax() > gcurr->getXMax()) x = gcurr->getXMax(); - else x = intervfrom->getMax(); + if (intervfrom.getMax() > gcurr->getXMax()) x = gcurr->getXMax(); + else x = intervfrom.getMax(); } else if (isSouth(next)){ - if (intervfrom->getMin() < gcurr->getXMin()) x = gcurr->getXMin(); - else x = intervfrom->getMin(); + if (intervfrom.getMin() < gcurr->getXMin()) x = gcurr->getXMin(); + else x = intervfrom.getMin(); } else { // West side - if ( intervfrom->getMin() < gcurr->getXMin() ){ x = gcurr->getXMin(); - } else if ( intervfrom->getMax() > gcurr->getXMax() ){ x = gcurr->getXMax(); - } else { x = (intervfrom->getMin() + intervfrom->getMax())/2 ; + if ( intervfrom.getMin() < gcurr->getXMin() ){ x = gcurr->getXMin(); + } else if ( intervfrom.getMax() > gcurr->getXMax() ){ x = gcurr->getXMax(); + } else { x = (intervfrom.getMin() + intervfrom.getMax())/2 ; } } - /*y = gcurr->getYMax(); - if ( intervfrom->getMin() > gcurr->getXMax() ){ - x = gcurr->getXMax(); - } else if ( intervfrom->getMax() < gcurr->getXMin() ){ - x = gcurr->getXMin(); - } else { - x = (max(intervfrom->getMin(), gcurr->getXMin())+min(intervfrom->getMax(), gcurr->getXMax()))/2 ; - }*/ } else if (isSouth(prev)){ y = gcurr->getYMin(); if (isEast(next)){ - if (intervfrom->getMax() > gcurr->getXMax()) x = gcurr->getXMax(); - else x = intervfrom->getMax(); + if (intervfrom.getMax() > gcurr->getXMax()) x = gcurr->getXMax(); + else x = intervfrom.getMax(); } else if (isWest(next)){ - if (intervfrom->getMin() < gcurr->getXMin()) x = gcurr->getXMin(); - else x = intervfrom->getMin(); + if (intervfrom.getMin() < gcurr->getXMin()) x = gcurr->getXMin(); + else x = intervfrom.getMin(); } else { // Northside - if ( intervfrom->getMin() < gcurr->getXMin() ){ x = gcurr->getXMin(); - } else if ( intervfrom->getMax() > gcurr->getXMax() ){ x = gcurr->getXMax(); - } else { x = (intervfrom->getMin() + intervfrom->getMax())/2 ; + if ( intervfrom.getMin() < gcurr->getXMin() ){ x = gcurr->getXMin(); + } else if ( intervfrom.getMax() > gcurr->getXMax() ){ x = gcurr->getXMax(); + } else { x = (intervfrom.getMin() + intervfrom.getMax())/2 ; } } - - /*y = gcurr->getYMin(); - if ( intervfrom->getMin() > gcurr->getXMax() ){ - x = gcurr->getXMax(); - } else if ( intervfrom->getMax() < gcurr->getXMin() ){ - x = gcurr->getXMin(); - } else { - x = (max(intervfrom->getMin(), gcurr->getXMin())+min(intervfrom->getMax(), gcurr->getXMax()))/2 ; - }*/ } else if (isWest (prev)){ x = gcurr->getXMin(); - y = intervfrom->getAxis(); + y = intervfrom.getAxis(); } else if (isEast (prev)){ x = gcurr->getXMax(); - y = intervfrom->getAxis(); + y = intervfrom.getAxis(); } else { cdebug_log(112,0) << "[ERROR](Point Vertex::getStartPathPoint() const: Something is wrong." << endl; cdebug_tabw(112,-1); @@ -594,31 +561,14 @@ namespace Anabatic { } } else if (prev->isV()){ cdebug_log(112,0) << "prev is V" << endl; - if (gnext->getYMax() < intervfrom->getMin()) { y = intervfrom->getMin(); - } else if (gnext->getYMin() > intervfrom->getMax()){ y = intervfrom->getMax(); - } else{ y = (max(gnext->getYMin(), intervfrom->getMin())+min(gnext->getYMax(), intervfrom->getMax()))/2; + if (gnext->getYMax() < intervfrom.getMin()) { y = intervfrom.getMin(); + } else if (gnext->getYMin() > intervfrom.getMax()){ y = intervfrom.getMax(); + } else{ y = (max(gnext->getYMin(), intervfrom.getMin())+min(gnext->getYMax(), intervfrom.getMax()))/2; } if (isEast(prev)) x = gcurr->getXMax(); else if (isWest(prev)) x = gcurr->getXMin(); - else x = intervfrom->getAxis(); - - /*if (isNorth(prev)){ - x = intervfrom->getAxis(); - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - x = intervfrom->getAxis(); - y = gcurr->getYMin(); - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = (max(intervfrom->getMin(), gcurr->getYMin())+min(intervfrom->getMax(), gcurr->getYMax()))/2 ; - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = (max(intervfrom->getMin(), gcurr->getYMin())+min(intervfrom->getMax(), gcurr->getYMax()))/2 ; - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getStartPathPoint() const: Something is wrong." << endl; - return Point(0,0); - }*/ + else x = intervfrom.getAxis(); } else { cdebug_log(112,0) << "[ERROR](Point Vertex::getStartPathPoint() const: Something is wrong." << endl; cdebug_tabw(112,-1); @@ -635,283 +585,10 @@ namespace Anabatic { } - Point Vertex::getNextPathPoint2( const Vertex* vcurr, const Vertex* vnext ) - { - //cdebug_log(112,0) << "Point Dijkstra::getNextPathPoint( const Vertex* current, const Vertex* next )" << endl; - if ((vcurr == NULL) || (vnext == NULL)){ - //cdebug_log(112,0) << "[ERROR](Point Dijkstra::_getNextPathPoint( const Vertex*, const Vertex* )): Unvalid NULL argument."<< endl; - return Point(0,0); - } - - if (vnext->getGCell()->isMatrix()) { - return Point(vnext->getGCell()->getXCenter(), vnext->getGCell()->getYCenter()); - } - - Point pcurr = vcurr->getPathPoint(vnext); - GCell* gnext = vnext->getGCell(); - GCell* gcurr = vcurr->getGCell(); - DbU::Unit x = 0; - DbU::Unit y = 0; - - - if (vnext->isV()){ - //cdebug_log(112,0) << "Case next: Vertical: " << vnext->isiSet() << endl; //", d:" << vnext->getDistance() << endl; - if ((vnext->isiSet())&&(vnext->hasValidStamp())){ - //cdebug_log(112,0) << "Case set" << endl; - x = vnext->getIAxis(); - if (vcurr->isNorth(vnext)) y = vnext->getIMin(); - else if (vcurr->isSouth(vnext)) y = vnext->getIMax(); - else if ((vcurr->isWest(vnext))||(vcurr->isEast(vnext))) { - if ( pcurr.getY() > vnext->getIMax() ) y = vnext->getIMax(); - else if ( pcurr.getY() < vnext->getIMin() ) y = vnext->getIMin(); - else y = pcurr.getY(); - } else cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.1" << endl; - } else { - //cdebug_log(112,0) << "Case not set" << endl; - if (vcurr->isNorth(vnext)){ - y = gcurr->getYMax(); - if (pcurr.getX() < gnext->getXMin()) x = gnext->getXMin(); - else if (pcurr.getX() > gnext->getXMax()) x = gnext->getXMax(); - else x = pcurr.getX(); - } else if (vcurr->isSouth(vnext)){ - y = gcurr->getYMin(); - if (pcurr.getX() < gnext->getXMin()) x = gnext->getXMin(); - else if (pcurr.getX() > gnext->getXMax()) x = gnext->getXMax(); - else x = pcurr.getX(); - } else if (vcurr->isWest(vnext)){ - x = gcurr->getXMin(); - if (pcurr.getY() < gnext->getYMin()) y = gnext->getYMin(); - else if (pcurr.getY() > gnext->getYMax()) y = gnext->getYMax(); - else y = pcurr.getY(); - - } else if (vcurr->isEast(vnext)){ - x = gcurr->getXMax(); - if (pcurr.getY() < gnext->getYMin()) y = gnext->getYMin(); - else if (pcurr.getY() > gnext->getYMax()) y = gnext->getYMax(); - else y = pcurr.getY(); - } else cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.2" << endl; - } - - } else if (vnext->isH()) { - //cdebug_log(112,0) << "Case next: Horizontal: " << vnext->isiSet() << endl; //", d:" << vnext->getDistance() << endl; - - if ((vnext->isiSet())&&(vnext->hasValidStamp())){ - //cdebug_log(112,0) << "Case set" << endl; - y = vnext->getIAxis(); - if (vcurr->isEast (vnext)) x = vnext->getIMin(); - else if (vcurr->isWest (vnext)) x = vnext->getIMax(); - else if ((vcurr->isNorth(vnext))||(vcurr->isSouth(vnext))) { - if ( pcurr.getX() > vnext->getIMax() ) x = vnext->getIMax(); - else if ( pcurr.getX() < vnext->getIMin() ) x = vnext->getIMin(); - else x = pcurr.getX(); - } else cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.3" << endl; - - } else { - //cdebug_log(112,0) << "Case not set" << endl; - if (vcurr->isNorth(vnext)){ - y = gcurr->getYMax(); - if (pcurr.getX() < gnext->getXMin()) x = gnext->getXMin(); - else if (pcurr.getX() > gnext->getXMax()) x = gnext->getXMax(); - else x = pcurr.getX(); - } else if (vcurr->isSouth(vnext)){ - y = gcurr->getYMin(); - if (pcurr.getX() < gnext->getXMin()) x = gnext->getXMin(); - else if (pcurr.getX() > gnext->getXMax()) x = gnext->getXMax(); - else x = pcurr.getX(); - } else if (vcurr->isWest(vnext)){ - x = gcurr->getXMin(); - if (pcurr.getY() < gnext->getYMin()) y = gnext->getYMin(); - else if (pcurr.getY() > gnext->getYMax()) y = gnext->getYMax(); - else y = pcurr.getY(); - - } else if (vcurr->isEast(vnext)){ - x = gcurr->getXMax(); - if (pcurr.getY() < gnext->getYMin()) y = gnext->getYMin(); - else if (pcurr.getY() > gnext->getYMax()) y = gnext->getYMax(); - else y = pcurr.getY(); - } else cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.4" << endl; - } - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getNextPathPoint2(...) const: Something is wrong.5" << endl; - } - return Point(x,y); - } - - - Point Vertex::getPathPoint( const Vertex* next ) const - { - cdebug_log(112,0) << "Point Vertex::getPathPoint( const Vertex* next ) const:" << this << endl; - - GCell* gcurr = getGCell(); - GCell* gnext = next->getGCell(); - DbU::Unit x = 0; - DbU::Unit y = 0; - - - if (gcurr->isDevice ()){ - cdebug_log(112,0) << "Case device" << endl; - if (isH()){ - cdebug_log(112,0) << "hinterval: " << DbU::getValueString(_interv->getAxis()) << endl; - y = _interv->getAxis(); - if ((gnext->getXMax() < _interv->getMin())||(isWest (next))) x = _interv->getMin(); - else if ((gnext->getXMin() > _interv->getMax())||(isEast (next))) x = _interv->getMax(); - else x = (max(gnext->getXMin(), _interv->getMin())+min(gnext->getXMax(), _interv->getMax()))/2; - - } else if (isV()){ - cdebug_log(112,0) << "vinterval" << endl; - x = _interv->getAxis(); - if ((gnext->getYMax() < _interv->getMin())||(isSouth(next))) y = _interv->getMin(); - else if ((gnext->getYMin() > _interv->getMax())||(isNorth(next))) y = _interv->getMax(); - else y = (max(gnext->getYMin(), _interv->getMin())+min(gnext->getYMax(), _interv->getMax()))/2 ; - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } else if (isH()) { - cdebug_log(112,0) << "Case horizontal: " << isiSet() << endl; - GCell* gprev = getFrom()->getOpposite(gcurr); - Vertex* prev = gprev->getObserver(GCell::Observable::Vertex); - if (isiSet()){ - cdebug_log(112,0) << "isiSet" << endl; - y = _interv->getAxis(); - if ((gnext->getXMax() < _interv->getMin())||(isWest (next))) x = _interv->getMin(); - else if ((gnext->getXMin() > _interv->getMax())||(isEast (next))) x = _interv->getMax(); - else x = (max(gnext->getXMin(), _interv->getMin())+min(gnext->getXMax(), _interv->getMax()))/2; - } else { - if (prev->isH()){ - cdebug_log(112,0) << "prev is H" << endl; - if (isNorth(prev)){ - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - y = gcurr->getYMin(); - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = _intervfrom->getAxis(); - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = _intervfrom->getAxis(); - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } else if (prev->isV()){ - cdebug_log(112,0) << "prev is V" << endl; - if (isNorth(prev)){ - //cdebug_log(112,0) << "1" << endl; - x = _intervfrom->getAxis(); - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - //cdebug_log(112,0) << "2" << endl; - x = _intervfrom->getAxis(); - y = gcurr->getYMin(); - } else if (isWest (prev)){ - //cdebug_log(112,0) << "3" << endl; - x = gcurr->getXMin(); - if ( _intervfrom->getMin() > gcurr->getYMax() ){ - y = gcurr->getYMax(); - } else if ( _intervfrom->getMax() < gcurr->getYMin() ){ - y = gcurr->getYMin(); - } else { - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } - } else if (isEast (prev)){ - //cdebug_log(112,0) << "4" << endl; - x = gcurr->getXMax(); - if ( _intervfrom->getMin() > gcurr->getYMax() ){ - y = gcurr->getYMax(); - } else if ( _intervfrom->getMax() < gcurr->getYMin() ){ - y = gcurr->getYMin(); - } else { - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - cdebug_log(112,0) << "x: " << DbU::getValueString(x) << ", y:" << DbU::getValueString(y) << endl; - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } - } else if (isV()) { - cdebug_log(112,0) << "Case V: " << isiSet() << endl; - GCell* gprev = getFrom()->getOpposite(gcurr); - Vertex* prev = gprev->getObserver(GCell::Observable::Vertex); - if (isiSet()){ - cdebug_log(112,0) << "isiSet" << endl; - x = _interv->getAxis(); - if ((gnext->getYMax() < _interv->getMin())||(isSouth(next))) y = _interv->getMin(); - else if ((gnext->getYMin() > _interv->getMax())||(isNorth(next))) y = _interv->getMax(); - else y = (max(gnext->getYMin(), _interv->getMin())+min(gnext->getYMax(), _interv->getMax()))/2 ; - } else { - if (prev->isH()){ - cdebug_log(112,0) << "prev is H" << endl; - if (isNorth(prev)){ - y = gcurr->getYMax(); - if ( _intervfrom->getMin() > gcurr->getXMax() ){ - x = gcurr->getXMax(); - } else if ( _intervfrom->getMax() < gcurr->getXMin() ){ - x = gcurr->getXMin(); - } else { - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - } - } else if (isSouth(prev)){ - y = gcurr->getYMin(); - if ( _intervfrom->getMin() > gcurr->getXMax() ){ - x = gcurr->getXMax(); - } else if ( _intervfrom->getMax() < gcurr->getXMin() ){ - x = gcurr->getXMin(); - } else { - x = (max(_intervfrom->getMin(), gcurr->getXMin())+min(_intervfrom->getMax(), gcurr->getXMax()))/2 ; - } - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = _intervfrom->getAxis(); - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = _intervfrom->getAxis(); - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } else if (prev->isV()){ - cdebug_log(112,0) << "prev is V" << endl; - if (isNorth(prev)){ - x = _intervfrom->getAxis(); - y = gcurr->getYMax(); - } else if (isSouth(prev)){ - x = _intervfrom->getAxis(); - y = gcurr->getYMin(); - } else if (isWest (prev)){ - x = gcurr->getXMin(); - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } else if (isEast (prev)){ - x = gcurr->getXMax(); - y = (max(_intervfrom->getMin(), gcurr->getYMin())+min(_intervfrom->getMax(), gcurr->getYMax()))/2 ; - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - } - } else { - cdebug_log(112,0) << "[ERROR](Point Vertex::getPathPoint( Vertex * vertex ) const: Something is wrong." << endl; - return Point(0,0); - } - return Point(x,y); - } - - bool Vertex::isH() const { GCell* gcell = getGCell(); - if (gcell->isDevice()) return _interv->isH(); + if (gcell->isDevice()) return isiHorizontal(); else if (gcell->isHChannel()) return true; else if (gcell->isStrut()) return ((gcell->getWidth() > gcell->getHeight())||(gcell->getWidth() == gcell->getHeight())); else return false; @@ -921,7 +598,7 @@ namespace Anabatic { bool Vertex::isV() const { GCell* gcell = getGCell(); - if (gcell->isDevice()) return _interv->isV(); + if (gcell->isDevice()) return isiVertical(); else if (gcell->isVChannel()) return true; else if (gcell->isStrut()) return gcell->getWidth() < gcell->getHeight(); else return false; @@ -931,56 +608,19 @@ namespace Anabatic { void Vertex::setIntervals ( Vertex* vcurr ) { cdebug_log(112,1) << "!SETINTERVALS! ( Vertex* vcurr )" << endl; - //Point pcurr = vcurr->getPathPoint(this); Point pcurr; if (isFromFrom2()){ - vcurr->setFrom2Mode(); + vcurr->setFlags(Vertex::From2Mode); pcurr = vcurr->getStartPathPoint(this); - vcurr->unsetFrom2Mode(); + vcurr->unsetFlags(Vertex::From2Mode); } else { pcurr = vcurr->getStartPathPoint(this); } - //Point pnext = Vertex::getNextPathPoint2( vcurr, this ); Point pnext = vcurr->getNextPathPoint( pcurr, this ); cdebug_log(112,0) << "Pcurrent : X:" << DbU::getValueString(pcurr.getX()) << ", Y:" << DbU::getValueString(pcurr.getY()) << endl; cdebug_log(112,0) << "Pneighbour: X:" << DbU::getValueString(pnext.getX()) << ", Y:" << DbU::getValueString(pnext.getY()) << endl; DbU::Unit min, max, axis; - /*if (vcurr->isH()){ - if (isH()){ - if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ - } else { - } - } else if (isV()){ - if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ - } else { - } - } else { - cdebug_log(112,0) << "[ERROR](void Vertex::setIntervals(...)): Something is wrong." << endl; - return; - } - } else if (vcurr->isV()){ - if (isH()){ - if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ - } else { - } - } else if (isV()){ - if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ - } else { - } - } else { - cdebug_log(112,0) << "[ERROR](void Vertex::setIntervals(...)): Something is wrong." << endl; - return; - } - } else { - cdebug_log(112,0) << "[ERROR](void Vertex::setIntervals(...)): Something is wrong." << endl; - return; - }*/ - - - - - /////////////////////////// if (vcurr->isH()){ cdebug_log(112,0) << "case vcurr: Horizontal" << endl; if ((vcurr->isiSet())&&(vcurr->hasValidStamp())){ @@ -1003,11 +643,7 @@ namespace Anabatic { axis = pcurr.getY(); bool hh = false; if (vcurr->hasValidStamp() && (vcurr->getFrom() != NULL)){ - GCell* gcurr = vcurr->getGCell(); - GCell* gprev = vcurr->getFrom()->getOpposite(gcurr); - if (vcurr->getFrom2() != NULL){ - if (isFromFrom2()) gprev = vcurr->getFrom2()->getOpposite(gcurr); - } + GCell* gprev = vcurr->getGPrev(Vertex::UseFromFrom2); Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); if (vprev->isH()) { cdebug_log(112,0) << "----------------------------" << endl; @@ -1022,44 +658,29 @@ namespace Anabatic { if (hh){ GCell* gcurr = vcurr->getGCell(); GCell* gnext = getGCell(); - //Vertex* vcurr = gcurr->getObserver(GCell::Observable::Vertex); - IntervalC* intervfrom = vcurr->getIntervFrom(); - if (vcurr->getFrom2() != NULL){ - if (isFromFrom2()) intervfrom = vcurr->getIntervFrom2(); - } - - if (gnext->getXMin() > intervfrom->getMax()){ - cdebug_log(112,0) << "1" << endl; - min = intervfrom->getMax(); + IntervalC intervfrom = vcurr->getIntervFrom(UseFromFrom2); + vcurr->printIntervfrom(); + + if (gnext->getXMin() > intervfrom.getMax()){ + //cdebug_log(112,0) << "1" << endl; + min = intervfrom.getMax(); max = gnext->getXMin(); - } else if (gnext->getXMax() < intervfrom->getMin()){ - cdebug_log(112,0) << "2" << endl; + } else if (gnext->getXMax() < intervfrom.getMin()){ + //cdebug_log(112,0) << "2" << endl; min = gnext->getXMax(); - max = intervfrom->getMin(); + max = intervfrom.getMin(); } else { - cdebug_log(112,0) << "3" << endl; - min = std::max(gcurr->getXMin(), intervfrom->getMin()); - max = std::min(gcurr->getXMax(), intervfrom->getMax()); + //cdebug_log(112,0) << "3" << endl; + min = std::max(gcurr->getXMin(), intervfrom.getMin()); + max = std::min(gcurr->getXMax(), intervfrom.getMax()); } - - - /*GCell* gcurr = vcurr->getGCell(); - Vertex* vcurr = gcurr->getObserver(GCell::Observable::Vertex); - min = std::max(gcurr->getXMin(), vcurr->getPIMin()); - max = std::min(gcurr->getXMax(), vcurr->getPIMax()); - if (vcurr->getFrom2() != NULL){ - if (isFromFrom2()){ - min = std::max(gcurr->getXMin(), vcurr->getPIMin2()); - max = std::min(gcurr->getXMax(), vcurr->getPIMax2()); - } - }*/ } else { if (pcurr.getX() < pnext.getX()){ - cdebug_log(112,0) << "4" << endl; + //cdebug_log(112,0) << "4" << endl; min = pcurr.getX(); max = pnext.getX(); } else { - cdebug_log(112,0) << "5" << endl; + //cdebug_log(112,0) << "5" << endl; max = pcurr.getX(); min = pnext.getX(); } @@ -1089,11 +710,7 @@ namespace Anabatic { axis = pcurr.getX(); bool vv = false; if (vcurr->hasValidStamp() && (vcurr->getFrom() != NULL)){ - GCell* gcurr = vcurr->getGCell(); - GCell* gprev = vcurr->getFrom()->getOpposite(gcurr); - if (vcurr->getFrom2() != NULL){ - if (isFromFrom2()) gprev = vcurr->getFrom2()->getOpposite(gcurr); - } + GCell* gprev = vcurr->getGPrev(Vertex::UseFromFrom2); Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); if ((vprev->isV())) { cdebug_log(112,0) << "----------------------------" << endl; @@ -1108,40 +725,27 @@ namespace Anabatic { if (vv){ GCell* gcurr = vcurr->getGCell(); GCell* gnext = getGCell(); - //Vertex* vcurr = gcurr->getObserver(GCell::Observable::Vertex); - IntervalC* intervfrom = vcurr->getIntervFrom(); - if (vcurr->getFrom2() != NULL){ - if (isFromFrom2()) intervfrom = vcurr->getIntervFrom2(); - } - if (gnext->getYMin() > intervfrom->getMax()){ - cdebug_log(112,0) << "1" << endl; - min = intervfrom->getMax(); + IntervalC intervfrom = vcurr->getIntervFrom(UseFromFrom2); + if (gnext->getYMin() > intervfrom.getMax()){ + //cdebug_log(112,0) << "1" << endl; + min = intervfrom.getMax(); max = gnext->getYMin(); - } else if (gnext->getYMax() < intervfrom->getMin()){ - cdebug_log(112,0) << "2" << endl; + } else if (gnext->getYMax() < intervfrom.getMin()){ + //cdebug_log(112,0) << "2" << endl; min = gnext->getYMax(); - max = intervfrom->getMin(); + max = intervfrom.getMin(); } else { - cdebug_log(112,0) << "3" << endl; - min = std::max(gcurr->getYMin(), intervfrom->getMin()); - max = std::min(gcurr->getYMax(), intervfrom->getMax()); + //cdebug_log(112,0) << "3" << endl; + min = std::max(gcurr->getYMin(), intervfrom.getMin()); + max = std::min(gcurr->getYMax(), intervfrom.getMax()); } - /* - min = std::max(gcurr->getYMin(), vcurr->getPIMin()); - max = std::min(gcurr->getYMax(), vcurr->getPIMax()); - if (vcurr->getFrom2() != NULL){ - if (isFromFrom2()){ - min = std::max(gcurr->getYMin(), vcurr->getPIMin2()); - max = std::min(gcurr->getYMax(), vcurr->getPIMax2()); - } - }*/ } else { if (pcurr.getY() < pnext.getY()){ - cdebug_log(112,0) << "4" << endl; + //cdebug_log(112,0) << "4" << endl; min = pcurr.getY(); max = pnext.getY(); } else { - cdebug_log(112,0) << "5" << endl; + //cdebug_log(112,0) << "5" << endl; max = pcurr.getY(); min = pnext.getY(); } @@ -1156,22 +760,16 @@ namespace Anabatic { if (isFrom2Mode()) { cdebug_log(112,0) << "SetIntervfrom2" << endl; - _intervfrom2->set( min, max, axis ); + setIntervfrom2(min, max, axis); } else { cdebug_log(112,0) << "SetIntervfrom" << endl; - _intervfrom->set ( min, max, axis ); + setIntervfrom(min, max, axis); } cdebug_tabw(112,-1); } - - void Vertex::resetIntervals() - { - _interv->reset(); - _intervfrom->reset(); - } - + bool Vertex::areSameSide ( const Vertex* v1, const Vertex* v2 ) const { if ( (isNorth(v1) and isNorth(v2)) @@ -1183,6 +781,320 @@ namespace Anabatic { } + void Vertex::createAData() + { + if (_adata == NULL) _adata = GRAData::create(); + } + + + bool Vertex::isiSet() const + { + if (_adata){ + return _adata->isiSet(); + } else { + cdebug_log(112,1) << "bool Vertex::isiSet() const: Inappropriate usage of GRAData. " << endl; + return false; + } + } + + + DbU::Unit Vertex::getIAxis() const + { + if (_adata){ + return _adata->getIAxis(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getIAxis() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getIMax() const + { + if (_adata){ + return _adata->getIMax(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getIMax() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getIMin() const + { + if (_adata){ + return _adata->getIMin(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getIMin() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getPIAxis() const + { + if (_adata){ + return _adata->getPIAxis(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getPIAxis() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getPIMax() const + { + if (_adata){ + return _adata->getPIMax(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getPIMax() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getPIMin() const + { + if (_adata){ + return _adata->getPIMin(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getPIMin() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + void Vertex::setInterv( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) + { + if (_adata){ + _adata->setInterv(min, max, axis); + } else { + cdebug_log(112,1) << "void Vertex::setInterv( DbU::Unit min, DbU::Unit max, DbU::Unit axis ): Inappropriate usage of GRAData. " << endl; + } + } + + + void Vertex::setIntervfrom( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) + { + if (_adata){ + _adata->setIntervfrom(min, max, axis); + } else { + cdebug_log(112,1) << "void Vertex::setIntervfrom( DbU::Unit min, DbU::Unit max, DbU::Unit axis ): Inappropriate usage of GRAData. " << endl; + } + } + + + void Vertex::setIntervfrom2( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) + { + if (_adata){ + _adata->setIntervfrom2(min, max, axis); + } else { + cdebug_log(112,1) << "void Vertex::setIntervfrom2( DbU::Unit min, DbU::Unit max, DbU::Unit axis ): Inappropriate usage of GRAData. " << endl; + } + } + + + void Vertex::resetIntervals() + { + if (_adata){ + _adata->resetIntervals(); + } else { + cdebug_log(112,1) << "void Vertex::resetIntervals(): Inappropriate usage of GRAData. " << endl; + } + } + + + void Vertex::clearFrom2() + { + if (_adata){ + _adata->clearFrom2(); + } else { + cdebug_log(112,1) << "void Vertex::clearfrom2(): Inappropriate usage of GRAData. " << endl; + } + } + + + Edge* Vertex::getFrom2() const + { + if (_adata){ + return _adata->getFrom2(); + } else { + cdebug_log(112,1) << "Edge* Vertex::getFrom2() const: Inappropriate usage of GRAData. " << endl; + return NULL; + } + } + + + void Vertex::setFrom2( Edge* from ) + { + if (_adata){ + _adata->setFrom2(from); + } else { + cdebug_log(112,1) << "void Vertex::setFrom2( Edge* from ): Inappropriate usage of GRAData. " << endl; + } + } + + + void Vertex::createIntervFrom2() + { + if (_adata){ + //_adata->createIntervFrom2(); + } else { + cdebug_log(112,1) << "void Vertex::createIntervFrom2(): Inappropriate usage of GRAData. " << endl; + } + } + + + DbU::Unit Vertex::getPIMax2() const + { + if (_adata){ + return _adata->getPIMax2(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getPIMax2() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getPIMin2() const + { + if (_adata){ + return _adata->getPIMin2(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getPIMin2() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + DbU::Unit Vertex::getPIAxis2() const + { + if (_adata){ + return _adata->getPIAxis2(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getPIAxis2() const: Inappropriate usage of GRAData. " << endl; + return 0; + } + } + + + IntervalC Vertex::getIntervFrom2() const + { + if (_adata){ + return _adata->getIntervFrom2(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getIntervFrom2() const: Inappropriate usage of GRAData. " << endl; + return IntervalC(); + } + } + + + IntervalC Vertex::getIntervFrom( unsigned int criteria ) const + { + if (_adata){ + switch (criteria){ + case Vertex::From2Mode: + if ((isFrom2Mode())&&(getFrom2() != NULL)){ + cdebug_log(112,0) << "getIntervFrom:From2Mode:UseFrom2. " << endl; + return _adata->getIntervFrom2(); + } else { + cdebug_log(112,0) << "getIntervFrom:From2Mode:UseFrom1. " << endl; + return _adata->getIntervFrom(); + } + case Vertex::UseFromFrom2: + if ((isFromFrom2())&&(getFrom2() != NULL)){ + cdebug_log(112,0) << "getIntervFrom:UseFromFrom2:UseFrom2. " << endl; + return _adata->getIntervFrom2(); + } else { + cdebug_log(112,0) << "getIntervFrom:UseFromFrom2:UseFrom1. " << endl; + return _adata->getIntervFrom(); + } + case 0: + cdebug_log(112,0) << "getIntervFrom:Default:UseFrom1. " << endl; + return _adata->getIntervFrom(); + default: + cdebug_log(112,0) << "getIntervFrom:Default:UseFrom1. " << endl; + return _adata->getIntervFrom(); + } + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getIntervFrom(unsigned int criteria) const: Inappropriate usage of GRAData. " << endl; + return IntervalC(); + } + } + + + GCell* Vertex::getGPrev( unsigned int criteria ) const + { + if (_adata){ + switch (criteria){ + case Vertex::From2Mode: + if ((isFrom2Mode())&&(getFrom2() != NULL)){ + cdebug_log(112,0) << "getGPrev:From2Mode:UseFrom2. " << endl; + return _adata->getFrom2()->getOpposite(getGCell()); + } else { + cdebug_log(112,0) << "getGPrev:From2Mode:UseFrom1. " << endl; + if (_from) return getFrom()->getOpposite(getGCell()); + else return NULL; + } + case Vertex::UseFromFrom2: + if ((isFromFrom2())&&(getFrom2() != NULL)){ + cdebug_log(112,0) << "getGPrev:UseFromFrom2:UseFrom2. " << endl; + return _adata->getFrom2()->getOpposite(getGCell()); + } else { + cdebug_log(112,0) << "getGPrev:UseFromFrom2:UseFrom1. " << endl; + if (_from) return getFrom()->getOpposite(getGCell()); + else return NULL; + } + case 0: + cdebug_log(112,0) << "getGPrev:Default:UseFrom1. " << endl; + if (_from) return getFrom()->getOpposite(getGCell()); + else return NULL; + default: + cdebug_log(112,0) << "getGPrev:Default:UseFrom1. " << endl; + if (_from) return getFrom()->getOpposite(getGCell()); + else return NULL; + } + } else { + if (_from) return getFrom()->getOpposite(getGCell()); + else return NULL; + } + } + + + IntervalC Vertex::getInterv() const + { + if (_adata){ + return _adata->getInterv(); + } else { + cdebug_log(112,1) << "DbU::Unit Vertex::getInterv() const: Inappropriate usage of GRAData. " << endl; + return IntervalC(); + } + } + + + void Vertex::printInterv() const + { + if (_adata){ + _adata->printInterv(); + } else { + cdebug_log(112,1) << "void Vertex::printInterv() const: Inappropriate usage of GRAData. " << endl; + } + } + + + void Vertex::printIntervfrom() const + { + if (_adata){ + _adata->printIntervfrom(); + } else { + cdebug_log(112,1) << "void Vertex::printIntervfrom() const: Inappropriate usage of GRAData. " << endl; + } + } + +//////////////////////////////////////////////////////////////////// + + + string Vertex::_getString () const { if (not _gcell) { @@ -1203,12 +1115,12 @@ namespace Anabatic { /*+ "+" + getString(_branchId) + " stamp:" + (hasValidStamp() ? "valid" : "outdated")*/ + " from:" + ((_from) ? "set" : "NULL") - + " from2:" + ((_from2) ? "set" : "NULL") + //+ " from2:" + ((_adata) ? _adata->getFrom2() : "NULL") + " restricted:" + (isNRestricted() ? "N" : "-") + (isSRestricted() ? "S" : "-") + (isERestricted() ? "E" : "-") + (isWRestricted() ? "W" : "-") - + " isiSet:" +(isiSet() ? "1" : "0") + //+ " isiSet:" +(isiSet() ? "1" : "0") + ">"; return s; } @@ -1250,310 +1162,12 @@ namespace Anabatic { } - DbU::Unit Dijkstra::_getDistancetoRP( Point p ) - { - - cdebug_log(112,0) << "DbU::Unit Dijkstra::_getDistancetoRP( Point p ): " << p << endl; - RoutingPad* rp = NULL; - DbU::Unit dist = 0; - Cell* cell = _anabatic->getCell(); - int cpt = 0; - - /*for ( Vertex* vertex : _sources ) { - if (vertex->hasRP()){ - for ( Component* component : cell->getComponentsUnder(vertex->getGCell()->getBoundingBox()) ){ - rp = dynamic_cast( component ); - if (rp) break; - } - if (rp) { - cdebug_log(112,0) << "Vertex: " << vertex << endl; - dist += _estimatePtoRP(p, rp, vertex ); - } - } - }*/ - for ( Vertex* vertex : _targets ) { - if (vertex->hasRP(_net)){ - for ( Component* component : cell->getComponentsUnder(vertex->getGCell()->getBoundingBox()) ){ - rp = dynamic_cast( component ); - if (rp) { - if (rp->getNet() == _net) break; - } - } - if (rp) { - DbU::Unit distance = _estimatePtoRP(p, rp, vertex ); - cdebug_log(112,0) << "Dist to Vertex: " << vertex << " IS = " << DbU::getValueString(distance) << endl; - dist += distance; - cpt++; - } - } - } - if (cpt != 0) dist = dist/cpt; - else dist = Vertex::unreachable; - return dist; - } - - DbU::Unit calcDistance( Point p1, Point p2 ) { return abs(p1.getX()-p2.getX()) + abs(p1.getY()-p2.getY()); } - DbU::Unit Dijkstra::_estimatePtoRP( Point p, RoutingPad* rp, Vertex* vertex ) - { - Horizontal* h = dynamic_cast(rp->_getEntityAsSegment()); - Vertical* v = dynamic_cast(rp->_getEntityAsSegment()); - DbU::Unit d = Vertex::unreachable; - GCell* gvertex = vertex->getGCell(); - - if (h) { - cdebug_log(112,0) << "Case: Horizontal: " << endl; - if (p.getX() < rp->getSourceX()){ - cdebug_log(112,0) << "Case: p.getX() < rp->getSourceX()" << endl; - if (p.getY() < gvertex->getYMin()){ - cdebug_log(112,0) << "Case: West South" << endl; - if ( (!vertex->isSRestricted()) - || (!vertex->isWRestricted()) ) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else if (!vertex->isNRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())) + (gvertex->getYMax() - rp->getY())*2; - else if (!vertex->isERestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else d = Vertex::unreachable; - } else if (p.getY() > gvertex->getYMax()){ - cdebug_log(112,0) << "Case: West North" << endl; - if ( (!vertex->isNRestricted()) - || (!vertex->isWRestricted()) ) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else if (!vertex->isSRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())) + (rp->getY() - gvertex->getYMin())*2; - else if (!vertex->isERestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else d = Vertex::unreachable; - } else { - cdebug_log(112,0) << "Case: West" << endl; - if (!vertex->isWRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))); - if (!vertex->isNRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))+ (gvertex->getYMax() - rp->getY())*2); - if (!vertex->isSRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))+ (rp->getY() - gvertex->getYMin())*2); - if (!vertex->isERestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))); - } - } else if (p.getX() > rp->getTargetX()){ - cdebug_log(112,0) << "Case: p.getX() > rp->getTargetX()" << endl; - if (p.getY() < gvertex->getYMin()){ - cdebug_log(112,0) << "Case: East South" << endl; - if ( (!vertex->isSRestricted()) - || (!vertex->isERestricted()) ) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else if (!vertex->isNRestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())) + (gvertex->getYMax() - rp->getY())*2; - else if (!vertex->isWRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else d = Vertex::unreachable; - } else if (p.getY() > gvertex->getYMax()){ - cdebug_log(112,0) << "Case: East North" << endl; - if ( (!vertex->isNRestricted()) - || (!vertex->isERestricted()) ) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else if (!vertex->isSRestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())) + (rp->getY() - gvertex->getYMin())*2; - else if (!vertex->isWRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else d = Vertex::unreachable; - } else { - cdebug_log(112,0) << "Case: East" << endl; - if (!vertex->isERestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))); - if (!vertex->isNRestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))+ (gvertex->getYMax() - rp->getY())*2); - if (!vertex->isSRestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))+ (rp->getY() - gvertex->getYMin())*2); - if (!vertex->isWRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))); - } - } else if (p.getY() < gvertex->getYMin()){ - cdebug_log(112,0) << "Case: South" << endl; - if (!vertex->isSRestricted()) d = min(d, rp->getY()-p.getY()); - if (!vertex->isERestricted()) d = min(d, rp->getY()-p.getY()+ (gvertex->getXMax()-p.getX())*2); - if (!vertex->isWRestricted()) d = min(d, rp->getY()-p.getY()+ (p.getX()-gvertex->getXMin())*2); - if (!vertex->isNRestricted()) d = min(d, min ( gvertex->getXMax()-p.getX() + gvertex->getYMax()-p.getY() + gvertex->getYMax()-rp->getY() - , p.getX()-gvertex->getXMin() + gvertex->getYMax()-p.getY() + gvertex->getYMax()-rp->getY() - ) - ); - } else if (p.getY() > gvertex->getYMax()){ - cdebug_log(112,0) << "Case: North" << endl; - if (!vertex->isNRestricted()) d = min(d, p.getY()-rp->getY()); - if (!vertex->isERestricted()) d = min(d, p.getY()-rp->getY()+ (gvertex->getXMax()-p.getX())*2); - if (!vertex->isWRestricted()) d = min(d, p.getY()-rp->getY()+ (p.getX()-gvertex->getXMin())*2); - if (!vertex->isSRestricted()) d = min(d, min ( gvertex->getXMax()-p.getX() + p.getY()-gvertex->getYMin() + rp->getY()-gvertex->getYMin() - , p.getX()-gvertex->getXMin() + p.getY()-gvertex->getYMin() + rp->getY()-gvertex->getYMin() - ) - ); - } - } - - if (v) { - cdebug_log(112,0) << "Case: Vertical" << endl; - if (p.getY() < rp->getSourceY()){ - cdebug_log(112,0) << "Case: p.getY() < rp->getSourceY()" << endl; - if (p.getX() < gvertex->getXMin()){ - cdebug_log(112,0) << "Case: South West" << endl; - if ( (!vertex->isSRestricted()) - || (!vertex->isWRestricted()) ) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else if (!vertex->isERestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())) + (gvertex->getXMax() - rp->getX())*2; - else if (!vertex->isNRestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else d = Vertex::unreachable; - } else if (p.getX() > gvertex->getXMax()){ - cdebug_log(112,0) << "Case: South East" << endl; - if ( (!vertex->isSRestricted()) - || (!vertex->isERestricted()) ) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else if (!vertex->isWRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())) + (rp->getX() - gvertex->getXMin())*2; - else if (!vertex->isNRestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else d = Vertex::unreachable; - } else { - cdebug_log(112,0) << "Case: South " << endl; - if (!vertex->isSRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))); - if (!vertex->isWRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))+ (gvertex->getXMax() - rp->getX())*2); - if (!vertex->isERestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))+ (rp->getX() - gvertex->getXMin())*2); - if (!vertex->isNRestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))); - } - } else if (p.getY() > rp->getTargetY()){ - cdebug_log(112,0) << "Case: p.getY() > rp->getTargetY()" << endl; - if (p.getX() < gvertex->getXMin()){ - cdebug_log(112,0) << "Case: North West" << endl; - if ( (!vertex->isNRestricted()) - || (!vertex->isWRestricted()) ) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else if (!vertex->isERestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())) + (gvertex->getXMax() - rp->getX())*2; - else if (!vertex->isSRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else d = Vertex::unreachable; - } else if (p.getX() > gvertex->getXMax()){ - cdebug_log(112,0) << "Case: North East" << endl; - if ( (!vertex->isNRestricted()) - || (!vertex->isERestricted()) ) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())); - else if (!vertex->isWRestricted()) d = calcDistance (p, Point(rp->getTargetX(), rp->getTargetY())) + (rp->getX() - gvertex->getXMin())*2; - else if (!vertex->isSRestricted()) d = calcDistance (p, Point(rp->getSourceX(), rp->getSourceY())); - else d = Vertex::unreachable; - } else { - cdebug_log(112,0) << "Case: North" << endl; - if (!vertex->isNRestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))); - if (!vertex->isWRestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))+ (gvertex->getXMax() - rp->getX())*2); - if (!vertex->isERestricted()) d = min(d, calcDistance (p, Point(rp->getTargetX(), rp->getTargetY()))+ (rp->getX() - gvertex->getXMin())*2); - if (!vertex->isSRestricted()) d = min(d, calcDistance (p, Point(rp->getSourceX(), rp->getSourceY()))); - } - } else if (p.getX() < gvertex->getXMin()){ - cdebug_log(112,0) << "Case: West" << endl; - if (!vertex->isWRestricted()) d = min(d, rp->getX()-p.getX()); - if (!vertex->isNRestricted()) d = min(d, rp->getX()-p.getX()+ (gvertex->getYMax()-p.getY())*2); - if (!vertex->isSRestricted()) d = min(d, rp->getX()-p.getX()+ (p.getY()-gvertex->getYMin())*2); - if (!vertex->isERestricted()) d = min(d, min ( gvertex->getYMax()-p.getY() + gvertex->getXMax()-p.getX() + gvertex->getXMax()-rp->getX() - , p.getY()-gvertex->getYMin() + gvertex->getXMax()-p.getX() + gvertex->getXMax()-rp->getX() - ) - ); - } else if (p.getX() > gvertex->getXMax()){ - cdebug_log(112,0) << "Case: East" << endl; - if (!vertex->isERestricted()) d = min(d, p.getX()-rp->getX()); - if (!vertex->isNRestricted()) d = min(d, p.getX()-rp->getX()+ (gvertex->getYMax()-p.getY())*2); - if (!vertex->isSRestricted()) d = min(d, p.getX()-rp->getX()+ (p.getY()-gvertex->getYMin())*2); - if (!vertex->isWRestricted()) d = min(d, min ( gvertex->getYMax()-p.getY() + p.getX()-gvertex->getXMin() + rp->getX()-gvertex->getXMin() - , p.getY()-gvertex->getYMin() + p.getX()-gvertex->getXMin() + rp->getX()-gvertex->getXMin() - ) - ); - } - } - return d; - } - - -/*DbU::Unit Vertex::getXMinUnionfrom () - { - if (_intervfrom){ - if (hasValidStamp()){ - GCell* gcurr = getGCell(); - GCell* gprev = getFrom()->getOpposite(gcurr); - Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); - - if (vprev->isH() && isH()){ - return max(_intervfrom->getMin(), gcurr->getXMin()); - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 3" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 2" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 1" << endl; - return 0; - } - } - - - DbU::Unit Vertex::getXMaxUnionfrom () - { - if (_intervfrom){ - if (hasValidStamp()){ - GCell* gcurr = getGCell(); - GCell* gprev = getFrom()->getOpposite(gcurr); - Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); - - if (vprev->isH() && isH()){ - return min(_intervfrom->getMax(), gcurr->getXMax()); - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 3" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 2" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 1" << endl; - return 0; - } - } - - - DbU::Unit Vertex::getYMinUnionfrom () - { - if (_intervfrom){ - if (hasValidStamp()){ - GCell* gcurr = getGCell(); - GCell* gprev = getFrom()->getOpposite(gcurr); - Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); - - if (vprev->isV() && isV()){ - return max(_intervfrom->getMin(), gcurr->getYMin()); - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 3" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 2" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 1" << endl; - return 0; - } - } - - - DbU::Unit Vertex::getYMaxUnionfrom () - { - if (_intervfrom){ - if (hasValidStamp()){ - GCell* gcurr = getGCell(); - GCell* gprev = getFrom()->getOpposite(gcurr); - Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); - - if (vprev->isV() && isV()){ - return min(_intervfrom->getMax(), gcurr->getYMax()); - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 3" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 2" << endl; - return 0; - } - } else { - cdebug_log(112,0) << "[ERROR]: No FROM, wrong usage. 1" << endl; - return 0; - } - }*/ - - - void Vertex::clearFrom2 () - { - _from2 = NULL; - //if (_intervfrom2) _intervfrom2->destroy(); - } - - Dijkstra::Dijkstra ( AnabaticEngine* anabatic ) : _anabatic (anabatic) , _vertexes () @@ -1617,6 +1231,7 @@ namespace Anabatic { vector rps; NetRoutingState* state = NetRoutingExtension::get( _net ); + if (state){ if (state->isSelfSym()){ cdebug_log(112,0) << "Dijkstra::SELF SYMMETRY CASE " << _net << endl; @@ -1626,21 +1241,7 @@ namespace Anabatic { for ( Component* component : _net->getComponents() ) { RoutingPad* rp = dynamic_cast( component ); if (rp) { - if (state){ - if (state->isSelfSym()){ - if ( ( (state->isSymHorizontal())&&(rp->getBoundingBox().getYMin() > state->getSymAxis()) ) - ||( (state->isSymVertical() )&&(rp->getBoundingBox().getXMin() > state->getSymAxis()) ) - ){ - Point center = rp->getBoundingBox().getCenter(); - GCell* gcell = _anabatic->getGCellUnder( center ); - Vertex* seed = gcell->getObserver(GCell::Observable::Vertex); - Contact* vcontact = seed->getGContact( _net ); - rp->getBodyHook()->detach(); - rp->getBodyHook()->attach( vcontact->getBodyHook() ); - continue; - } - } - } + if ( _attachSymContactsHook( rp ) ) continue; // ANALOG rps.push_back( rp ); cdebug_log(112,0) << "| " << rp << endl; continue; @@ -1651,25 +1252,7 @@ namespace Anabatic { Point center = rp->getBoundingBox().getCenter(); GCell* gcell = _anabatic->getGCellUnder( center ); - if (state){ - if (state->isSymHorizontal()){ - _searchArea.merge( Box( _net->getCell()->getAbutmentBox().getXMin() - , _net->getCell()->getAbutmentBox().getYMin() - , _net->getCell()->getAbutmentBox().getXMax() - , state->getSymAxis() - ) - ); - } else if (state->isSymVertical()){ - _searchArea.merge( Box( _net->getCell()->getAbutmentBox().getXMin() - , _net->getCell()->getAbutmentBox().getYMin() - , state->getSymAxis() - , _net->getCell()->getAbutmentBox().getYMax() - ) - ); - } - } else if (gcell->isDevice()){ - _searchArea.merge( _net->getCell()->getAbutmentBox() ); - } + _limitSymSearchArea(rp); // ANALOG cdebug_log(112,0) << "| " << rp << endl; @@ -1688,17 +1271,10 @@ namespace Anabatic { _searchArea.merge( gcell->getBoundingBox() ); cdebug_log(112,0) << "New Search area: " << _searchArea << endl; - Vertex* seed = gcell->getObserver(GCell::Observable::Vertex); - Horizontal* h = dynamic_cast(rp->_getEntityAsSegment()); - Vertical* v = dynamic_cast (rp->_getEntityAsSegment()); - if (h) { - seed->setIAsH(); - seed->setInterv(rp->getBoundingBox().getXMin(), rp->getBoundingBox().getXMax(), rp->getBoundingBox().getYCenter()); - } - if (v) { - seed->setIAsV(); - seed->setInterv(rp->getBoundingBox().getYMin(), rp->getBoundingBox().getYMax(), rp->getBoundingBox().getXCenter()); - } + Vertex* seed = gcell->getObserver(GCell::Observable::Vertex); + GCell* gseed = seed->getGCell(); + + if (!gseed->isMatrix()) _setSourcesGRAData( seed, rp ); // ANALOG if (seed->getConnexId() < 0) { VertexSet connecteds; @@ -1822,8 +1398,7 @@ namespace Anabatic { current->setDistance ( Vertex::unreached ); current->setStamp ( _stamp ); current->setConnexId( -1 ); - current->setAxisTarget(); - //cdebug_log(112,0) << "AxisTarget: " << current << endl; + current->setFlags(Vertex::AxisTarget); } if (state->isSymVertical()){ @@ -1936,11 +1511,11 @@ namespace Anabatic { bool Dijkstra::_propagate ( Flags enabledSides ) { cdebug_log(112,1) << "Dijkstra::_propagate() " << _net << endl; - while ( not _queue.empty() ) { _queue.dump(); + Vertex* current = _queue.top(); + GCell* gcurrent = current->getGCell(); - Vertex* current = _queue.top(); cdebug_log(111,0) << endl << "[Current Vertex]: " << current << ", current->getConnexId() == _connectedsId):" << (current->getConnexId() == _connectedsId)<< ", (current->getConnexId() < 0): " << current->getConnexId() << endl; _queue.pop(); @@ -1952,24 +1527,13 @@ namespace Anabatic { if (edge == current->getFrom()) { cdebug_log(111,0) << "edge == current->getFrom()" << endl; continue; - } else { - cdebug_log(111,0) << "edge != current->getFrom()" << endl; - } - if (current->getFrom2()){ - if (edge == current->getFrom2()) { - cdebug_log(111,0) << "edge == current->getFrom2()" << endl; - continue; - } else { - cdebug_log(111,0) << "edge != current->getFrom2(): " << current->getFrom2() << endl; - } - } else { - cdebug_log(111,0) << "current->getFrom2() = NULL" << endl; - } - + } else cdebug_log(111,0) << "edge != current->getFrom()" << endl; + + if (_checkFrom2(edge, current)) continue; // ANALOG GCell* gneighbor = edge->getOpposite(current->getGCell()); - GCell* gcurrent = current->getGCell(); Vertex* vneighbor = gneighbor->getObserver(GCell::Observable::Vertex); + if (!gneighbor->isMatrix()) vneighbor->createAData(); if (vneighbor->getConnexId() == _connectedsId) { cdebug_log(111,0) << "ConnectedsId" << endl; @@ -1981,138 +1545,34 @@ namespace Anabatic { } ////////////////////////////////////// DEBUG ////////////////////////////////////// - //cdebug_log(111,0) << endl << "===================================================================================" << endl << endl; cdebug_log(111,0) << "| Net : " << _net << endl; - cdebug_log(111,0) << "| [Curr]: " << current; + cdebug_log(111,0) << "| [Curr]: " << current << endl; if (current->getFrom()) { cdebug_log(111,0) << "| From: " << current->getFrom()->getOpposite(gcurrent) << endl; - current->getIntervFrom()->print(); - } - else { cdebug_log(111,0) << endl;} + current->getIntervFrom().print(); + } if (current->getFrom2()) { cdebug_log(111,0) << "| FROM2: " << current->getFrom2()->getOpposite(gcurrent) << endl; - current->getIntervFrom2()->print(); + current->getIntervFrom2().print(); } - - cdebug_log(111,0) << "| Edge " << edge << endl; - cdebug_log(111,0) << "+ Neighbor: " << vneighbor; - if ((vneighbor->getFrom() != NULL)&&(vneighbor->hasValidStamp())) {cdebug_log(111,0) << "| Neighbor GETFROM:" << vneighbor->getFrom()->getOpposite( gneighbor ) << endl;} - else {cdebug_log(111,0) << endl;} + cdebug_log(111,0) << "+ Neighbor: " << vneighbor << endl; + if ((vneighbor->getFrom() != NULL)&&(vneighbor->hasValidStamp())) { + cdebug_log(111,0) << "| Neighbor GETFROM:" << vneighbor->getFrom()->getOpposite( gneighbor ) << endl; + cdebug_log(111,0) << "Distance prev : " << DbU::getValueString(vneighbor->getDistance()) << endl; + } /////////////////////////////////////////////////////////////////////////////////// // if has 2 from, 2 distances to calculate - //current->unsetFromFrom2(); cdebug_log(111,0) << "Calc distance1" << endl; DbU::Unit distance = _distanceCb( current, vneighbor, edge ); - DbU::Unit distance2 = Vertex::unreachable; - bool isDistance2shorter = false; - if (current->getFrom2()) { - cdebug_log(111,0) << "HAS 2nd getfrom" << edge << endl; - current->setFrom2Mode(); - cdebug_log(111,0) << "Calc distance2" << endl; - distance2 = _distanceCb( current, vneighbor, edge ); - current->unsetFrom2Mode(); - cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; - cdebug_log(111,0) << "Distance2 curr: " << DbU::getValueString(distance2) << endl; - if (distance > distance2){ - cdebug_log(111,0) << "=> distance2 is shorter" << endl; - isDistance2shorter = true; - distance = distance2; - } else if (distance == distance2) { - cdebug_log(111,0) << "distance == distance2" << endl; - Point pcurr = current->getStartPathPoint(vneighbor); - current->setFrom2Mode(); - Point pcurr2 = current->getStartPathPoint(vneighbor); - current->unsetFrom2Mode(); - Point pnext = gneighbor->getCenter(); - if (calcDistance(pcurr, pnext) > calcDistance(pcurr2, pnext)) { - cdebug_log(111,0) << "=> distance2 is shorter" << endl; - isDistance2shorter = true; - distance = distance2; - } else { - cdebug_log(111,0) << "=> distance1 is shorter" << endl; - } - } else { - cdebug_log(111,0) << "=> distance1 is shorter" << endl; - } - } else { - cdebug_log(111,0) << "NO 2nd getfrom" << endl; - cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; - } - - //cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; - //cdebug_log(111,0) << "Distance2 curr: " << DbU::getValueString(distance2) << ", isDistance2shorter:" << isDistance2shorter << endl; - cdebug_log(111,0) << "Distance prev : " << DbU::getValueString(vneighbor->getDistance()) << endl; + bool isDistance2shorter = _isDistance2Shorter ( distance, current, vneighbor, edge ); // ANALOG if ( (distance == vneighbor->getDistance()) and ((!gcurrent->isMatrix()) and (!gneighbor->isMatrix())) ){ - cdebug_log(111,0) << "[case: Distance EQUAL + SameSide]" << endl; - cdebug_log(111,0) << "Previous getfrom:" << vneighbor->getFrom()->getOpposite( gneighbor ) << endl; - - GCell* gnext = vneighbor->getGCell(); - GCell* gprev = vneighbor->getFrom()->getOpposite(gnext); - Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); - - //Point pnext = Vertex::getNextPathPoint2( current, vneighbor ); - //Point pprev = Vertex::getNextPathPoint2( vprev, vneighbor ); + _pushEqualDistance( distance, isDistance2shorter, current, vneighbor, edge ); // ANALOG - //Point pnext = current->getNextPathPoint( current->getStartPathPoint(vneighbor), vneighbor ); - //Point pprev = vprev->getNextPathPoint ( vprev->getStartPathPoint(vneighbor), vneighbor ); - //Point ppond = _getPonderedPoint(); - //DbU::Unit distcurr = this->_getDistancetoRP(pnext); - //DbU::Unit distprev = this->_getDistancetoRP(pprev); - - //cdebug_log(111,0) << "Pcurrent: X:" << DbU::getValueString(pnext.getX()) << ", Y:" << DbU::getValueString(pnext.getY()) << endl; - //cdebug_log(111,0) << "Pprev : X:" << DbU::getValueString(pprev.getX()) << ", Y:" << DbU::getValueString(pprev.getY()) << endl; - //cdebug_log(111,0) << "distToTargets curr: " << DbU::getValueString(distcurr) << endl; - //cdebug_log(111,0) << "distToTargets prev: " << DbU::getValueString(distprev) << endl; - - - if ((distance == vneighbor->getDistance()) and vneighbor->areSameSide(vprev, current)){ - cdebug_log(112,0) << "----------------------------" << endl; - cdebug_log(112,0) << "(distance == vneighbor->getDistance()) + sameSide => add create 2nd from" << endl; - cdebug_log(112,0) << "vneighbor: " << vneighbor << endl; - cdebug_log(112,0) << "curr: " << current << endl; - cdebug_log(112,0) << "prev: " << vprev << endl; - cdebug_log(112,0) << "----------------------------" << endl; - cdebug_log(111,0) << "[case: Other GetFROM]" << endl; - vneighbor->setFrom2 ( edge ); - //current->setFrom2Mode(); - vneighbor->setFrom2Mode(); - vneighbor->createIntervFrom2(); - vneighbor->setIntervals( current ); - //current->unsetFrom2Mode(); - vneighbor->unsetFrom2Mode(); - if (isDistance2shorter) { - vneighbor->setFromFrom2(); - cdebug_log(111,0) << "setFromFrom2: " << vneighbor << endl; - } - cdebug_log(111,0) << "Push BIS : (size:" << _queue.size() << ") " << vneighbor << endl; - vneighbor->getIntervFrom()->print(); - vneighbor->getIntervFrom2()->print(); - } /*else if ( ( distcurr < distprev ) - || (( distcurr == distprev ) && ( calcDistance(ppond, pnext) < calcDistance(ppond, pprev) )) - ){ - _queue.erase( vneighbor ); - cdebug_log(111,0) << "case: BETTER GetFROM" << endl; - vneighbor->setBranchId( current->getBranchId() ); - vneighbor->setDistance( distance ); - if (isDistance2shorter) { - vneighbor->setFrom2( edge ); - vneighbor->setFromFrom2(); - cdebug_log(111,0) << "setFromFrom2: " << vneighbor << endl; - } else { - vneighbor->setFrom ( edge ); - } - _queue.push( vneighbor ); - vneighbor->setIntervals( current ); - cdebug_log(111,0) << "Push: (size:" << _queue.size() << ") " << vneighbor << endl; - }*/ - - } else if ( ( (distance < vneighbor->getDistance()) and (distance != Vertex::unreachable) ) - // or ( (distance == vneighbor->getDistance()) and (current->getBranchId() > vneighbor->getBranchId()) ) - ) { + } else if ( (distance < vneighbor->getDistance()) and (distance != Vertex::unreachable) ){ if (vneighbor->getDistance() != Vertex::unreached) _queue.erase( vneighbor ); else { if (not vneighbor->hasValidStamp()) { @@ -2125,22 +1585,13 @@ namespace Anabatic { } } cdebug_log(111,0) << "[case: Distance INFERIOR]" << endl; - vneighbor->unsetFromFrom2(); - cdebug_log(111,0) << "unsetFromFrom2: " << vneighbor << endl; - vneighbor->clearFrom2(); + _updateGRAData ( vneighbor, isDistance2shorter, current ); // ANALOG + vneighbor->setBranchId( current->getBranchId() ); vneighbor->setDistance( distance ); vneighbor->setFrom ( edge ); - if (isDistance2shorter) { - vneighbor->setFromFrom2(); - cdebug_log(111,0) << "setFromFrom2: " << vneighbor << endl; - } else { - cdebug_log(111,0) << "DON'T setFromFrom2: " << vneighbor << endl; - } _queue.push( vneighbor ); - vneighbor->setIntervals( current ); cdebug_log(111,0) << "Push: (size:" << _queue.size() << ") " << vneighbor << endl; - vneighbor->getIntervFrom()->print(); } } @@ -2160,7 +1611,6 @@ namespace Anabatic { for ( Vertex* v : _targets ) { cdebug_tabw(112, 0) << v << endl; - } cdebug_tabw(112,-1); @@ -2178,46 +1628,7 @@ namespace Anabatic { bool isfirst = true; bool useFrom2 = false; if (!current->getGCell()->isMatrix()){ - GCell* gcurr = current->getGCell(); - GCell* gprev = current->getFrom()->getOpposite(gcurr); - Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); - - Point pcurrent = vprev->getStartPathPoint(current); - //Point pentry = Vertex::getNextPathPoint2( vprev, current ); - Point pentry = vprev->getNextPathPoint( pcurrent, current ); - cdebug_log(112,0) << "current : " << gcurr << endl; - cdebug_log(112,0) << "previous: " << gprev << endl; - cdebug_log(112,0) << "pcurr : x: " << DbU::getValueString(pcurrent.getX()) << ", y: " << DbU::getValueString(pcurrent.getY()) << endl; - cdebug_log(112,0) << "pentry: x: " << DbU::getValueString(pentry.getX()) << ", y: " << DbU::getValueString(pentry.getY()) << endl; - - - cdebug_log(112,0) << "| " << current << " | " << endl; - if (current->isH()){ - if (pentry.getX() < current->getIMin()){ - current->setInterv(pentry.getX(), current->getIMax(), current->getIAxis()); - cdebug_log(112,0) << "[Interval update1]: min : " << DbU::getValueString(pentry.getX()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; - } else if (pentry.getX() > current->getIMax()){ - current->setInterv(current->getIMin(), pentry.getX(), current->getIAxis()); - cdebug_log(112,0) << "[Interval update2]: min : " << DbU::getValueString(current->getIMin()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getX()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; - } - } else if (current->isV()){ - if (pentry.getY() < current->getIMin()){ - current->setInterv(pentry.getY(), current->getIMax(), current->getIAxis()); - cdebug_log(112,0) << "[Interval update3]: min : " << DbU::getValueString(pentry.getY()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; - } else if (pentry.getY() > current->getIMax()){ - current->setInterv(current->getIMin(), pentry.getY(), current->getIAxis()); - cdebug_log(112,0) << "[Interval update4]: min : " << DbU::getValueString(current->getIMin()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getY()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; - } - } - cdebug_log(112,0) << "isiSet: " << current->isiSet() << endl; + _initiateUpdateIntervals ( current ); // ANALOG } else { current = current->getPredecessor(); isfirst = false; @@ -2225,59 +1636,33 @@ namespace Anabatic { } cdebug_log(112,0) << "[Start WHILE]" << endl; + Edge* from = NULL; while ( current ) { cdebug_log(112,0) << endl; cdebug_log(112,0) << "| " << current << " | " << endl; if (!current->getGCell()->isMatrix()){ - if (!isfirst){ - current->incDegree(); - if (current->getConnexId() == _connectedsId) break; - Edge* from = NULL; - if (useFrom2) { - cdebug_log(112,0) << "USE FROM2: " << current->getFrom2() << endl; - current->setFrom(current->getFrom2()); - current->setIntervfrom(current->getPIMin2(), current->getPIMax2(), current->getPIAxis2()); - current->clearFrom2(); - } - from = current->getFrom(); - if (not from) break; - - current->setDistance( 0.0 ); - current->setConnexId( _connectedsId ); - current->setBranchId( branchId ); - _sources.insert( current ); - _queue.push( current ); - } else isfirst = false; - - if (!current->getGCell()->isMatrix()){ - if (current->getPredecessor() != NULL){ - cdebug_log(112,0) << "Predecessor() : " << current->getPredecessor() << endl; - cdebug_log(112,0) << "[Interval update]: min : " << DbU::getValueString(current->getPIMin()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getPIMax()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getPIAxis()) << endl; - current->getPredecessor()->setInterv(current->getPIMin(), current->getPIMax(), current->getPIAxis()); - current->getIntervFrom()->print(); - //cdebug_log(112,0) << "isiSet: " << current->getPredecessor()->isiSet() << ", " << current->getPredecessor() << endl; - } - } + //////////////////////////////////////////////////////////////////////////////////////////// ANALOG + if (_updateIntervals ( isfirst, current, useFrom2, branchId, from )) break; Vertex* next = NULL; next = current->getPredecessor(); if( current->isFromFrom2()) { cdebug_log(112,0) << "ISFROMFROM2: " << current << endl; useFrom2 = true; - current->unsetFromFrom2(); + current->unsetFlags(Vertex::UseFromFrom2); } else { cdebug_log(112,0) << "ISNOT FROMFROM2" << endl; useFrom2 = false; } + cdebug_log(112,0) << "next: " << next << endl; current = next; + //////////////////////////////////////////////////////////////////////////////////////////// } else { current->incDegree(); if (current->getConnexId() == _connectedsId) break; - Edge* from = current->getFrom(); + from = current->getFrom(); if (not from) break; current->setDistance( 0.0 ); @@ -2287,55 +1672,7 @@ namespace Anabatic { _queue.push( current ); current = current->getPredecessor(); } - - /*if (!isfirst){ - current->incDegree(); - if (current->getConnexId() == _connectedsId) break; - - Edge* from = NULL; - if (useFrom2) { - cdebug_log(112,0) << "USE FROM2: " << current->getFrom2() << ", " << current->getIntervFrom2() << endl; - - current->setFrom(current->getFrom2()); - current->setInterv(current->getPIMin2(), current->getPIMax2(), current->getPIAxis2()); - current->clearFrom2(); - } - from = current->getFrom(); - - if (not from) break; - - current->setDistance( 0.0 ); - current->setConnexId( _connectedsId ); - current->setBranchId( branchId ); - _sources.insert( current ); - _queue.push( current ); - } else { - isfirst = false; - } - - if ((!current->getGCell()->isMatrix())&&(!first)){ - if (current->getPredecessor() != NULL){ - cdebug_log(112,0) << "[Interval update]: min : " << DbU::getValueString(current->getPIMin()); - cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getPIMax()); - cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getPIAxis()) << endl; - current->getPredecessor()->setInterv(current->getPIMin(), current->getPIMax(), current->getPIAxis()); - //cdebug_log(112,0) << "isiSet: " << current->getPredecessor()->isiSet() << ", " << current->getPredecessor() << endl; - } - } - Vertex* next = NULL; - next = current->getPredecessor(); - - if( current->isFromFrom2()) { - cdebug_log(112,0) << "ISFROMFROM2: " << current << endl; - useFrom2 = true; - current->unsetFromFrom2(); - } else { - cdebug_log(112,0) << "ISNOT FROMFROM2" << endl; - useFrom2 = false; - } - current = next;*/ } - cdebug_tabw(112,-1); } @@ -2358,9 +1695,7 @@ namespace Anabatic { Vertex* source = startVertex; while ( source ) { - //////////////////////////////////////////// - source->resetIntervals(); - //////////////////////////////////////////// + source->resetIntervals(); // ANALOG cdebug_log(112,0) << "* " << source << endl; @@ -2497,7 +1832,7 @@ namespace Anabatic { void Dijkstra::_toSources ( Vertex* source, int connexId ) { - //cdebug_log(112,1) << "Dijkstra::_toSources() " << endl; + cdebug_log(112,1) << "Dijkstra::_toSources() " << endl; //cdebug_log(112,0) << "* from: " << source << endl; source->setConnexId( connexId ); @@ -2686,5 +2021,249 @@ namespace Anabatic { } + bool Dijkstra::_checkFrom2 ( Edge* edge, Vertex* current ) + { + if (current->getFrom2()){ + if (edge == current->getFrom2()) { + cdebug_log(111,0) << "edge == current->getFrom2()" << endl; + return true; + } else { + cdebug_log(111,0) << "edge != current->getFrom2(): " << current->getFrom2() << endl; + return false; + } + } else { + cdebug_log(111,0) << "current->getFrom2() = NULL" << endl; + return false; + } + } + + + bool Dijkstra::_isDistance2Shorter ( DbU::Unit& distance, Vertex* current, Vertex* vneighbor, Edge* edge ) + { + DbU::Unit distance2 = Vertex::unreachable; + bool isDistance2shorter = false; + GCell* gneighbor = edge->getOpposite(current->getGCell()); + if (current->getFrom2()) { + cdebug_log(111,0) << "HAS 2nd getfrom" << edge << endl; + current->setFlags(Vertex::From2Mode); + cdebug_log(111,0) << "Calc distance2" << endl; + distance2 = _distanceCb( current, vneighbor, edge ); + current->unsetFlags(Vertex::From2Mode); + cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; + cdebug_log(111,0) << "Distance2 curr: " << DbU::getValueString(distance2) << endl; + if (distance > distance2){ + cdebug_log(111,0) << "=> distance2 is shorter" << endl; + isDistance2shorter = true; + distance = distance2; + } else if (distance == distance2) { + cdebug_log(111,0) << "distance == distance2" << endl; + Point pcurr = current->getStartPathPoint(vneighbor); + current->setFlags(Vertex::From2Mode); + Point pcurr2 = current->getStartPathPoint(vneighbor); + current->unsetFlags(Vertex::From2Mode); + Point pnext = gneighbor->getCenter(); + if (calcDistance(pcurr, pnext) > calcDistance(pcurr2, pnext)) { + cdebug_log(111,0) << "=> distance2 is shorter" << endl; + isDistance2shorter = true; + distance = distance2; + } else { + cdebug_log(111,0) << "=> distance1 is shorter" << endl; + } + } else { + cdebug_log(111,0) << "=> distance1 is shorter" << endl; + } + } else { + cdebug_log(111,0) << "NO 2nd getfrom" << endl; + cdebug_log(111,0) << "Distance1 curr: " << DbU::getValueString(distance) << endl; + } + return isDistance2shorter; + } + + + void Dijkstra::_pushEqualDistance ( DbU::Unit distance, bool isDistance2shorter, Vertex* current, Vertex* vneighbor, Edge* edge ) + { + GCell* gneighbor = edge->getOpposite(current->getGCell()); + cdebug_log(111,0) << "[case: Distance EQUAL + SameSide]" << endl; + cdebug_log(111,0) << "Previous getfrom:" << vneighbor->getFrom()->getOpposite( gneighbor ) << endl; + + GCell* gnext = vneighbor->getGCell(); + GCell* gprev = vneighbor->getFrom()->getOpposite(gnext); + Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); + + if ((distance == vneighbor->getDistance()) and vneighbor->areSameSide(vprev, current)){ + cdebug_log(111,0) << "[case: Other GetFROM]" << endl; + vneighbor->setFrom2 ( edge ); + vneighbor->setFlags(Vertex::From2Mode); + //vneighbor->createIntervFrom2(); + vneighbor->setIntervals( current ); + vneighbor->unsetFlags(Vertex::From2Mode); + if (isDistance2shorter) { + vneighbor->setFlags(Vertex::UseFromFrom2); + cdebug_log(111,0) << "setFromFrom2: " << vneighbor << endl; + } + cdebug_log(111,0) << "Push BIS : " << vneighbor << endl; + vneighbor->getIntervFrom().print(); + vneighbor->getIntervFrom2().print(); + } + } + + + void Dijkstra::_updateGRAData ( Vertex* vneighbor, bool isDistance2shorter, Vertex* current ) + { + vneighbor->unsetFlags(Vertex::UseFromFrom2); + cdebug_log(111,0) << "unsetFromFrom2: " << vneighbor << endl; + vneighbor->clearFrom2(); + if (isDistance2shorter) { + vneighbor->setFlags(Vertex::UseFromFrom2); + cdebug_log(111,0) << "setFromFrom2: " << vneighbor << endl; + } else cdebug_log(111,0) << "DON'T setFromFrom2: " << vneighbor << endl; + + vneighbor->setIntervals( current ); + vneighbor->getIntervFrom().print(); + } + + void Dijkstra::_initiateUpdateIntervals ( Vertex* current ) + { + GCell* gcurr = current->getGCell(); + GCell* gprev = current->getFrom()->getOpposite(gcurr); + Vertex* vprev = gprev->getObserver(GCell::Observable::Vertex); + Point pcurrent = vprev->getStartPathPoint(current); + Point pentry = vprev->getNextPathPoint( pcurrent, current ); + cdebug_log(112,0) << "current : " << gcurr << endl; + cdebug_log(112,0) << "previous: " << gprev << endl; + cdebug_log(112,0) << "pcurr : x: " << DbU::getValueString(pcurrent.getX()) << ", y: " << DbU::getValueString(pcurrent.getY()) << endl; + cdebug_log(112,0) << "pentry: x: " << DbU::getValueString(pentry.getX()) << ", y: " << DbU::getValueString(pentry.getY()) << endl; + + cdebug_log(112,0) << "| " << current << " | " << endl; + if (current->isH()){ + if (pentry.getX() < current->getIMin()){ + current->setInterv(pentry.getX(), current->getIMax(), current->getIAxis()); + cdebug_log(112,0) << "[Interval update1]: min : " << DbU::getValueString(pentry.getX()); + cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + } else if (pentry.getX() > current->getIMax()){ + current->setInterv(current->getIMin(), pentry.getX(), current->getIAxis()); + cdebug_log(112,0) << "[Interval update2]: min : " << DbU::getValueString(current->getIMin()); + cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getX()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + } + } else if (current->isV()){ + if (pentry.getY() < current->getIMin()){ + current->setInterv(pentry.getY(), current->getIMax(), current->getIAxis()); + cdebug_log(112,0) << "[Interval update3]: min : " << DbU::getValueString(pentry.getY()); + cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getIMax()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + } else if (pentry.getY() > current->getIMax()){ + current->setInterv(current->getIMin(), pentry.getY(), current->getIAxis()); + cdebug_log(112,0) << "[Interval update4]: min : " << DbU::getValueString(current->getIMin()); + cdebug_log(112,0) << ", max : " << DbU::getValueString(pentry.getY()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getIAxis()) << endl; + } + } + cdebug_log(112,0) << "isiSet: " << current->isiSet() << endl; + } + + + bool Dijkstra::_updateIntervals( bool& isfirst, Vertex* current, bool& useFrom2, int& branchId, Edge* from ) + { + if (!isfirst){ + cdebug_log(112,0) << "Is not first" << endl; + current->incDegree(); + if (current->getConnexId() == _connectedsId) return true; + from = NULL; + if (useFrom2) { + cdebug_log(112,0) << "USE FROM2: " << current->getFrom2() << endl; + current->setFrom(current->getFrom2()); + current->setIntervfrom(current->getPIMin2(), current->getPIMax2(), current->getPIAxis2()); + current->clearFrom2(); + } + from = current->getFrom(); + if (not from) return true; + + current->setDistance( 0.0 ); + current->setConnexId( _connectedsId ); + current->setBranchId( branchId ); + _sources.insert( current ); + _queue.push( current ); + } else isfirst = false; + + if (current->getPredecessor() != NULL){ + cdebug_log(112,0) << "Predecessor() : " << current->getPredecessor() << endl; + cdebug_log(112,0) << "[Interval update]: min : " << DbU::getValueString(current->getPIMin()); + cdebug_log(112,0) << ", max : " << DbU::getValueString(current->getPIMax()); + cdebug_log(112,0) << ", axis: " << DbU::getValueString(current->getPIAxis()) << endl; + current->getPredecessor()->setInterv(current->getPIMin(), current->getPIMax(), current->getPIAxis()); + current->getIntervFrom().print(); + } + return false; + } + + + bool Dijkstra::_attachSymContactsHook( RoutingPad* rp ) + { + NetRoutingState* state = NetRoutingExtension::get( _net ); + if (state){ + if (state->isSelfSym()){ + if ( ( (state->isSymHorizontal())&&(rp->getBoundingBox().getYMin() > state->getSymAxis()) ) + ||( (state->isSymVertical() )&&(rp->getBoundingBox().getXMin() > state->getSymAxis()) ) + ){ + Point center = rp->getBoundingBox().getCenter(); + GCell* gcell = _anabatic->getGCellUnder( center ); + Vertex* seed = gcell->getObserver(GCell::Observable::Vertex); + Contact* vcontact = seed->getGContact( _net ); + rp->getBodyHook()->detach(); + rp->getBodyHook()->attach( vcontact->getBodyHook() ); + return true; + } + } + } + return false; + } + + + void Dijkstra::_limitSymSearchArea( RoutingPad* rp ) + { + NetRoutingState* state = NetRoutingExtension::get( _net ); + Point center = rp->getBoundingBox().getCenter(); + GCell* gcell = _anabatic->getGCellUnder( center ); + if (state){ + if (state->isSymHorizontal()){ + _searchArea.merge( Box( _net->getCell()->getAbutmentBox().getXMin() + , _net->getCell()->getAbutmentBox().getYMin() + , _net->getCell()->getAbutmentBox().getXMax() + , state->getSymAxis() + ) + ); + } else if (state->isSymVertical()){ + _searchArea.merge( Box( _net->getCell()->getAbutmentBox().getXMin() + , _net->getCell()->getAbutmentBox().getYMin() + , state->getSymAxis() + , _net->getCell()->getAbutmentBox().getYMax() + ) + ); + } + } else if (gcell->isDevice()){ + _searchArea.merge( _net->getCell()->getAbutmentBox() ); + } + } + + + void Dijkstra::_setSourcesGRAData( Vertex* seed, RoutingPad* rp ) + { + Horizontal* h = dynamic_cast(rp->_getEntityAsSegment()); + Vertical* v = dynamic_cast (rp->_getEntityAsSegment()); + seed->createAData(); + if (h) { + seed->setFlags(Vertex::iHorizontal); + seed->setInterv(rp->getBoundingBox().getXMin(), rp->getBoundingBox().getXMax(), rp->getBoundingBox().getYCenter()); + } + if (v) { + seed->setFlags(Vertex::iVertical); + seed->setInterv(rp->getBoundingBox().getYMin(), rp->getBoundingBox().getYMax(), rp->getBoundingBox().getXCenter()); + } + } + + + } // Anabatic namespace. diff --git a/anabatic/src/anabatic/Dijkstra.h b/anabatic/src/anabatic/Dijkstra.h index 46fbb605..90f83397 100644 --- a/anabatic/src/anabatic/Dijkstra.h +++ b/anabatic/src/anabatic/Dijkstra.h @@ -38,22 +38,6 @@ namespace Anabatic { class AnabaticEngine; -// ------------------------------------------------------------------- -// Class : "Anabatic::GRAData". -/* - class GRAData - { - private: - GRAData(); - ~GRAData(); - public: - static GRAData* create(); - - private: - IntervalC* _intervfrom; - IntervalC* _interv; - };*/ - // ------------------------------------------------------------------- // Class : "Anabatic::IntervalC". @@ -65,31 +49,32 @@ namespace Anabatic { , iVertical = (1<<1) , iSet = (1<<2) }; - private: - IntervalC(); - ~IntervalC(); - public: - static IntervalC* create(); public: - void destroy (); - void set ( DbU::Unit, DbU::Unit, DbU::Unit ); - void setRange ( DbU::Unit, DbU::Unit ); - void extendMin ( DbU::Unit ); - void extendMax ( DbU::Unit ); - void print () const; - inline bool isH () const; - inline bool isV () const; - inline void setAsH (); - inline void setAsV (); - inline DbU::Unit getMin () const; - inline DbU::Unit getMax () const; - inline DbU::Unit getCenter () const; - DbU::Unit getAxis () const; - inline void setAxis ( DbU::Unit ); - inline void setiSet (); - inline bool isiSet () const; - void reset (); + IntervalC(); + IntervalC(const IntervalC&); + IntervalC(IntervalC&); + ~IntervalC(); + void set ( DbU::Unit, DbU::Unit, DbU::Unit ); + void setRange ( DbU::Unit, DbU::Unit ); + void extendMin ( DbU::Unit ); + void extendMax ( DbU::Unit ); + void print () const; + inline bool isH () const; + inline bool isV () const; + inline void setAsH (); + inline void setAsV (); + inline DbU::Unit getMin () const; + inline DbU::Unit getMax () const; + inline DbU::Unit getCenter () const; + DbU::Unit getAxis () const; + inline void setAxis ( DbU::Unit ); + inline void setiSet (); + inline bool isiSet () const; + void reset (); + + unsigned int getFlags () const; + void setFlags (unsigned int); private: unsigned int _flags; @@ -98,17 +83,86 @@ namespace Anabatic { DbU::Unit _axis; }; - inline void IntervalC::setAsH () { _flags = ((_flags & ~(0x3)) | iHorizontal); } - inline void IntervalC::setAsV () { _flags = ((_flags & ~(0x3)) | iVertical ); } - inline void IntervalC::setAxis ( DbU::Unit axis ) { _axis = axis; } - inline DbU::Unit IntervalC::getAxis () const { return _axis; } - inline DbU::Unit IntervalC::getCenter() const { return getMin()+getMax(); } - inline DbU::Unit IntervalC::getMin () const { return _min; } - inline DbU::Unit IntervalC::getMax () const { return _max; } - inline void IntervalC::setiSet () { _flags |= iSet; } - inline bool IntervalC::isiSet () const { return _flags & iSet; } - inline bool IntervalC::isH () const { return _flags & iHorizontal; } - inline bool IntervalC::isV () const { return _flags & iVertical ; } + inline void IntervalC::setAsH () { _flags = ((_flags & ~(0x3)) | iHorizontal); } + inline void IntervalC::setAsV () { _flags = ((_flags & ~(0x3)) | iVertical ); } + inline void IntervalC::setAxis ( DbU::Unit axis ) { _axis = axis; } + inline DbU::Unit IntervalC::getAxis () const { return _axis; } + inline DbU::Unit IntervalC::getCenter() const { return getMin()+getMax(); } + inline DbU::Unit IntervalC::getMin () const { return _min; } + inline DbU::Unit IntervalC::getMax () const { return _max; } + inline void IntervalC::setiSet () { _flags |= iSet; } + inline bool IntervalC::isiSet () const { return _flags & iSet; } + inline bool IntervalC::isH () const { return _flags & iHorizontal; } + inline bool IntervalC::isV () const { return _flags & iVertical ; } + inline void IntervalC::setFlags ( unsigned int f ) { _flags = f ; } + inline unsigned int IntervalC::getFlags () const { return _flags; } + +// ------------------------------------------------------------------- +// Class : "Anabatic::GRAData". + + class GRAData + { + private: + GRAData(); + ~GRAData(); + public: + static GRAData* create(); + //////////////////////////////////////// GRDATA + inline bool isiSet () const; + inline IntervalC getInterv () const; + inline IntervalC getIntervFrom () const; + inline DbU::Unit getIAxis () const; + inline DbU::Unit getIMax () const; + inline DbU::Unit getIMin () const; + inline DbU::Unit getPIAxis () const; + inline DbU::Unit getPIMax () const; + inline DbU::Unit getPIMin () const; + + inline IntervalC getIntervFrom2 () const; + inline DbU::Unit getPIMax2 () const; + inline DbU::Unit getPIMin2 () const; + inline DbU::Unit getPIAxis2 () const; + + inline void setInterv ( DbU::Unit, DbU::Unit, DbU::Unit ); + inline void setIntervfrom ( DbU::Unit, DbU::Unit, DbU::Unit ); + inline void setIntervfrom2 ( DbU::Unit, DbU::Unit, DbU::Unit ); + void resetIntervals (); + void clearFrom2 (); + inline Edge* getFrom2 () const; + inline void setFrom2 ( Edge* ); + inline void printInterv () const; + inline void printIntervfrom () const; + + private: + IntervalC _intervfrom; + IntervalC _interv; + Edge* _from2; + IntervalC _intervfrom2; + }; + + inline bool GRAData::isiSet () const { return _interv.isiSet() ; } + inline IntervalC GRAData::getInterv () const { return _interv; } + inline IntervalC GRAData::getIntervFrom() const { return _intervfrom; } + inline DbU::Unit GRAData::getIAxis () const { return _interv.getAxis() ; } + inline DbU::Unit GRAData::getIMax () const { return _interv.getMax() ; } + inline DbU::Unit GRAData::getIMin () const { return _interv.getMin() ; } + inline DbU::Unit GRAData::getPIAxis () const { return _intervfrom.getAxis(); } + inline DbU::Unit GRAData::getPIMax () const { return _intervfrom.getMax() ; } + inline DbU::Unit GRAData::getPIMin () const { return _intervfrom.getMin() ; } + + inline DbU::Unit GRAData::getPIMax2 () const { return _intervfrom2.getMax() ; } + inline DbU::Unit GRAData::getPIMin2 () const { return _intervfrom2.getMin() ; } + inline DbU::Unit GRAData::getPIAxis2 () const { return _intervfrom2.getAxis(); } + inline IntervalC GRAData::getIntervFrom2 () const { return _intervfrom2; } + + inline void GRAData::setInterv ( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) { _interv.set(min, max, axis); } + inline void GRAData::setIntervfrom ( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) { _intervfrom.set(min, max, axis); } + inline void GRAData::setIntervfrom2( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) { _intervfrom2.set(min, max, axis); } + + inline Edge* GRAData::getFrom2 () const { return _from2; } + inline void GRAData::setFrom2 ( Edge* from ) { _from2 = from; } + inline void GRAData::printInterv () const { _interv.print() ; } + inline void GRAData::printIntervfrom () const { _intervfrom.print(); } // ------------------------------------------------------------------- // Class : "Anabatic::Vertex". @@ -128,6 +182,9 @@ namespace Anabatic { , AxisTarget = (1<<4) , From2Mode = (1<<5) , UseFromFrom2 = (1<<6) + , iHorizontal = (1<<7) + , iVertical = (1<<8) + , iSet = (1<<9) }; public: static DbU::Unit unreached; @@ -184,64 +241,52 @@ namespace Anabatic { inline void setSRestricted (); inline void setERestricted (); inline void setWRestricted (); - //inline unsigned int getFlags () const; bool hasRP ( Net* ) const; bool hasVRP ( Net* ) const; bool hasHRP ( Net* ) const; - static bool isRestricted ( const Vertex* v1, const Vertex* v2 ); - static Point getNextPathPoint2( const Vertex*, const Vertex* ); - Point getPathPoint ( const Vertex * ) const; - inline void setIAsH (); - inline void setIAsV (); - inline DbU::Unit getIAxis () const; - //inline void setIAxis ( DbU::Unit ) ; - //inline DbU::Unit getICenter () const; - inline DbU::Unit getIMax () const; - inline DbU::Unit getIMin () const; - //inline void setPIAsH (); - //inline void setPIAsV (); - inline DbU::Unit getPIAxis () const; - //inline void setPIAxis ( DbU::Unit ) ; - //inline DbU::Unit getPICenter () const; - inline DbU::Unit getPIMax () const; - inline DbU::Unit getPIMin () const; - bool isH () const; - bool isV () const; - inline bool isiSet () const; - inline void setInterv ( DbU::Unit, DbU::Unit, DbU::Unit ); - inline void setIntervfrom ( DbU::Unit, DbU::Unit, DbU::Unit ); - //inline void setIRange ( DbU::Unit, DbU::Unit ); - //inline void setIRangeFrom ( DbU::Unit, DbU::Unit ); - //inline void printInterval () const ; - void setIntervals ( Vertex* ); - void resetIntervals (); - inline void setFlags ( unsigned int ); - inline bool isAxisTarget () const; - inline void unsetFlags ( unsigned int ); - inline void setAxisTarget (); - //DbU::Unit getXMinUnionfrom (); - //DbU::Unit getXMaxUnionfrom (); - //DbU::Unit getYMinUnionfrom (); - //DbU::Unit getYMaxUnionfrom (); - bool areSameSide ( const Vertex*, const Vertex* ) const; + static bool isRestricted ( const Vertex* v1, const Vertex* v2, DbU::Unit hpitch = 0, DbU::Unit vpitch = 0); + bool areSameSide ( const Vertex*, const Vertex* ) const; + + inline bool isFromFrom2 () const; + inline bool isFrom2Mode () const; + inline bool isAxisTarget () const; + inline bool isiHorizontal() const; + inline bool isiVertical () const; + inline void setFlags ( unsigned int ); + inline void unsetFlags ( unsigned int ); + bool isH () const; + bool isV () const; + inline void createAData (); + //////////////////////////////////// Point getStartPathPoint ( const Vertex* next ) const; Point getNextPathPoint ( Point, const Vertex* ) const; + //////////////////////////////////////// GRDATA + void setIntervals ( Vertex* ); + + bool isiSet () const; + DbU::Unit getIAxis () const; + DbU::Unit getIMax () const; + DbU::Unit getIMin () const; + DbU::Unit getPIAxis () const; + DbU::Unit getPIMax () const; + DbU::Unit getPIMin () const; + void setInterv ( DbU::Unit, DbU::Unit, DbU::Unit ); + void setIntervfrom ( DbU::Unit, DbU::Unit, DbU::Unit ); + void setIntervfrom2 ( DbU::Unit, DbU::Unit, DbU::Unit ); + void resetIntervals (); void clearFrom2 (); - inline void setFrom2Mode (); - inline void unsetFrom2Mode (); - inline bool isFrom2Mode () const; - inline Edge* getFrom2 () const; - inline bool isFromFrom2 () const; - inline void setFromFrom2 () ; - inline void unsetFromFrom2 () ; - //inline Vertex* getPredecessor2 () const; - inline void setFrom2 ( Edge* ); - inline void createIntervFrom2 (); - inline DbU::Unit getPIMax2 () const; - inline DbU::Unit getPIMin2 () const; - inline DbU::Unit getPIAxis2 () const; - inline IntervalC* getIntervFrom2 () const; - inline IntervalC* getIntervFrom () const; + Edge* getFrom2 () const; + void setFrom2 ( Edge* ); + void createIntervFrom2 (); + DbU::Unit getPIMax2 () const; + DbU::Unit getPIMin2 () const; + DbU::Unit getPIAxis2 () const; + IntervalC getIntervFrom2 () const; + IntervalC getIntervFrom ( unsigned int criteria = 0 ) const; + IntervalC getInterv () const; + void printInterv () const; + void printIntervfrom () const; + GCell* getGPrev ( unsigned int criteria = 0 ) const; // Inspector support. string _getString () const; @@ -261,10 +306,7 @@ namespace Anabatic { DbU::Unit _distance; Edge* _from; unsigned int _flags; - IntervalC* _intervfrom; - IntervalC* _interv; - Edge* _from2; - IntervalC* _intervfrom2; + GRAData* _adata; }; @@ -280,11 +322,7 @@ namespace Anabatic { , _distance(unreached) , _from (NULL) , _flags (NoRestriction) - - , _intervfrom (IntervalC::create()) - , _interv (IntervalC::create()) - , _from2 (NULL) - , _intervfrom2(NULL) + , _adata (NULL) { gcell->setObserver( GCell::Observable::Vertex, &_observer ); } @@ -340,50 +378,14 @@ namespace Anabatic { inline void Vertex::setSRestricted () { _flags |= SRestricted; } inline void Vertex::setERestricted () { _flags |= ERestricted; } inline void Vertex::setWRestricted () { _flags |= WRestricted; } -//inline unsigned int Vertex::getFlags () const { return _flags; } -//inline void Vertex::setIAxis ( DbU::Unit axis ) { _interv->setAxis(axis); } - inline DbU::Unit Vertex::getIAxis () const { return _interv->getAxis(); } - inline void Vertex::setIAsH () { _interv->setAsH(); } - inline void Vertex::setIAsV () { _interv->setAsV(); } -//inline DbU::Unit Vertex::getICenter () const { return _interv->getCenter(); } - inline DbU::Unit Vertex::getIMax () const { return _interv->getMax(); } - inline DbU::Unit Vertex::getIMin () const { return _interv->getMin(); } -//inline void Vertex::setPIAxis ( DbU::Unit axis ) { _intervfrom->setAxis(axis); } - inline DbU::Unit Vertex::getPIAxis () const { return _intervfrom->getAxis(); } -//inline void Vertex::setPIAsH () { _intervfrom->setAsH(); } -//inline void Vertex::setPIAsV () { _intervfrom->setAsV(); } -//inline DbU::Unit Vertex::getPICenter() const { return _intervfrom->getCenter(); } - inline DbU::Unit Vertex::getPIMax () const { return _intervfrom->getMax(); } - inline DbU::Unit Vertex::getPIMin () const { return _intervfrom->getMin(); } - inline bool Vertex::isiSet () const { return _interv->isiSet(); } - - inline void Vertex::setInterv ( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) { _interv->set(min, max, axis); } - inline void Vertex::setIntervfrom( DbU::Unit min, DbU::Unit max, DbU::Unit axis ) { _intervfrom->set(min, max, axis); } -//inline void Vertex::setIRange ( DbU::Unit min, DbU::Unit max ) { _interv->setRange(min, max); } -//inline void Vertex::setIRangeFrom( DbU::Unit min, DbU::Unit max ) { _intervfrom->setRange(min, max); } -//inline void Vertex::printInterval() const { _interv->print(); } - - inline void Vertex::setAxisTarget() { _flags |= AxisTarget; } - inline bool Vertex::isAxisTarget () const { return (_flags & AxisTarget); } + inline bool Vertex::isFromFrom2 () const { return (_flags & Vertex::UseFromFrom2); } + inline bool Vertex::isFrom2Mode () const { return (_flags & Vertex::From2Mode ); } + inline bool Vertex::isAxisTarget () const { return (_flags & Vertex::AxisTarget ); } + inline bool Vertex::isiHorizontal() const { return (_flags & Vertex::iHorizontal ); } + inline bool Vertex::isiVertical () const { return (_flags & Vertex::iVertical ); } + inline void Vertex::setFlags ( unsigned int mask ) { _flags |= mask ; } inline void Vertex::unsetFlags ( unsigned int mask ) { _flags &= ~mask; } - inline void Vertex::setFrom2Mode () { _flags |= Vertex::From2Mode; } - inline void Vertex::unsetFrom2Mode () { unsetFlags(Vertex::From2Mode); } - inline bool Vertex::isFrom2Mode () const { return (_flags & Vertex::From2Mode); } - inline Edge* Vertex::getFrom2 () const { return _from2; } - - inline void Vertex::setFromFrom2 () { _flags |= Vertex::UseFromFrom2; } - inline void Vertex::unsetFromFrom2 () { unsetFlags(Vertex::UseFromFrom2); } - inline bool Vertex::isFromFrom2 () const { return (_flags & Vertex::UseFromFrom2); } -//inline Vertex* Vertex::getPredecessor2 () const -//{ return (hasValidStamp() and _from2) ? _from2->getOpposite(_gcell)->getObserver(GCell::Observable::Vertex) : NULL; } - inline void Vertex::setFrom2 ( Edge* from ) { _from2=from; } - inline void Vertex::createIntervFrom2() { _intervfrom2 = IntervalC::create(); } - inline DbU::Unit Vertex::getPIMax2 () const { return _intervfrom2->getMax() ; } - inline DbU::Unit Vertex::getPIMin2 () const { return _intervfrom2->getMin() ; } - inline DbU::Unit Vertex::getPIAxis2 () const { return _intervfrom2->getAxis(); } - inline IntervalC* Vertex::getIntervFrom2 () const { return _intervfrom2; } - inline IntervalC* Vertex::getIntervFrom () const { return _intervfrom; } // ------------------------------------------------------------------- // Class : "Anabatic::PriorityQueue". @@ -489,8 +491,6 @@ namespace Anabatic { Dijkstra ( const Dijkstra& ); Dijkstra& operator= ( const Dijkstra& ); static DbU::Unit _distance ( const Vertex*, const Vertex*, const Edge* ); - DbU::Unit _getDistancetoRP ( Point ); - DbU::Unit _estimatePtoRP ( Point, RoutingPad*, Vertex* ); Point _getPonderedPoint () const; void _cleanup (); bool _propagate ( Flags enabledSides ); @@ -502,12 +502,23 @@ namespace Anabatic { void _checkEdges () const; void _createSelfSymSeg ( Segment* ); - inline void setAxisTarget (); - inline bool needAxisTarget () const; - inline void setFlags ( unsigned int ); - inline void unsetFlags ( unsigned int ); - void setAxisTargets (); - void unsetAxisTargets (); + inline void setAxisTarget (); + inline bool needAxisTarget () const; + inline void setFlags ( unsigned int ); + inline void unsetFlags ( unsigned int ); + void setAxisTargets (); + void unsetAxisTargets (); + + bool _attachSymContactsHook ( RoutingPad* ); + void _limitSymSearchArea ( RoutingPad* rp ); + void _setSourcesGRAData ( Vertex*, RoutingPad*); + bool _checkFrom2 ( Edge*, Vertex* ); + bool _isDistance2Shorter ( DbU::Unit&, Vertex*, Vertex*, Edge* ); + void _pushEqualDistance ( DbU::Unit, bool, Vertex*, Vertex*, Edge* ); + void _updateGRAData ( Vertex*, bool, Vertex* ); + void _initiateUpdateIntervals ( Vertex* ); + bool _updateIntervals ( bool&, Vertex*, bool&, int&, Edge* ); + private: AnabaticEngine* _anabatic; vector _vertexes; @@ -538,7 +549,7 @@ namespace Anabatic { inline DistanceT* Dijkstra::setDistance ( DistanceT cb ) { _distanceCb = cb; return _distanceCb.target(); } inline void Dijkstra::setFlags ( unsigned int mask ) { _flags |= mask; } - inline bool Dijkstra::needAxisTarget () const { return (_flags & Mode::AxisTarget); } + inline bool Dijkstra::needAxisTarget () const { return (_flags & Mode::AxisTarget); } inline void Dijkstra::unsetFlags ( unsigned int mask ) { _flags &= ~mask; } } // Anabatic namespace.