Main Page | Namespace List | Class Hierarchy | Compound List | File List | Namespace Members | Compound Members | File Members

SoftPackingHardBlockInfoType Class Reference

#include <btreefromsstree.h>

Inheritance diagram for SoftPackingHardBlockInfoType:

Inheritance graph
[legend]
Collaboration diagram for SoftPackingHardBlockInfoType:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SoftPackingHardBlockInfoType (const SoftPacking &spk)
const basepacking_h::Dimensionoperator[] (int index) const
int blocknum () const
double blockArea () const

Public Attributes

const vector< basepacking_h::Dimension > & blocks
const vector< string > & block_names

Static Public Attributes

const int ORIENT_NUM = Dimension::ORIENT_NUM

Protected Member Functions

void set_dimensions (int i, double w, double h)
void ParseTxt (ifstream &ins)
void ParseBlocks (ifstream &ins)

Protected Attributes

vector< basepacking_h::Dimensionin_blocks
vector< string > in_block_names

Friends

class MixedBlockInfoType
class MixedBlockInfoTypeFromDB

Constructor & Destructor Documentation

SoftPackingHardBlockInfoType::SoftPackingHardBlockInfoType const SoftPacking &  spk  ) 
 

Definition at line 43 of file btreefromsstree.cxx.

References HardBlockInfoType::blocknum(), HardBlockInfoType::in_block_names, HardBlockInfoType::in_blocks, and HardBlockInfoType::set_dimensions().

00045    : HardBlockInfoType()
00046 {
00047    int blocknum = spk.xloc.size();
00048    
00049    in_blocks.resize(blocknum+2);
00050    in_block_names.resize(blocknum+2);
00051    for (int i = 0; i < blocknum; i++)
00052    {
00053       set_dimensions(i, spk.width[i], spk.height[i]);
00054 
00055       char temp[100];
00056       sprintf(temp, "%d", i);
00057       in_block_names[i] = temp;
00058    }
00059 
00060    set_dimensions(blocknum, 0, Dimension::INFTY);
00061    in_block_names[blocknum] = "LEFT";
00062 
00063    set_dimensions(blocknum+1, Dimension::INFTY, 0);
00064    in_block_names[blocknum+1] = "BOTTOM";
00065 }

Here is the call graph for this function:


Member Function Documentation

double HardBlockInfoType::blockArea  )  const [inline, inherited]
 

Definition at line 293 of file basepacking.h.

References HardBlockInfoType::blocknum(), and HardBlockInfoType::in_blocks.

00294 {
00295    double sum = 0;
00296    for (int i = 0; i < blocknum(); i++)
00297       sum += in_blocks[i].width[0] * in_blocks[i].height[0];
00298    return sum;
00299 }

Here is the call graph for this function:

int HardBlockInfoType::blocknum  )  const [inline, inherited]
 

Definition at line 290 of file basepacking.h.

References HardBlockInfoType::in_blocks.

Referenced by HardBlockInfoType::blockArea(), BTreeAreaWireAnnealer::constructor_core(), NetListType::get_index(), getTolerance(), OutputHardBlockInfoType(), NetListType::ParsePl(), HardBlockInfoType::ParseTxt(), BTreeAreaWireAnnealer::perform_move(), BTreeAreaWireAnnealer::perform_rotate(), BTreeAreaWireAnnealer::perform_swap(), and SoftPackingHardBlockInfoType().

00291 {  return (in_blocks.size()-2); }

const basepacking_h::Dimension & HardBlockInfoType::operator[] int  index  )  const [inline, inherited]
 

Definition at line 287 of file basepacking.h.

References HardBlockInfoType::in_blocks.

00288 {  return in_blocks[index]; }

void HardBlockInfoType::ParseBlocks ifstream &  ins  )  [protected, inherited]
 

Definition at line 131 of file basepacking.cxx.

References HardBlockInfoType::block_names, eatblank(), eathash(), HardBlockInfoType::in_block_names, HardBlockInfoType::in_blocks, parquetfp::needCaseChar(), HardBlockInfoType::set_dimensions(), and skiptoeol().

Referenced by HardBlockInfoType::HardBlockInfoType().

