@@ -454,7 +454,7 @@ void Cluster::setParent(Cluster* parent)
454454
455455void Cluster::addChild (Cluster* child)
456456{
457- children_.insert (child);
457+ children_.push_back (child);
458458}
459459
460460void Cluster::removeChild (const Cluster* child)
@@ -464,7 +464,7 @@ void Cluster::removeChild(const Cluster* child)
464464
465465void Cluster::addChildren (const std::vector<Cluster*>& children)
466466{
467- children_. insert (children.begin (), children.end ());
467+ std::copy (children.begin (), children.end (), std::back_inserter (children_ ));
468468}
469469
470470void Cluster::removeChildren ()
@@ -477,7 +477,7 @@ Cluster* Cluster::getParent() const
477477 return parent_;
478478}
479479
480- std::set <Cluster*> Cluster::getChildren () const
480+ std::vector <Cluster*> Cluster::getChildren () const
481481{
482482 return children_;
483483}
@@ -512,7 +512,7 @@ bool Cluster::mergeCluster(Cluster& cluster, bool& delete_flag)
512512 delete_flag = true ;
513513 // if current cluster is not a leaf cluster
514514 if (children_.size () > 0 ) {
515- children_.insert (&cluster);
515+ children_.push_back (&cluster);
516516 cluster.setParent (this );
517517 delete_flag = false ;
518518 }
@@ -1259,17 +1259,17 @@ void SoftMacro::setShapes(
12591259 return ;
12601260 }
12611261 area_ = area;
1262+ width_list_.clear ();
1263+ height_list_.clear ();
12621264 // sort width list based
12631265 height_list_ = width_list;
12641266 std::sort (height_list_.begin (), height_list_.end (), comparePairFirst);
12651267 for (auto & shape : height_list_) {
1266- const float min_width = shape.first ;
1267- const float max_width = shape.second ;
12681268 if (width_list_.size () == 0
1269- || min_width > width_list_[width_list_.size () - 1 ].second ) {
1270- width_list_.push_back (std::pair< float , float >(min_width, max_width) );
1271- } else {
1272- width_list_[width_list_.size () - 1 ].second = max_width ;
1269+ || shape. first > width_list_[width_list_.size () - 1 ].second ) {
1270+ width_list_.push_back (shape );
1271+ } else if (shape. second > width_list_[width_list_. size () - 1 ]. second ) {
1272+ width_list_[width_list_.size () - 1 ].second = shape. second ;
12731273 }
12741274 }
12751275 height_list_.clear ();
@@ -1329,7 +1329,7 @@ float SoftMacro::getHeight() const
13291329
13301330float SoftMacro::getArea () const
13311331{
1332- return area_;
1332+ return area_ > 0.01 ? area_ : 0.0 ;
13331333}
13341334
13351335// Num Macros
0 commit comments