Temporary commit to pull and merge last commit.
This commit is contained in:
parent
36a982ce47
commit
8016157500
|
@ -113,6 +113,49 @@ namespace Anabatic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Dijkstra::isRestricted ( const Vertex* v1, const Vertex* v2 ) const
|
||||||
|
{
|
||||||
|
bool restricted = true;
|
||||||
|
GCell* c1 = v1->getGCell();
|
||||||
|
GCell* c2 = v2->getGCell();
|
||||||
|
|
||||||
|
// Check from GCell 1
|
||||||
|
if ( c1->isNorth(c2) ) {
|
||||||
|
if ( !v1->isNRestricted() ) restricted = false;
|
||||||
|
} else if ( c1->isSouth(c2) ) {
|
||||||
|
if ( !v1->isSRestricted() ) restricted = false;
|
||||||
|
} else if ( c1->isEast (c2) ) {
|
||||||
|
if ( !v1->isERestricted() ) restricted = false;
|
||||||
|
} else if ( c1->isWest (c2) ) {
|
||||||
|
if ( !v1->isWRestricted() ) restricted = false;
|
||||||
|
} else {
|
||||||
|
cerr << Error( "GCells are not side by side." ) << endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (restricted) return true;
|
||||||
|
else {
|
||||||
|
// Check from GCell 2
|
||||||
|
if ( c2->isNorth(c1) ) {
|
||||||
|
if ( v2->isNRestricted() ) return true;
|
||||||
|
else return false;
|
||||||
|
} else if ( c2->isSouth(c1) ) {
|
||||||
|
if ( v2->isSRestricted() ) return true;
|
||||||
|
else return false;
|
||||||
|
} else if ( c2->isEast (c1) ) {
|
||||||
|
if ( v2->isERestricted() ) return true;
|
||||||
|
else return false;
|
||||||
|
} else if ( c2->isWest (c1) ) {
|
||||||
|
if ( v2->isWRestricted() ) return true;
|
||||||
|
else return false;
|
||||||
|
} else {
|
||||||
|
cerr << Error( "GCells are not side by side." ) << endl;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Dijkstra::Dijkstra ( AnabaticEngine* anabatic )
|
Dijkstra::Dijkstra ( AnabaticEngine* anabatic )
|
||||||
: _anabatic (anabatic)
|
: _anabatic (anabatic)
|
||||||
, _vertexes ()
|
, _vertexes ()
|
||||||
|
|
|
@ -573,6 +573,58 @@ namespace Anabatic {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GCell::isNorth ( GCell* c ) const
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (vector<Edge*>::const_iterator it = _northEdges.begin(); it != _northEdges.end(); it++){
|
||||||
|
if ( (*it)->getOpposite(this)->getId() == getId() ) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GCell::isSouth ( GCell* c ) const
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (vector<Edge*>::const_iterator it = _southEdges.begin(); it != _southEdges.end(); it++){
|
||||||
|
if ( (*it)->getOpposite(this)->getId() == getId() ) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GCell::isEast ( GCell* c ) const
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (vector<Edge*>::const_iterator it = _eastEdges.begin(); it != _eastEdges.end(); it++){
|
||||||
|
if ( (*it)->getOpposite(this)->getId() == getId() ) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GCell::isWest ( GCell* c ) const
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
for (vector<Edge*>::const_iterator it = _westEdges.begin(); it != _westEdges.end(); it++){
|
||||||
|
if ( (*it)->getOpposite(this)->getId() == getId() ) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
string GCell::_getTypeName () const
|
string GCell::_getTypeName () const
|
||||||
{ return getString(_extensionName); }
|
{ return getString(_extensionName); }
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,13 @@ namespace Anabatic {
|
||||||
public:
|
public:
|
||||||
inline bool operator() ( const Vertex* lhs, const Vertex* rhs );
|
inline bool operator() ( const Vertex* lhs, const Vertex* rhs );
|
||||||
};
|
};
|
||||||
|
public:
|
||||||
|
enum FlagR { NoRestriction = 0
|
||||||
|
, NRestricted = (1<<0)
|
||||||
|
, SRestricted = (1<<1)
|
||||||
|
, ERestricted = (1<<2)
|
||||||
|
, WRestricted = (1<<3)
|
||||||
|
};
|
||||||
public:
|
public:
|
||||||
static float unreached;
|
static float unreached;
|
||||||
public:
|
public:
|
||||||
|
@ -67,6 +74,15 @@ namespace Anabatic {
|
||||||
inline void setStamp ( int );
|
inline void setStamp ( int );
|
||||||
inline void setConnexId ( int );
|
inline void setConnexId ( int );
|
||||||
inline void setFrom ( Edge* );
|
inline void setFrom ( Edge* );
|
||||||
|
|
||||||
|
inline bool isNorth ( Vertex* ) const;
|
||||||
|
inline bool isSouth ( Vertex* ) const;
|
||||||
|
inline bool isEast ( Vertex* ) const;
|
||||||
|
inline bool isWest ( Vertex* ) const;
|
||||||
|
inline bool isNRestricted () const;
|
||||||
|
inline bool isSRestricted () const;
|
||||||
|
inline bool isERestricted () const;
|
||||||
|
inline bool isWRestricted () const;
|
||||||
// Inspector support.
|
// Inspector support.
|
||||||
string _getString () const;
|
string _getString () const;
|
||||||
private:
|
private:
|
||||||
|
@ -80,6 +96,7 @@ namespace Anabatic {
|
||||||
int _stamp;
|
int _stamp;
|
||||||
float _distance;
|
float _distance;
|
||||||
Edge* _from;
|
Edge* _from;
|
||||||
|
FlagR _flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,6 +108,7 @@ namespace Anabatic {
|
||||||
, _stamp (-1)
|
, _stamp (-1)
|
||||||
, _distance(unreached)
|
, _distance(unreached)
|
||||||
, _from (NULL)
|
, _from (NULL)
|
||||||
|
, _flags (NoRestriction)
|
||||||
{
|
{
|
||||||
gcell->setObserver( GCell::Observable::Vertex, &_observer );
|
gcell->setObserver( GCell::Observable::Vertex, &_observer );
|
||||||
}
|
}
|
||||||
|
@ -129,6 +147,15 @@ namespace Anabatic {
|
||||||
|
|
||||||
typedef set<Vertex*,Vertex::CompareById> VertexSet;
|
typedef set<Vertex*,Vertex::CompareById> VertexSet;
|
||||||
|
|
||||||
|
inline bool Vertex::isNorth ( Vertex* v ) const { return _gcell->isNorth(v->getGCell()); }
|
||||||
|
inline bool Vertex::isSouth ( Vertex* v ) const { return _gcell->isSouth(v->getGCell()); }
|
||||||
|
inline bool Vertex::isEast ( Vertex* v ) const { return _gcell->isEast (v->getGCell()); }
|
||||||
|
inline bool Vertex::isWest ( Vertex* v ) const { return _gcell->isWest (v->getGCell()); }
|
||||||
|
inline bool Vertex::isNRestricted () const { return (_flags & NRestricted); }
|
||||||
|
inline bool Vertex::isSRestricted () const { return (_flags & SRestricted); }
|
||||||
|
inline bool Vertex::isERestricted () const { return (_flags & ERestricted); }
|
||||||
|
inline bool Vertex::isWRestricted () const { return (_flags & WRestricted); }
|
||||||
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
// -------------------------------------------------------------------
|
||||||
// Class : "Anabatic::PriorityQueue".
|
// Class : "Anabatic::PriorityQueue".
|
||||||
|
@ -214,6 +241,7 @@ namespace Anabatic {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float getDistance ( const Vertex*, const Vertex*, const Edge* );
|
float getDistance ( const Vertex*, const Vertex*, const Edge* );
|
||||||
|
bool isRestricted ( const Vertex*, const Vertex* ) const;
|
||||||
public:
|
public:
|
||||||
Dijkstra ( AnabaticEngine* );
|
Dijkstra ( AnabaticEngine* );
|
||||||
~Dijkstra ();
|
~Dijkstra ();
|
||||||
|
|
|
@ -101,6 +101,11 @@ namespace Anabatic {
|
||||||
GCell* vcut ( DbU::Unit x );
|
GCell* vcut ( DbU::Unit x );
|
||||||
bool doGrid ();
|
bool doGrid ();
|
||||||
Contact* getGContact ( Net* );
|
Contact* getGContact ( Net* );
|
||||||
|
|
||||||
|
bool isNorth ( GCell* ) const;
|
||||||
|
bool isSouth ( GCell* ) const;
|
||||||
|
bool isEast ( GCell* ) const;
|
||||||
|
bool isWest ( GCell* ) const;
|
||||||
// Misc. functions.
|
// Misc. functions.
|
||||||
inline const Flags& flags () const;
|
inline const Flags& flags () const;
|
||||||
inline Flags& flags ();
|
inline Flags& flags ();
|
||||||
|
|
Loading…
Reference in New Issue