@@ -283,31 +283,13 @@ void GCell::print(utl::Logger* logger, bool print_only_name = true) const
283283 }
284284}
285285
286- void GCell::printToFile (std::ostream& out, bool print_only_name) const
287- {
288- if (!out) {
289- return ;
290- }
291-
292- if (!insts_.empty ()) {
293- out << " print gcell:" << insts_[0 ]->dbInst ()->getName () << " \n " ;
294- } else {
295- out << " print gcell insts_ empty! (filler cell)\n " ;
286+ void GCell::writeAttributesToCSV (std::ostream& out) {
287+ out << " ," << insts_.size () << " ," << gPins_ .size ();
288+ out << " ," << lx_ << " ," << ly_ << " ," << ux_ << " ," << uy_;
289+ out << " ," << dLx_ << " ," << dLy_ << " ," << dUx_ << " ," << dUy_;
290+ out << " ," << densityScale_ << " ," << gradientX_ << " ," << gradientY_;
296291 }
297292
298- if (!print_only_name) {
299- out << fmt::format (
300- " insts_ size: {}, gPins_ size: {}\n " , insts_.size (), gPins_ .size ());
301- out << fmt::format (" lx_: {} ly_: {} ux_: {} uy_: {}\n " , lx_, ly_, ux_, uy_);
302- out << fmt::format (
303- " dLx_: {} dLy_: {} dUx_: {} dUy_: {}\n " , dLx_, dLy_, dUx_, dUy_);
304- out << fmt::format (" densityScale_: {} gradientX_: {} gradientY_: {}\n " ,
305- densityScale_,
306- gradientX_,
307- gradientY_);
308- }
309- }
310-
311293// //////////////////////////////////////////////
312294// GNet
313295
@@ -893,7 +875,7 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
893875 Bin& bin = bins_[y * binCntX_ + x];
894876
895877 const float scaledAvea = getOverlapDensityArea (bin, cell)
896- * cell->densityScale ()
878+ * cell->getDensityScale ()
897879 * bin.targetDensity ();
898880 bin.addInstPlacedAreaUnscaled (scaledAvea);
899881 }
@@ -905,7 +887,7 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
905887 for (int x = pairX.first ; x < pairX.second ; x++) {
906888 Bin& bin = bins_[y * binCntX_ + x];
907889 const float scaledArea
908- = getOverlapDensityArea (bin, cell) * cell->densityScale ();
890+ = getOverlapDensityArea (bin, cell) * cell->getDensityScale ();
909891 bin.addInstPlacedAreaUnscaled (scaledArea);
910892 }
911893 }
@@ -915,7 +897,7 @@ void BinGrid::updateBinsGCellDensityArea(const std::vector<GCellHandle>& cells)
915897 for (int x = pairX.first ; x < pairX.second ; x++) {
916898 Bin& bin = bins_[y * binCntX_ + x];
917899 bin.addFillerArea (getOverlapDensityArea (bin, cell)
918- * cell->densityScale ());
900+ * cell->getDensityScale ());
919901 }
920902 }
921903 }
@@ -2222,7 +2204,7 @@ FloatPoint NesterovBase::getDensityGradient(const GCell* gCell) const
22222204 for (int j = pairY.first ; j < pairY.second ; j++) {
22232205 const Bin& bin = bg_.binsConst ()[j * binCntX () + i];
22242206 float overlapArea
2225- = getOverlapDensityArea (bin, gCell ) * gCell ->densityScale ();
2207+ = getOverlapDensityArea (bin, gCell ) * gCell ->getDensityScale ();
22262208
22272209 electroForce.x += overlapArea * bin.electroForceX ();
22282210 electroForce.y += overlapArea * bin.electroForceY ();
@@ -3592,33 +3574,6 @@ void NesterovBaseCommon::destroyCbkITerm(odb::dbITerm* db_iterm)
35923574 }
35933575}
35943576
3595- void NesterovBase::printGCellsToFile (const std::string& filename,
3596- bool print_only_name) const
3597- {
3598- std::ofstream out (filename);
3599- if (!out.is_open ()) {
3600- return ;
3601- }
3602-
3603- out << " nb_gcells_.size(): " << nb_gcells_.size () << " \n " ;
3604- out.close ();
3605-
3606- std::ofstream out_append (filename, std::ios::app);
3607- if (!out_append.is_open ()) {
3608- return ;
3609- }
3610-
3611- for (size_t i = 0 ; i < nb_gcells_.size (); ++i) {
3612- const GCellHandle& handle = nb_gcells_[i];
3613- const GCell* gcell = handle.operator ->();
3614-
3615- out_append << fmt::format (" idx:{} filler:{}\n " , i, gcell->isFiller ());
3616- gcell->printToFile (out_append, print_only_name);
3617- }
3618-
3619- out_append.close ();
3620- }
3621-
36223577void NesterovBase::swapAndPop (std::vector<FloatPoint>& vec,
36233578 size_t remove_index,
36243579 size_t last_index)
@@ -3714,47 +3669,6 @@ void NesterovBaseCommon::printGCells()
37143669 }
37153670}
37163671
3717- void NesterovBaseCommon::printGCellsToFile (const std::string& filename,
3718- bool print_only_name,
3719- bool also_print_minRc) const
3720- {
3721- std::ofstream out (filename);
3722- if (!out.is_open ()) {
3723- return ;
3724- }
3725-
3726- out << " gCellStor_.size(): " << gCellStor_ .size () << " \n " ;
3727- out.close ();
3728-
3729- std::ofstream out_append (filename, std::ios::app);
3730- if (!out_append.is_open ()) {
3731- return ;
3732- }
3733-
3734- for (size_t i = 0 ; i < gCellStor_ .size (); ++i) {
3735- out_append << fmt::format (" idx:{}\n " , i);
3736- gCellStor_ [i].printToFile (out_append, print_only_name);
3737- }
3738-
3739- out_append.close ();
3740-
3741- if (also_print_minRc) {
3742- std::string minrc_filename = filename + " .minrc" ;
3743- std::ofstream minrc_out (minrc_filename);
3744- if (!minrc_out.is_open ()) {
3745- return ;
3746- }
3747-
3748- for (size_t i = 0 ; i < minRcCellSize_.size (); ++i) {
3749- const auto & min_rc = minRcCellSize_[i];
3750- minrc_out << fmt::format (
3751- " idx:{} minRc: {} {}\n " , i, min_rc.dx (), min_rc.dy ());
3752- }
3753-
3754- minrc_out.close ();
3755- }
3756- }
3757-
37583672void NesterovBaseCommon::printGPins ()
37593673{
37603674 for (auto & gpin : gPinStor_ ) {
0 commit comments