00132 {
00133     char block_name[100];
00134     char block_type[100];
00135     char tempWord[100];
00136     
00137     int numSoftBl=0;
00138     int numHardBl=0;
00139     int numTerm=0;
00140     
00141     int indexBlock=0;
00142 
00143     if(!ins)
00144     {
00145        cout << "ERROR: .blocks file could not be opened successfully"
00146             << endl;
00147        exit(1);
00148     }
00149     
00150     skiptoeol(ins);
00151     while(!ins.eof())
00152     {
00153        ins >> tempWord;
00154        if(!(strcmp(tempWord,"NumSoftRectangularBlocks")))
00155           break;
00156     }
00157     
00158     if (!ins.good())
00159     {
00160        cout << "ERROR in parsing .blocks file." << endl;
00161        exit(1);
00162     }
00163     
00164     ins >> tempWord;
00165     ins >> numSoftBl;
00166     if (numSoftBl != 0)
00167     {
00168        cout << "ERROR: soft block packing is not supported for now." << endl;
00169        exit(0);
00170     }
00171     
00172     while(!ins.eof())
00173     {
00174        ins >> tempWord;
00175        if (!(strcmp(tempWord, "NumHardRectilinearBlocks")))
00176           break;
00177     }
00178     ins >> tempWord;
00179     ins >> numHardBl;
00180     
00181     while(!ins.eof())
00182     {
00183        ins >> tempWord;
00184        if (!(strcmp(tempWord, "NumTerminals")))
00185           break;
00186     }
00187     ins >> tempWord;
00188     ins >> numTerm;
00189 
00190     in_blocks.resize(numHardBl+2);
00191     in_block_names.resize(numHardBl+2);
00192     while(ins.good())
00193     {
00194        block_type[0] = '\0';
00195        eatblank(ins);
00196        
00197        if (ins.eof())
00198           break;
00199        if (ins.peek() == '#')
00200           eathash(ins);
00201        else
00202        {
00203           eatblank(ins);
00204           if (ins.peek() == '\n' || ins.peek() == '\r')
00205           {
00206              ins.get();
00207              continue;
00208           }
00209           
00210           ins >> block_name;
00211           ins >> block_type;
00212 
00213           if (!strcmp(block_type, "softrectangular"))
00214           {
00215              cout << "ERROR: soft block packing is not supported now." << endl;
00216              exit(1);
00217           }
00218           else if (!strcmp(block_type,"hardrectilinear"))
00219           {
00220              Point tempPoint;
00221              vector<Point> vertices;
00222              int numVertices;
00223              bool success;
00224              double width, height;
00225 
00226              ins >> numVertices;             
00227              success = true;
00228              if (numVertices != 4)
00229              {
00230                 cout << "ERROR in parsing .blocks file. "
00231                      << "rectilinear blocks can be only rectangles for now"
00232                      << endl;
00233                 exit(1);
00234              }
00235              
00236              for (int i=0; i < numVertices; ++i)
00237              {
00238                 success &= needCaseChar(ins, '(');  ins.get();
00239                 ins >> tempPoint.x;
00240                 success &= needCaseChar(ins, ',');  ins.get();
00241                 ins >> tempPoint.y;
00242                 success &= needCaseChar(ins, ')');  ins.get();
00243                 vertices.push_back(tempPoint);
00244              }
00245              if (!success)
00246              {
00247                 cout << "ERROR in parsing .blocks file while processing "
00248                      << "hardrectilinear blocks." << endl;
00249                 exit(1);
00250              }
00251             
00252              width = vertices[2].x - vertices[0].x;
00253              height = vertices[2].y - vertices[0].y;
00254 
00255              // consider a block
00256 //             cout << "[" << indexBlock << "] "
00257 //                  << setw(10) << block_name 
00258 //                  << " width: " << width
00259 //                  << " height: " << height << endl;
00260              set_dimensions(indexBlock, width, height);
00261              if (indexBlock >= int(block_names.size()))
00262              {
00263                 cout << "ERROR: too many hard block specified." << endl;
00264                 exit(1);
00265              }                 
00266              in_block_names[indexBlock] = block_name;
00267              ++indexBlock;
00268           }
00269           else if (!strcmp(block_type,"terminal"))
00270           {  /* a pad */ }
00271           else if (ins.good())
00272           {
00273              cout << "ERROR: invalid block type: " << block_type << endl;
00274              exit(1);
00275           }  
00276        }
00277     } // end of while-loop
00278     ins.close();
00279     
00280     if (numSoftBl+numHardBl != indexBlock)
00281     {
00282        cout << "ERROR in parsing .blocks file. # blocks do not tally "
00283             << (indexBlock) << " vs. "
00284             << (numSoftBl+numHardBl) << endl;
00285        exit(1);
00286     }
00287     set_dimensions(numHardBl, 0, Dimension::INFTY);
00288     in_block_names[numHardBl] = "LEFT";
00289     
00290     set_dimensions(numHardBl+1, Dimension::INFTY, 0);
00291     in_block_names[numHardBl+1] = "BOTTOM";
00292 }

Here is the call graph for this function:

void HardBlockInfoType::ParseTxt ifstream &  ins  )  [protected, inherited]
 

