Skip to content

Commit

Permalink
mpl2: graphics method for clearing
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurckoucher@gmail.com>
  • Loading branch information
AcKoucher committed Nov 13, 2023
1 parent e45cf10 commit 90e327f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mpl2/src/Mpl2Observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Mpl2Observer
virtual void setMacroBlockagePenalty(float macro_blockage_penalty) {}
virtual void setNotchPenalty(float notch_penalty) {}
virtual void penaltyCalculated(float norm_cost) {}

virtual void clearObserver() {}
};

} // namespace mpl2
13 changes: 13 additions & 0 deletions src/mpl2/src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,4 +356,17 @@ void Graphics::setHardMacroClusterLocation(
hard_macro_cluster_pos_ = hard_macro_cluster_pos;
}

void Graphics::clearObserver()
{
root_ = nullptr;

soft_macros_.clear();
hard_macros_.clear();
macro_blockages_.clear();
parent_locations_.clear();

outline_height_.reset();
outline_width_.reset();
}

} // namespace mpl2
2 changes: 2 additions & 0 deletions src/mpl2/src/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Graphics : public gui::Renderer, public Mpl2Observer
void setHardMacroClusterLocation(
const odb::Point& hard_macro_cluster_pos) override;

void clearObserver() override;

private:
void resetPenalties();
void drawCluster(Cluster* cluster, gui::Painter& painter);
Expand Down
4 changes: 4 additions & 0 deletions src/mpl2/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ void HierRTLMP::hierRTLMacroPlacer()
}
cluster_map_.clear();

if (graphics_) {
graphics_->clearObserver();
}

logger_->report("number of updated macros : {}", num_updated_macros_);
logger_->report("number of macros in HardMacroCluster : {}",
num_hard_macros_cluster_);
Expand Down

0 comments on commit 90e327f

Please sign in to comment.