Katabatic - Routing Toolbox


AutoSegment.h
1 // -*- C++ -*-
2 //
3 // This file is part of the Coriolis Software.
4 // Copyright (c) UPMC 2008-2018, All Rights Reserved
5 //
6 // +-----------------------------------------------------------------+
7 // | C O R I O L I S |
8 // | K a t a b a t i c - Routing Toolbox |
9 // | |
10 // | Author : Jean-Paul CHAPUT |
11 // | E-mail : Jean-Paul.Chaput@lip6.fr |
12 // | =============================================================== |
13 // | C++ Header : "./katabatic/AutoSegment.h" |
14 // +-----------------------------------------------------------------+
15 
16 
17 #ifndef KATABATIC_AUTOSEGMENT_H
18 #define KATABATIC_AUTOSEGMENT_H
19 
20 #include <set>
21 #include <iostream>
22 #include <functional>
23 #include "hurricane/Interval.h"
24 #include "hurricane/Segment.h"
25 #include "hurricane/Components.h"
26 #include "hurricane/Contact.h"
27 namespace Hurricane {
28  class Layer;
29  class Horizontal;
30  class Vertical;
31  class Cell;
32 }
33 #include "crlcore/RoutingGauge.h"
34 #include "katabatic/Constants.h"
35 #include "katabatic/Observer.h"
36 #include "katabatic/GCell.h"
37 #include "katabatic/AutoSegments.h"
38 #include "katabatic/Session.h"
39 
40 
41 namespace Katabatic {
42 
43 
44  using std::set;
45  using std::cerr;
46  using std::endl;
47  using std::binary_function;
48  using Hurricane::tab;
49  using Hurricane::Interval;
50  using Hurricane::Layer;
53  using Hurricane::Vertical;
54  using Hurricane::Cell;
55  using CRL::RoutingGauge;
56 
57  class AutoHorizontal;
58  class AutoVertical;
59 
60 // -------------------------------------------------------------------
61 // Class : "AutoSegment".
62 
63  enum AutoSegmentFlag { SegNoFlags = 0x0
64  , SegHorizontal = (1<< 0)
65  , SegFixed = (1<< 1)
66  , SegGlobal = (1<< 2)
67  , SegWeakGlobal = (1<< 3)
68  , SegCanonical = (1<< 4)
69  , SegBipoint = (1<< 5)
70  , SegDogleg = (1<< 6)
71  , SegStrap = (1<< 7)
72  , SegSourceTop = (1<< 8)
73  , SegSourceBottom = (1<< 9)
74  , SegTargetTop = (1<<10)
75  , SegTargetBottom = (1<<11)
76  , SegIsReduced = (1<<12)
77  , SegLayerChange = (1<<13)
78  , SegSourceTerminal = (1<<14) // Replace Terminal.
79  , SegTargetTerminal = (1<<15) // Replace Terminal.
80  , SegStrongTerminal = SegSourceTerminal|SegTargetTerminal
81  , SegWeakTerminal1 = (1<<16) // Replace TopologicalEnd.
82  , SegWeakTerminal2 = (1<<17) // Replace TopologicalEnd.
83  , SegNotSourceAligned = (1<<18)
84  , SegNotTargetAligned = (1<<19)
85  , SegUnbound = (1<<20)
86  , SegHalfSlackened = (1<<21)
87  , SegSlackened = (1<<22)
88  , SegAxisSet = (1<<23)
89  , SegInvalidated = (1<<24)
90  , SegInvalidatedSource = (1<<25)
91  , SegInvalidatedTarget = (1<<26)
92  , SegInvalidatedLayer = (1<<27)
93  , SegCreated = (1<<28)
94  , SegUserDefined = (1<<29)
95  // Masks.
98  , SegSpinTop = SegSourceTop |SegTargetTop
99  , SegSpinBottom = SegSourceBottom |SegTargetBottom
100  , SegDepthSpin = SegSpinTop |SegSpinBottom
101  };
102 
103 
104  class AutoSegment {
105  friend class AutoHorizontal;
106  friend class AutoVertical;
107 
108  public:
109  enum ObserverFlag { Create = 0x000000001
110  , Destroy = 0x000000002
111  , Invalidate = 0x000000004
112  , Revalidate = 0x000000008
113  , RevalidatePPitch = 0x000000010
114  };
115  public:
116  typedef std::function< void(AutoSegment*) > RevalidateCb_t;
117  public:
118  static void setDestroyMode ( bool );
119  static AutoSegment* create ( AutoContact* source
120  , AutoContact* target
121  , Segment* hurricaneSegment
122  );
123  static AutoSegment* create ( AutoContact* source
124  , AutoContact* target
125  , unsigned int dir
126  , size_t depth=RoutingGauge::nlayerdepth
127  );
128  void destroy ();
129  // Wrapped Segment Functions.
130  virtual Segment* base () const = 0;
131  virtual Segment* base () = 0;
132  virtual Horizontal* getHorizontal () { return NULL; };
133  virtual Vertical* getVertical () { return NULL; };
134  inline Cell* getCell () const;
135  inline Net* getNet () const;
136  inline const Layer* getLayer () const;
137  inline Box getBoundingBox () const;
138  inline Hook* getSourceHook ();
139  inline Hook* getTargetHook ();
140  inline Contact* getSource () const;
141  inline Contact* getTarget () const;
142  inline Component* getOppositeAnchor ( Component* ) const;
143  inline Components getAnchors () const;
144  virtual DbU::Unit getX () const;
145  virtual DbU::Unit getY () const;
146  inline DbU::Unit getWidth () const;
147  inline DbU::Unit getLength () const;
148  inline DbU::Unit getSourcePosition () const;
149  inline DbU::Unit getTargetPosition () const;
150  inline DbU::Unit getSourceX () const;
151  inline DbU::Unit getSourceY () const;
152  inline DbU::Unit getTargetX () const;
153  inline DbU::Unit getTargetY () const;
154  inline void invert ();
155  inline void setLayer ( const Layer* );
156  // Predicates.
157  inline bool isHorizontal () const;
158  inline bool isVertical () const;
159  inline bool isGlobal () const;
160  inline bool isWeakGlobal () const;
161  inline bool isLocal () const;
162  inline bool isFixed () const;
163  inline bool isBipoint () const;
164  inline bool isWeakTerminal () const;
165  inline bool isWeakTerminal1 () const;
166  inline bool isWeakTerminal2 () const;
167  inline bool isTerminal () const;
168  inline bool isNotSourceAligned () const;
169  inline bool isNotTargetAligned () const;
170  inline bool isNotAligned () const;
171  bool isStrongTerminal ( unsigned int flags=0 ) const;
172  inline bool isSourceTerminal () const;
173  inline bool isTargetTerminal () const;
174  inline bool isLayerChange () const;
175  inline bool isSpinTop () const;
176  inline bool isSpinBottom () const;
177  inline bool isSpinTopOrBottom () const;
178  inline bool isReduced () const;
179  inline bool isStrap () const;
180  inline bool isDogleg () const;
181  inline bool isUnbound () const;
182  inline bool isInvalidated () const;
183  inline bool isInvalidatedLayer () const;
184  inline bool isCreated () const;
185  inline bool isCanonical () const;
186  inline bool isUnsetAxis () const;
187  inline bool isSlackened () const;
188  inline bool isUserDefined () const;
189  bool isReduceCandidate () const;
190  bool isUTurn () const;
191  virtual bool _canSlacken () const = 0;
192  bool canReduce () const;
193  bool mustRaise () const;
194  unsigned int canDogleg ( Interval );
195  virtual bool canMoveULeft ( float reserve=0.0 ) const = 0;
196  virtual bool canMoveURight ( float reserve=0.0 ) const = 0;
197  bool canMoveUp ( float reserve=0.0, unsigned int flags=0 ) const;
198  bool canPivotUp ( float reserve=0.0, unsigned int flags=0 ) const;
199  bool canPivotDown ( float reserve=0.0, unsigned int flags=0 ) const;
200  bool canSlacken ( unsigned int flags=0 ) const;
201  virtual bool checkPositions () const = 0;
202  virtual bool checkConstraints () const = 0;
203  bool checkDepthSpin () const;
204  // Accessors.
205  template< typename T >
206  inline T* getObserver ();
207  inline unsigned long getId () const;
208  inline unsigned int getFlags () const;
209  virtual unsigned int getDirection () const = 0;
210  inline GCell* getGCell () const;
211  virtual size_t getGCells ( vector<GCell*>& ) const = 0;
212  inline AutoContact* getAutoSource () const;
213  inline AutoContact* getAutoTarget () const;
215  size_t getPerpandicularsBound ( set<AutoSegment*>& );
216  inline AutoSegment* getParent () const;
217  inline unsigned int getDepth () const;
218  inline DbU::Unit getPitch () const;
219  DbU::Unit getPPitch () const;
220  inline DbU::Unit getAxis () const;
221  virtual DbU::Unit getSourceU () const = 0;
222  virtual DbU::Unit getTargetU () const = 0;
223  virtual DbU::Unit getDuSource () const = 0;
224  virtual DbU::Unit getDuTarget () const = 0;
225  inline DbU::Unit getOrigin () const;
226  inline DbU::Unit getExtremity () const;
227  virtual Interval getSpanU () const = 0;
228  Interval getMinSpanU () const;
229  virtual Interval getSourceConstraints ( unsigned int flags=0 ) const = 0;
230  virtual Interval getTargetConstraints ( unsigned int flags=0 ) const = 0;
231  virtual bool getConstraints ( DbU::Unit& min, DbU::Unit& max ) const = 0;
232  inline bool getConstraints ( Interval& i ) const;
233  inline const Interval& getUserConstraints () const;
234  virtual DbU::Unit getSlack () const;
235  inline DbU::Unit getOptimalMin () const;
236  inline DbU::Unit getOptimalMax () const;
237  Interval& getOptimal ( Interval& i ) const;
238  virtual DbU::Unit getCost ( DbU::Unit axis ) const;
239  virtual AutoSegment* getCanonical ( DbU::Unit& min , DbU::Unit& max );
240  inline AutoSegment* getCanonical ( Interval& i );
241  float getMaxUnderDensity ( unsigned int flags );
242  // Modifiers.
243  inline void addObserver ( BaseObserver* );
244  inline void removeObserver ( BaseObserver* );
245  inline void unsetFlags ( unsigned int );
246  inline void setFlags ( unsigned int );
247  void setFlagsOnAligneds ( unsigned int );
248  inline void incReduceds ();
249  inline void decReduceds ();
250  virtual void setDuSource ( DbU::Unit du ) = 0;
251  virtual void setDuTarget ( DbU::Unit du ) = 0;
252  void computeTerminal ();
253  virtual void updateOrient () = 0;
254  virtual void updatePositions () = 0;
255  void updateSourceSpin ();
256  void updateTargetSpin ();
257  void sourceDetach ();
258  void targetDetach ();
259  void sourceAttach ( AutoContact* );
260  void targetAttach ( AutoContact* );
261  //inline void mergeUserConstraints ( const Interval& );
262  void mergeUserConstraints ( const Interval& );
263  inline void resetUserConstraints ();
264  inline void setOptimalMin ( DbU::Unit min );
265  inline void setOptimalMax ( DbU::Unit max );
266  bool checkNotInvalidated () const;
267  inline void setParent ( AutoSegment* );
268  void revalidate ();
270  unsigned int makeDogleg ( Interval, unsigned int flags=KbNoFlags );
271  unsigned int makeDogleg ( GCell*, unsigned int flags=KbNoFlags );
272  virtual unsigned int _makeDogleg ( GCell*, unsigned int flags ) = 0;
273  virtual bool moveULeft () = 0;
274  virtual bool moveURight () = 0;
275  bool slacken ( unsigned int flags );
276  virtual bool _slacken ( unsigned int flags ) = 0;
277  void _changeDepth ( unsigned int depth, unsigned int flags );
278  void changeDepth ( unsigned int depth, unsigned int flags );
279  bool moveUp ( unsigned int flags=KbNoFlags );
280  bool moveDown ( unsigned int flags=KbNoFlags );
281  bool reduceDoglegLayer ();
282  bool reduce ();
283  bool raise ();
284  // Canonical Modifiers.
285  AutoSegment* canonize ( unsigned int flags=KbNoFlags );
286  virtual void invalidate ( unsigned int flags=KbPropagate );
287  void invalidate ( AutoContact* );
288  void computeOptimal ( set<AutoSegment*>& processeds );
289  void setAxis ( DbU::Unit, unsigned int flags=KbNoFlags );
290  bool toConstraintAxis ( unsigned int flags=KbRealignate );
291  bool toOptimalAxis ( unsigned int flags=KbRealignate );
292  // Collections & Filters.
293  AutoSegments getOnSourceContact ( unsigned int direction );
294  AutoSegments getOnTargetContact ( unsigned int direction );
295  AutoSegments getCachedOnSourceContact ( unsigned int direction );
296  AutoSegments getCachedOnTargetContact ( unsigned int direction );
297  AutoSegments getAligneds ( unsigned int flags=KbNoFlags );
299  size_t getAlignedContacts ( map<AutoContact*,int>& ) const ;
300  // Inspector Management.
301  virtual Record* _getRecord () const = 0;
302  virtual string _getString () const = 0;
303  virtual string _getTypeName () const = 0;
304  // Non-reviewed atomic modifiers.
305  bool _check () const;
306 #if THIS_IS_DISABLED
307  virtual void desalignate ( AutoContact* ) = 0;
308  bool shearUp ( GCell*
309  , AutoSegment*& movedUp
310  , float reserve
311  , unsigned int flags );
312 #endif
313 
314  protected:
315  // Internal: Static Attributes.
316  static size_t _allocateds;
317  static size_t _globalsCount;
318  static bool _destroyBase;
319  static bool _destroyTool;
320  static unsigned long _maxId;
321  // Internal: Attributes.
322  GCell* _gcell;
323  const unsigned long _id;
324  unsigned int _flags;
325  unsigned int _depth : 8;
326  unsigned int _optimalMin : 8;
327  unsigned int _optimalMax : 8;
328  unsigned int _reduceds : 2;
329  DbU::Unit _sourcePosition;
330  DbU::Unit _targetPosition;
331  Interval _userConstraints;
332  AutoSegment* _parent;
333  Observable _observers;
334 
335  // Internal: Constructors & Destructors.
336  protected:
337  AutoSegment ( Segment* segment );
338  virtual ~AutoSegment ();
339  static void _preCreate ( AutoContact* source, AutoContact* target );
340  virtual void _postCreate ();
341  virtual void _preDestroy ();
342  private:
343  AutoSegment ( const AutoSegment& );
344  AutoSegment& operator= ( const AutoSegment& );
345  protected:
346  void _invalidate ();
347  inline unsigned int _getFlags () const;
348  std::string _getStringFlags () const;
349  virtual void _setAxis ( DbU::Unit ) = 0;
350 
351  public:
352  struct CompareId : public binary_function<AutoSegment*,AutoSegment*,bool> {
353  inline bool operator() ( const AutoSegment* lhs, const AutoSegment* rhs ) const;
354  };
355  public:
356  struct CompareByDepthLength : public binary_function<AutoSegment*,AutoSegment*,bool> {
357  bool operator() ( AutoSegment* lhs, AutoSegment* rhs ) const;
358  };
359  public:
360  struct CompareByDepthAxis : public binary_function<AutoSegment*,AutoSegment*,bool> {
361  bool operator() ( AutoSegment* lhs, AutoSegment* rhs ) const;
362  };
363  public:
364  typedef std::set<AutoSegment*,CompareByDepthLength> DepthLengthSet;
365 
366  // Static Utilities.
367  public:
368  static inline bool areAlignedsAndDiffLayer ( AutoSegment*, AutoSegment* );
369  static bool isTopologicalBound ( AutoSegment* seed, unsigned int flags );
370  static inline bool arePerpandiculars ( AutoSegment* a, AutoSegment* b );
371  static inline bool arePerpandiculars ( bool isHorizontalA, AutoSegment* b );
372  static inline bool areAligneds ( AutoSegment* a, AutoSegment* b );
373  static unsigned int getPerpandicularState ( AutoContact* contact
374  , AutoSegment* source
375  , AutoSegment* current
376  , bool isHorizontalMaster
377  , const Layer* masterLayer=NULL
378  );
379  static inline unsigned int getPerpandicularState ( AutoContact* contact
380  , AutoSegment* source
381  , AutoSegment* current
382  , AutoSegment* master
383  );
384  static void getTopologicalInfos ( AutoSegment* seed
385  , vector<AutoSegment*>& collapseds
386  , vector<AutoSegment*>& perpandiculars
387  , DbU::Unit& leftBound
388  , DbU::Unit& rightBound
389  );
390  static int getTerminalCount ( AutoSegment* seed
391  , vector<AutoSegment*>& collapseds
392  );
393  static inline int getTerminalCount ( AutoSegment* seed );
394  static inline size_t getGlobalsCount ();
395  static inline size_t getAllocateds ();
396  static inline unsigned long getMaxId ();
397  };
398 
399 
400 // Inline Functions.
401  inline void AutoSegment::addObserver ( BaseObserver* observer ) { _observers.addObserver(observer); }
402  inline void AutoSegment::removeObserver ( BaseObserver* observer ) { _observers.removeObserver(observer); }
403  inline unsigned long AutoSegment::getId () const { return _id; }
404  inline Cell* AutoSegment::getCell () const { return base()->getCell(); }
405  inline Net* AutoSegment::getNet () const { return base()->getNet(); }
406  inline const Layer* AutoSegment::getLayer () const { return base()->getLayer(); }
407  inline Box AutoSegment::getBoundingBox () const { return base()->getBoundingBox(); }
408  inline Hook* AutoSegment::getSourceHook () { return base()->getSourceHook(); }
409  inline Hook* AutoSegment::getTargetHook () { return base()->getTargetHook(); }
410  inline Contact* AutoSegment::getSource () const { return static_cast<Contact*>(base()->getSource()); }
411  inline Contact* AutoSegment::getTarget () const { return static_cast<Contact*>(base()->getTarget()); }
412  inline Component* AutoSegment::getOppositeAnchor ( Component* anchor ) const { return base()->getOppositeAnchor(anchor); };
413  inline AutoSegment* AutoSegment::getParent () const { return _parent; }
414  inline DbU::Unit AutoSegment::getSourcePosition () const { return _sourcePosition; }
415  inline DbU::Unit AutoSegment::getTargetPosition () const { return _targetPosition; }
416  inline DbU::Unit AutoSegment::getSourceX () const { return base()->getSourceX(); }
417  inline DbU::Unit AutoSegment::getSourceY () const { return base()->getSourceY(); }
418  inline DbU::Unit AutoSegment::getTargetX () const { return base()->getTargetX(); }
419  inline DbU::Unit AutoSegment::getTargetY () const { return base()->getTargetY(); }
420  inline DbU::Unit AutoSegment::getWidth () const { return base()->getWidth(); }
421  inline DbU::Unit AutoSegment::getLength () const { return base()->getLength(); }
422  inline void AutoSegment::invert () { base()->invert(); }
423  inline GCell* AutoSegment::getGCell () const { return _gcell; }
426  inline bool AutoSegment::getConstraints ( Interval& i ) const { return getConstraints(i.getVMin(),i.getVMax()); }
428  inline unsigned int AutoSegment::getDepth () const { return _depth; }
429  inline DbU::Unit AutoSegment::getPitch () const { return Session::getPitch(getDepth(),Configuration::NoFlags); }
430  inline DbU::Unit AutoSegment::getAxis () const { return isHorizontal()?base()->getY():base()->getX(); }
431  inline DbU::Unit AutoSegment::getOrigin () const { return isHorizontal()?_gcell->getY():_gcell->getX(); }
432  inline DbU::Unit AutoSegment::getExtremity () const { return isHorizontal()?_gcell->getYMax():_gcell->getXMax(); }
433  inline DbU::Unit AutoSegment::getOptimalMin () const { return DbU::lambda(_optimalMin) + getOrigin(); }
434  inline DbU::Unit AutoSegment::getOptimalMax () const { return DbU::lambda(_optimalMax) + getOrigin(); }
435  inline const Interval& AutoSegment::getUserConstraints () const { return _userConstraints; }
436 
437  inline bool AutoSegment::isHorizontal () const { return _flags & SegHorizontal; }
438  inline bool AutoSegment::isVertical () const { return not (_flags & SegHorizontal); }
439  inline bool AutoSegment::isFixed () const { return _flags & SegFixed; }
440  inline bool AutoSegment::isGlobal () const { return _flags & SegGlobal; }
441  inline bool AutoSegment::isWeakGlobal () const { return _flags & SegWeakGlobal; }
442  inline bool AutoSegment::isLocal () const { return not (_flags & SegGlobal); }
443  inline bool AutoSegment::isBipoint () const { return _flags & SegBipoint; }
444  inline bool AutoSegment::isWeakTerminal () const { return _flags & SegWeakTerminal; }
445  inline bool AutoSegment::isWeakTerminal1 () const { return _flags & SegWeakTerminal1; }
446  inline bool AutoSegment::isWeakTerminal2 () const { return _flags & SegWeakTerminal2; }
447  inline bool AutoSegment::isSourceTerminal () const { return _flags & SegSourceTerminal; }
448  inline bool AutoSegment::isTargetTerminal () const { return _flags & SegTargetTerminal; }
449  inline bool AutoSegment::isTerminal () const { return _flags & SegStrongTerminal; }
450  inline bool AutoSegment::isNotSourceAligned () const { return _flags & SegNotSourceAligned; }
451  inline bool AutoSegment::isNotTargetAligned () const { return _flags & SegNotTargetAligned; }
452  inline bool AutoSegment::isNotAligned () const { return (_flags & SegNotAligned) == SegNotAligned; }
453  inline bool AutoSegment::isDogleg () const { return _flags & SegDogleg ; }
454  inline bool AutoSegment::isUnbound () const { return _flags & SegUnbound ; }
455  inline bool AutoSegment::isStrap () const { return _flags & SegStrap; }
456  inline bool AutoSegment::isLayerChange () const { return _flags & SegLayerChange; }
457  inline bool AutoSegment::isSpinTop () const { return ((_flags & SegSpinTop ) == SegSpinTop); }
458  inline bool AutoSegment::isSpinBottom () const { return ((_flags & SegSpinBottom) == SegSpinBottom); }
459  inline bool AutoSegment::isSpinTopOrBottom () const { return isSpinTop() or isSpinBottom(); }
460  inline bool AutoSegment::isReduced () const { return _flags & SegIsReduced; }
461  inline bool AutoSegment::isSlackened () const { return _flags & SegSlackened; }
462  inline bool AutoSegment::isCanonical () const { return _flags & SegCanonical; }
463  inline bool AutoSegment::isUnsetAxis () const { return not (_flags & SegAxisSet); }
464  inline bool AutoSegment::isInvalidated () const { return _flags & SegInvalidated; }
465  inline bool AutoSegment::isInvalidatedLayer () const { return _flags & SegInvalidatedLayer; }
466  inline bool AutoSegment::isCreated () const { return _flags & SegCreated; }
467  inline bool AutoSegment::isUserDefined () const { return _flags & SegUserDefined; }
468  inline void AutoSegment::setFlags ( unsigned int flags ) { _flags |= flags; }
469  inline void AutoSegment::unsetFlags ( unsigned int flags ) { _flags &= ~flags; }
470 
471  inline unsigned int AutoSegment::getFlags () const { return _flags; }
472  inline unsigned int AutoSegment::_getFlags () const { return _flags; }
473  inline void AutoSegment::incReduceds () { if (_reduceds<3) ++_reduceds; }
474  inline void AutoSegment::decReduceds () { if (_reduceds>0) --_reduceds; }
475  inline void AutoSegment::setLayer ( const Layer* layer ) { base()->setLayer(layer); _depth=Session::getLayerDepth(layer); }
476  inline void AutoSegment::setOptimalMin ( DbU::Unit min ) { _optimalMin = (unsigned int)DbU::getLambda(min-getOrigin()); }
477  inline void AutoSegment::setOptimalMax ( DbU::Unit max ) { _optimalMax = (unsigned int)DbU::getLambda(max-getOrigin()); }
478 //inline void AutoSegment::mergeUserConstraints ( const Interval& constraints ) { _userConstraints.intersection(constraints); }
479  inline void AutoSegment::resetUserConstraints () { _userConstraints = Interval(false); }
480 
481  inline void AutoSegment::setParent ( AutoSegment* parent )
482  {
483  if ( parent == this ) {
484  cerr << "Parentage Looping: " << parent->_getString() << endl;
485  }
486  _parent = parent;
487  }
488 
489  template< typename T >
490  inline T* AutoSegment::getObserver () { return _observers.getObserver<T>(); }
491 
492 
493  inline bool AutoSegment::CompareId::operator() ( const AutoSegment* lhs, const AutoSegment* rhs ) const
494  { return lhs->getId() < rhs->getId(); }
495 
496  inline unsigned long AutoSegment::getMaxId ()
497  { return _maxId; }
498 
499  inline bool AutoSegment::areAlignedsAndDiffLayer ( AutoSegment* s1, AutoSegment* s2 )
500  { return s1 and s2
501  and (s1->isHorizontal() == s2->isHorizontal())
502  and (s1->getLayer() != s2->getLayer()); }
503 
504  inline bool AutoSegment::arePerpandiculars ( AutoSegment* a, AutoSegment* b )
505  { return a and b and (a->isHorizontal() != b->isHorizontal()); }
506 
507  inline bool AutoSegment::arePerpandiculars ( bool isHorizontalA, AutoSegment* b )
508  { return b and (isHorizontalA != b->isHorizontal()); }
509 
510  inline bool AutoSegment::areAligneds ( AutoSegment* a, AutoSegment* b )
511  { return a and b and (a->isHorizontal() == b->isHorizontal()); }
512 
513  inline unsigned int AutoSegment::getPerpandicularState ( AutoContact* contact
514  , AutoSegment* source
515  , AutoSegment* current
516  , AutoSegment* master )
517  {
518  return getPerpandicularState ( contact, source, current, master->isHorizontal(), master->getLayer() );
519  }
520 
521 
522  inline int AutoSegment::getTerminalCount ( AutoSegment* seed )
523  {
524  cdebug_log(145,0) << "getTerminalCount() - " << seed << endl;
525 
526  vector<AutoSegment*> collapseds;
527  vector<AutoSegment*> perpandiculars;
528  DbU::Unit leftBound;
529  DbU::Unit rightBound;
530 
531  getTopologicalInfos ( seed
532  , collapseds
533  , perpandiculars
534  , leftBound
535  , rightBound
536  );
537 
538  return getTerminalCount ( seed, collapseds );
539  }
540 
541 
542  inline size_t AutoSegment::getGlobalsCount () { return _globalsCount; }
543  inline size_t AutoSegment::getAllocateds () { return _allocateds; }
544 
545 
546 } // End of Katabatic namespace.
547 
548 
549 INSPECTOR_P_SUPPORT(Katabatic::AutoSegment);
550 
551 
552 # endif // KATABATIC_AUTOSEGMENT_H
size_t getPerpandicularsBound(set< AutoSegment *> &)
Definition: AutoSegment.cpp:1130
void removeObserver(BaseObserver *)
Definition: Observer.h:103
bool isSlackened() const
Definition: AutoSegment.h:461
DbU::Unit getY() const
Definition: GCell.h:245
const DbU::Unit & getVMax() const
bool isInvalidated() const
Definition: AutoSegment.h:464
bool slacken(unsigned int flags)
Definition: AutoSegment.cpp:1346
Net * getNet() const
Definition: AutoSegment.h:405
DbU::Unit getOrigin() const
Definition: AutoSegment.h:431
bool canSlacken(unsigned int flags=0) const
Definition: AutoSegment.cpp:1329
Definition: AutoSegment.h:66
virtual Vertical * getVertical()
Definition: AutoSegment.h:133
bool isDogleg() const
Definition: AutoSegment.h:453
const DbU::Unit & getVMin() const
Definition: Constants.h:24
bool reduceDoglegLayer()
Definition: AutoSegment.cpp:1596
virtual Segment * base() const =0
Definition: AutoSegment.h:75
virtual DbU::Unit getSourceX() const=0
Net * getNet() const
DbU::Unit getSourceX() const
Definition: AutoSegment.h:416
static Unit lambda(double value)
virtual DbU::Unit getTargetY() const=0
Component * getTarget() const
Hook * getSourceHook()
Definition: AutoSegment.h:408
bool isSpinBottom() const
Definition: AutoSegment.h:458
virtual bool moveULeft()=0
unsigned int _getFlags() const
Definition: AutoSegment.h:472
virtual bool moveURight()=0
void setLayer(const Layer *)
Definition: AutoSegment.h:475
bool canPivotUp(float reserve=0.0, unsigned int flags=0) const
Definition: AutoSegment.cpp:1398
Contact * getSource() const
Definition: AutoSegment.h:410
virtual unsigned int _makeDogleg(GCell *, unsigned int flags)=0
virtual DbU::Unit getX() const=0
bool isCreated() const
Definition: AutoSegment.h:466
Definition: AutoSegment.h:87
const Interval & getUserConstraints() const
Definition: AutoSegment.h:435
void setLayer(const Layer *layer)
Concrete Horizontal AutoSegment.
Definition: AutoHorizontal.h:31
Hook * getSourceHook()
bool toOptimalAxis(unsigned int flags=KbRealignate)
Definition: AutoSegment.cpp:804
Component * getSource() const
Interval & getOptimal(Interval &i) const
Definition: AutoSegment.cpp:399
bool isUnsetAxis() const
Definition: AutoSegment.h:463
DbU::Unit getWidth() const
Definition: AutoSegment.h:420
virtual const Layer * getLayer() const=0
void resetUserConstraints()
Definition: AutoSegment.h:479
Component * getOppositeAnchor(Component *) const
Definition: AutoSegment.h:412
static AutoSegment * create(AutoContact *source, AutoContact *target, Segment *hurricaneSegment)
Definition: AutoSegment.cpp:1988
std::int64_t Unit
bool isSpinTop() const
Definition: AutoSegment.h:457
virtual Interval getSpanU() const =0
Definition: AutoSegment.h:84
DbU::Unit getTargetPosition() const
Definition: AutoSegment.h:415
AutoSegmentFlag
Definition: AutoSegment.h:63
DbU::Unit getTargetY() const
Definition: AutoSegment.h:419
Definition: AutoSegment.h:76
void revalidate()
Definition: AutoSegment.cpp:457
bool canMoveUp(float reserve=0.0, unsigned int flags=0) const
Definition: AutoSegment.cpp:1493
virtual void invalidate(unsigned int flags=KbPropagate)
Definition: AutoSegment.cpp:416
virtual bool canMoveULeft(float reserve=0.0) const =0
virtual Interval getTargetConstraints(unsigned int flags=0) const =0
bool isInvalidatedLayer() const
Definition: AutoSegment.h:465
Observer Design Pattern, Subject part.
Definition: Observer.h:69
bool isStrongTerminal(unsigned int flags=0) const
Definition: AutoSegment.cpp:513
AutoSegment(Segment *segment)
Definition: AutoSegment.cpp:311
Definition: AutoSegment.h:83
virtual bool checkPositions() const =0
Definition: AutoSegment.h:89
AutoSegments getOnSourceContact(unsigned int direction)
Definition: AutoSegment.cpp:610
virtual ~AutoSegment()
Definition: AutoSegment.cpp:380
unsigned long getId() const
Definition: AutoSegment.h:403
Cell * getCell() const
Definition: AutoSegment.h:404
Definition: AutoSegment.h:97
virtual Interval getSourceConstraints(unsigned int flags=0) const =0
Definition: AutoSegment.h:67
static AutoContact * lookup(Contact *)
Definition: Session.cpp:384
Definition: AutoSegment.h:68
Routing Global Cell.
Definition: GCell.h:74
Abstract base class for AutoSegment.
Definition: AutoSegment.h:104
Definition: AutoSegment.h:92
virtual void setDuSource(DbU::Unit du)=0
static void _preCreate(AutoContact *source, AutoContact *target)
Definition: AutoSegment.cpp:343
void setFlags(unsigned int)
Definition: AutoSegment.h:468
bool isLocal() const
Definition: AutoSegment.h:442
Definition: LoadGrByNet.cpp:405
virtual DbU::Unit getSourceY() const=0
Definition: AutoSegment.h:73
Definition: Constants.h:38
Definition: AutoSegment.h:70
virtual DbU::Unit getY() const=0
virtual void _preDestroy()
Definition: AutoSegment.cpp:368
DbU::Unit getLength() const
Definition: AutoSegment.h:421
virtual size_t getGCells(vector< GCell *> &) const =0
bool toConstraintAxis(unsigned int flags=KbRealignate)
Definition: AutoSegment.cpp:766
Hook * getTargetHook()
Definition: AutoSegment.h:409
bool canPivotDown(float reserve=0.0, unsigned int flags=0) const
Definition: AutoSegment.cpp:1446
The namespace dedicated to Katabatic.
Definition: Katabatic.dox:13
bool mustRaise() const
Definition: AutoSegment.cpp:1233
void computeOptimal(set< AutoSegment *> &processeds)
Definition: AutoSegment.cpp:903
virtual DbU::Unit getDuTarget() const =0
bool reduce()
Definition: AutoSegment.cpp:1218
void mergeUserConstraints(const Interval &)
Definition: AutoSegment.cpp:758
virtual AutoSegment * getCanonical(DbU::Unit &min, DbU::Unit &max)
Definition: AutoSegment.cpp:559
Definition: AutoSegment.h:96
Components getAnchors() const
Definition: AutoSegment.h:74
DbU::Unit getSourcePosition() const
Definition: AutoSegment.h:414
void computeTerminal()
Definition: AutoSegment.cpp:862
virtual Horizontal * getHorizontal()
Definition: AutoSegment.h:132
DbU::Unit getXMax() const
Definition: GCell.h:246
Box getBoundingBox() const
Definition: AutoSegment.h:407
void invert()
Definition: AutoSegment.h:422
AutoSegment * canonize(unsigned int flags=KbNoFlags)
Definition: AutoSegment.cpp:1018
Definition: AutoSegment.h:88
bool isBipoint() const
Definition: AutoSegment.h:443
bool isGlobal() const
Definition: AutoSegment.h:440
virtual Box getBoundingBox(const BasicLayer *) const=0
Definition: AutoSegment.h:71
virtual DbU::Unit getCost(DbU::Unit axis) const
Definition: AutoSegment.cpp:547
virtual bool getConstraints(DbU::Unit &min, DbU::Unit &max) const =0
virtual DbU::Unit getX() const
Definition: AutoSegment.cpp:387
Contact * getTarget() const
Definition: AutoSegment.h:411
virtual DbU::Unit getSourceU() const =0
DbU::Unit getTargetX() const
Definition: AutoSegment.h:418
virtual bool _canSlacken() const =0
GCell * getGCell() const
Definition: AutoSegment.h:423
Definition: AutoSegment.h:82
void setOptimalMin(DbU::Unit min)
Definition: AutoSegment.h:476
Definition: AutoSegment.h:72
Definition: AutoSegment.h:65
AutoSegments getOnTargetContact(unsigned int direction)
Definition: AutoSegment.cpp:617
Definition: AutoSegment.h:77
virtual bool checkConstraints() const =0
Definition: AutoSegment.h:69
bool isSpinTopOrBottom() const
Definition: AutoSegment.h:459
virtual void updatePositions()=0
virtual DbU::Unit getY() const
Definition: AutoSegment.cpp:391
void addObserver(BaseObserver *)
Definition: Observer.h:96
Observer Design Pattern, Observer part.
Definition: Observer.h:29
void setOptimalMax(DbU::Unit max)
Definition: AutoSegment.h:477
AutoContact * getAutoTarget() const
Definition: AutoSegment.h:425
DbU::Unit getYMax() const
Definition: GCell.h:247
Concrete Vertical AutoSegment.
Definition: AutoVertical.h:32
Definition: AutoSegment.h:80
virtual void setDuTarget(DbU::Unit du)=0
bool isCanonical() const
Definition: AutoSegment.h:462
DbU::Unit getAxis() const
Definition: AutoSegment.h:430
DbU::Unit getOptimalMax() const
Definition: AutoSegment.h:434
bool isLayerChange() const
Definition: AutoSegment.h:456
virtual Cell * getCell() const=0
DbU::Unit getExtremity() const
Definition: AutoSegment.h:432
const Layer * getLayer() const
Definition: AutoSegment.h:406
virtual DbU::Unit getSlack() const
Definition: AutoSegment.cpp:536
Interval getMinSpanU() const
Definition: AutoSegment.cpp:1104
AutoSegments getPerpandiculars()
Definition: AutoSegment.cpp:639
virtual void updateOrient()=0
Abstract base class for AutoContact.
Definition: AutoContact.h:70
const DbU::Unit & getWidth() const
Definition: AutoSegment.h:64
Definition: AutoSegment.h:81
Definition: AutoSegment.h:93
virtual DbU::Unit getTargetU() const =0
AutoSegments getAligneds(unsigned int flags=KbNoFlags)
Definition: AutoSegment.cpp:632
bool isReduced() const
Definition: AutoSegment.h:460
void _invalidate()
Definition: AutoSegment.cpp:437
DbU::Unit getX() const
Definition: GCell.h:244
static double getLambda(Unit u)
bool isHorizontal() const
Definition: AutoSegment.h:437
T * getObserver()
Definition: Observer.h:90
Hook * getTargetHook()
bool isWeakTerminal() const
Definition: AutoSegment.h:444
virtual bool canMoveURight(float reserve=0.0) const =0
DbU::Unit getOptimalMin() const
Definition: AutoSegment.h:433
void unsetFlags(unsigned int)
Definition: AutoSegment.h:469
virtual unsigned int getDirection() const =0
DbU::Unit getSourceY() const
Definition: AutoSegment.h:417
bool canReduce() const
Definition: AutoSegment.cpp:1193
AutoContact * getAutoSource() const
Definition: AutoSegment.h:424
Component * getOppositeAnchor(Component *anchor) const
bool isVertical() const
Definition: AutoSegment.h:438
bool isFixed() const
Definition: AutoSegment.h:439
void setAxis(DbU::Unit, unsigned int flags=KbNoFlags)
Definition: AutoSegment.cpp:837
virtual DbU::Unit getLength() const=0
AutoSegment * makeDogleg(AutoContact *)
Definition: AutoSegment.cpp:1727
bool isStrap() const
Definition: AutoSegment.h:455
virtual DbU::Unit getTargetX() const=0
virtual DbU::Unit getDuSource() const =0
AutoSegment * getParent() const
Definition: AutoSegment.h:413
virtual void _postCreate()
Definition: AutoSegment.cpp:356
unsigned int canDogleg(Interval)
Definition: AutoSegment.cpp:1696


Generated by doxygen 1.8.14 on Thu Nov 12 2020 Return to top of page
Katabatic - Routing Toolbox Copyright © 2008-2020 Sorbonne Universite. All rights reserved