Definition at line 91 of file basepacking.cxx.

References HardBlockInfoType::blocknum(), HardBlockInfoType::in_block_names, HardBlockInfoType::in_blocks, and HardBlockInfoType::set_dimensions().

Referenced by HardBlockInfoType::HardBlockInfoType().

00092 {
00093    int blocknum = -1;
00094    ins >> blocknum;
00095 
00096    if (!ins.good())
00097    {
00098       cout << "ERROR: cannot read the block count." << endl;
00099       exit(1);
00100    }
00101 
00102    in_blocks.resize(blocknum+2);
00103    in_block_names.resize(blocknum+2);
00104    for (int i = 0; i < blocknum; i++)
00105    {
00106       double w, h;
00107       ins >> w >> h;
00108 
00109       if (!ins.good())
00110       {
00111          cout << "ERROR: cannot read block no." << i << endl;
00112          exit(1);
00113       }
00114 
00115       set_dimensions(i, w, h);
00116 
00117       char temp[100];
00118       temp[0] = '\0';
00119       sprintf(temp, "%d", i);
00120       in_block_names[i] = temp;
00121    }
00122    set_dimensions(blocknum, 0, Dimension::INFTY);
00123    in_block_names[blocknum] = "LEFT";
00124    
00125    set_dimensions(blocknum+1, Dimension::INFTY, 0);
00126    in_block_names[blocknum+1] = "BOTTOM";
00127 }

Here is the call graph for this function:

void HardBlockInfoType::set_dimensions int  i,
double  w,
double  h
[protected, inherited]
 

Definition at line 56 of file basepacking.cxx.

References HardBlockInfoType::in_blocks, and HardBlockInfoType::ORIENT_NUM.

Referenced by MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), MixedBlockInfoType::ParseBlocks(), HardBlockInfoType::ParseBlocks(), HardBlockInfoType::ParseTxt(), MixedBlockInfoType::setBlockDimensions(), and SoftPackingHardBlockInfoType().

00059 {
00060    in_blocks[i].width.resize(ORIENT_NUM);
00061    in_blocks[i].height.resize(ORIENT_NUM);
00062    for (int j = 0; j < ORIENT_NUM; j++)
00063       if (j % 2 == 0)
00064       {
00065          in_blocks[i].width[j] = w;
00066          in_blocks[i].height[j] = h;
00067       }
00068       else
00069       {
00070          in_blocks[i].width[j] = h;
00071          in_blocks[i].height[j] = w;
00072       }
00073 }


Friends And Related Function Documentation

friend class MixedBlockInfoType [friend, inherited]
 

Definition at line 99 of file basepacking.h.

friend class MixedBlockInfoTypeFromDB [friend, inherited]
 

Definition at line 100 of file basepacking.h.


Member Data Documentation

const vector<string>& HardBlockInfoType::block_names [inherited]
 

Definition at line 92 of file basepacking.h.

Referenced by NetListType::get_index(), HardBlockInfoType::HardBlockInfoType(), OutputMixedBlockInfoType(), MixedBlockInfoType::ParseBlocks(), and HardBlockInfoType::ParseBlocks().

const vector<basepacking_h::Dimension>& HardBlockInfoType::blocks [inherited]
 

Definition at line 91 of file basepacking.h.

Referenced by HardBlockInfoType::HardBlockInfoType().

vector<string> HardBlockInfoType::in_block_names [protected, inherited]
 

Definition at line 104 of file basepacking.h.

Referenced by HardBlockInfoType::HardBlockInfoType(), MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), MixedBlockInfoType::ParseBlocks(), HardBlockInfoType::ParseBlocks(), HardBlockInfoType::ParseTxt(), and SoftPackingHardBlockInfoType().

vector<basepacking_h::Dimension> HardBlockInfoType::in_blocks [protected, inherited]
 

Definition at line 103 of file basepacking.h.

Referenced by HardBlockInfoType::blockArea(), HardBlockInfoType::blocknum(), HardBlockInfoType::HardBlockInfoType(), HardBlockInfoType::operator[](), MixedBlockInfoType::ParseBlocks(), HardBlockInfoType::ParseBlocks(), HardBlockInfoType::ParseTxt(), HardBlockInfoType::set_dimensions(), and SoftPackingHardBlockInfoType().

const int HardBlockInfoType::ORIENT_NUM = Dimension::ORIENT_NUM [static, inherited]
 

Definition at line 54 of file basepacking.cxx.

Referenced by OutputHardBlockInfoType(), and HardBlockInfoType::set_dimensions().


The documentation for this class was generated from the following files:
Generated on Mon Apr 25 01:15:47 2005 for Parquete by doxygen 1.3.2