Skip to content

Commit 0e30391

Browse files
committed
mpl: refactor to avoid duplicated code
Signed-off-by: Arthur Koucher <[email protected]>
1 parent 1f0a556 commit 0e30391

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/mpl/src/SACoreSoftMacro.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ bool SACoreSoftMacro::isValid() const
109109
return false;
110110
}
111111

112-
return (width_ <= std::ceil(outline_.getWidth()))
113-
&& (height_ <= std::ceil(outline_.getHeight()));
112+
return resultFitsInOutline();
114113
}
115114

116115
// acessors functions

src/mpl/src/SimulatedAnnealingCore.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ void SimulatedAnnealingCore<T>::setInitialSequencePair(
153153
template <class T>
154154
bool SimulatedAnnealingCore<T>::isValid() const
155155
{
156-
return (width_ <= std::ceil(outline_.getWidth()))
157-
&& (height_ <= std::ceil(outline_.getHeight()));
156+
return resultFitsInOutline();
158157
}
159158

160159
template <class T>
@@ -769,6 +768,13 @@ void SimulatedAnnealingCore<T>::fastSA()
769768
}
770769
}
771770

771+
template <class T>
772+
bool SimulatedAnnealingCore<T>::resultFitsInOutline() const
773+
{
774+
return (width_ <= std::ceil(outline_.getWidth()))
775+
&& (height_ <= std::ceil(outline_.getHeight()));
776+
}
777+
772778
template <class T>
773779
void SimulatedAnnealingCore<T>::updateBestResult(const float cost)
774780
{

src/mpl/src/SimulatedAnnealingCore.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class SimulatedAnnealingCore
102102
};
103103

104104
void fastSA();
105+
bool resultFitsInOutline() const;
105106

106107
void setAvailableRegionsForUnconstrainedPins(
107108
const BoundaryRegionList& regions);

0 commit comments

Comments
 (0)