diff --git a/anabatic/src/AutoContact.cpp b/anabatic/src/AutoContact.cpp index 4e518188..51906edf 100644 --- a/anabatic/src/AutoContact.cpp +++ b/anabatic/src/AutoContact.cpp @@ -66,10 +66,10 @@ namespace Anabatic { , _contact (contact) , _gcell (gcell) , _flags (CntInvalidatedCache|CntInCreationStage) - , _dxMin (0) - , _dxMax ((int)DbU::toLambda(gcell->getConstraintXMax())) - , _dyMin () - , _dyMax ((int)DbU::toLambda(gcell->getConstraintYMax())) + , _xMin (_gcell->getXMin()) + , _xMax (_gcell->getConstraintXMax()) + , _yMin (_gcell->getYMin()) + , _yMax (_gcell->getConstraintYMax()) { _allocateds++; _gcell->addContact ( this ); @@ -300,16 +300,16 @@ namespace Anabatic { cdebug_log(145,0) << "AutoContact::setGCell() " << gcell << endl; _gcell->addContact( this ); _contact->setPosition( _gcell->getCenter() ); - _dxMin = 0; - _dyMin = 0; - _dxMax = (int)DbU::toLambda( gcell->getConstraintXMax() ); - _dyMax = (int)DbU::toLambda( gcell->getConstraintYMax() ); + _xMin = _gcell->getXMin(); + _yMin = _gcell->getYMin(); + _xMax = _gcell->getConstraintXMax(); + _yMax = _gcell->getConstraintYMax(); if (cdebug.enabled()) { - int dxMin = _dxMin; - int dyMin = _dyMin; - int dxMax = _dxMax; - int dyMax = _dyMax; - cdebug_log(145,0) << "* deltas: [" << dxMin << " " << dyMin << " " << dxMax << " " << dyMax << "]" << endl; + cdebug_log(145,0) << "* deltas: [" << DbU::getValueString(_xMin) + << " " << DbU::getValueString(_yMin) + << " " << DbU::getValueString(_xMax) + << " " << DbU::getValueString(_yMax) + << "]" << endl; } } else { cerr << Bug( "NULL GCell for %s.", _getString().c_str() ) << endl; @@ -443,14 +443,14 @@ namespace Anabatic { cerr << Error ( "Incompatible DY restriction on %s", _getString().c_str() ) << endl; if ( constraintMin > getCBYMax() ) - cerr << Error ( "(constraintMin > CBYMax : %.2lf > %.2lf)" - , DbU::toLambda(constraintMin) - , DbU::toLambda(getCBYMax()) ) + cerr << Error ( "(constraintMin > CBYMax : %s > %s)" + , DbU::getValueString(constraintMin).c_str() + , DbU::getValueString(getCBYMax()).c_str() ) << endl; if ( constraintMax < getCBYMin() ) - cerr << Error ( "(constraintMax < CBYMin : %.2lf < %.2lf)" - , DbU::toLambda(constraintMax) - , DbU::toLambda(getCBYMin()) ) + cerr << Error ( "(constraintMax < CBYMin : %s < %s)" + , DbU::getValueString(constraintMax).c_str() + , DbU::getValueString(getCBYMin()).c_str() ) << endl; return false; } @@ -462,14 +462,14 @@ namespace Anabatic { cerr << Error ( "Incompatible DX restriction on %s", _getString().c_str() ) << endl; if ( constraintMin > getCBXMax() ) - cerr << Error ( "(constraintMin > CBXMax : %.2lf > %.2lf)" - , DbU::toLambda(constraintMin) - , DbU::toLambda(getCBXMax()) ) + cerr << Error ( "(constraintMin > CBXMax : %s > %s)" + , DbU::getValueString(constraintMin).c_str() + , DbU::getValueString(getCBXMax()).c_str() ) << endl; if ( constraintMax < getCBXMin() ) - cerr << Error ( "(constraintMax < CBXMin : %.2lf < %.2lf)" - , DbU::toLambda(constraintMax) - , DbU::toLambda(getCBXMin()) ) + cerr << Error ( "(constraintMax < CBXMin : %s < %s)" + , DbU::getValueString(constraintMax).c_str() + , DbU::getValueString(getCBXMin()).c_str() ) << endl; return false; } diff --git a/anabatic/src/anabatic/AutoContact.h b/anabatic/src/anabatic/AutoContact.h index 70921038..4eeb941f 100644 --- a/anabatic/src/anabatic/AutoContact.h +++ b/anabatic/src/anabatic/AutoContact.h @@ -179,10 +179,10 @@ namespace Anabatic { Contact* _contact; GCell* _gcell; unsigned int _flags; - int _dxMin:8; - int _dxMax:8; - int _dyMin:8; - int _dyMax:8; + DbU::Unit _xMin; + DbU::Unit _xMax; + DbU::Unit _yMin; + DbU::Unit _yMax; protected: // Constructors & Destructors. @@ -196,8 +196,8 @@ namespace Anabatic { AutoContact& operator= ( const AutoContact& ); protected: - inline int _getDeltaMin ( DbU::Unit x, DbU::Unit xMin ); - inline int _getDeltaMax ( DbU::Unit x, DbU::Unit xMin, DbU::Unit xMax ); + inline int _boundX ( DbU::Unit x ) const; + inline int _boundY ( DbU::Unit x ) const; static void _getTopology ( Contact*, Component*& anchor, Horizontal**&, Vertical**&, size_t ); virtual void _invalidate ( unsigned int flags ) = 0; }; @@ -246,26 +246,16 @@ namespace Anabatic { inline Contact* AutoContact::base () const { return _contact; } inline GCell* AutoContact::getGCell () const { return _gcell; } inline Box AutoContact::getConstraintBox () const { return Box(getCBXMin(),getCBYMin(),getCBXMax(),getCBYMax()); } - inline void AutoContact::setCBXMin ( DbU::Unit xMin ) { _dxMin = _getDeltaMin(xMin,_gcell->getXMin()); } - inline void AutoContact::setCBXMax ( DbU::Unit xMax ) { _dxMax = _getDeltaMax(xMax,_gcell->getXMin(),_gcell->getConstraintXMax()); } - inline void AutoContact::setCBYMin ( DbU::Unit yMin ) { _dyMin = _getDeltaMin(yMin,_gcell->getYMin()); } - inline void AutoContact::setCBYMax ( DbU::Unit yMax ) { _dyMax = _getDeltaMax(yMax,_gcell->getYMin(),_gcell->getConstraintYMax()); } + inline void AutoContact::setCBXMin ( DbU::Unit xMin ) { _xMin = _boundX(xMin); } + inline void AutoContact::setCBXMax ( DbU::Unit xMax ) { _xMax = _boundX(xMax); } + inline void AutoContact::setCBYMin ( DbU::Unit yMin ) { _yMin = _boundY(yMin); } + inline void AutoContact::setCBYMax ( DbU::Unit yMax ) { _yMax = _boundY(yMax); } inline void AutoContact::setFlags ( unsigned int flags ) { _flags|= flags; } inline void AutoContact::unsetFlags ( unsigned int flags ) { _flags&=~flags; } - inline int AutoContact::_getDeltaMin ( DbU::Unit x, DbU::Unit xMin ) { if (xxMax) x=xMax; return (int)DbU::toLambda(x-xMin); } - - inline DbU::Unit AutoContact::getCBXMin () const - { return isFixed() ? _contact->getX() : DbU::fromLambda(_dxMin) + _gcell->getXMin(); } - - inline DbU::Unit AutoContact::getCBXMax () const - { return isFixed() ? _contact->getX() : DbU::fromLambda(_dxMax) + _gcell->getXMin(); } - - inline DbU::Unit AutoContact::getCBYMin () const - { return isFixed() ? _contact->getY() : DbU::fromLambda(_dyMin) + _gcell->getYMin(); } - - inline DbU::Unit AutoContact::getCBYMax () const - { return isFixed() ? _contact->getY() : DbU::fromLambda(_dyMax) + _gcell->getYMin(); } + inline DbU::Unit AutoContact::getCBXMin () const { return isFixed() ? _contact->getX() : _xMin; } + inline DbU::Unit AutoContact::getCBXMax () const { return isFixed() ? _contact->getX() : _xMax; } + inline DbU::Unit AutoContact::getCBYMin () const { return isFixed() ? _contact->getY() : _yMin; } + inline DbU::Unit AutoContact::getCBYMax () const { return isFixed() ? _contact->getY() : _yMax; } inline unsigned int AutoContact::getMinDepth () const { size_t minDepth, maxDepth; getDepthSpan(minDepth,maxDepth); return minDepth; } @@ -273,6 +263,14 @@ namespace Anabatic { inline unsigned int AutoContact::getMaxDepth () const { size_t minDepth, maxDepth; getDepthSpan(minDepth,maxDepth); return maxDepth; } + inline int AutoContact::_boundX ( DbU::Unit x ) const + { return (x<_gcell->getXMin()) ? _gcell->getXMin() + : ((x>_gcell->getConstraintXMax()) ? _gcell->getConstraintXMax() : x); } + + inline int AutoContact::_boundY ( DbU::Unit y ) const + { return (y<_gcell->getYMin()) ? _gcell->getYMin() + : ((y>_gcell->getConstraintYMax()) ? _gcell->getConstraintYMax() : y); } + // ------------------------------------------------------------------- // Class : "Anabatic::LocatorHelper".