#include <mixedpacking.h>
Inheritance diagram for MixedBlockInfoType:


Public Member Functions | |
| MixedBlockInfoType (const string &blocksfilename, const string &format) | |
| virtual | ~MixedBlockInfoType () |
| void | setBlockDimensions (int index, double newWidth, double newHeight, int theta) |
Public Attributes | |
| const HardBlockInfoType & | currDimensions |
| const vector< BlockARInfo > & | blockARinfo |
Static Public Attributes | |
| const int | ORIENT_NUM = HardBlockInfoType::ORIENT_NUM |
Protected Member Functions | |
| void | ParseBlocks (ifstream &input) |
| void | set_blockARinfo_AR (int index, double minAR, double maxAR) |
| MixedBlockInfoType (int blocknum) | |
Protected Attributes | |
| HardBlockInfoType | _currDimensions |
| vector< BlockARInfo > | _blockARinfo |
|
||||||||||||
|
Definition at line 49 of file mixedpacking.cxx. References ParseBlocks().
00051 : currDimensions(_currDimensions), 00052 blockARinfo(_blockARinfo), 00053 _currDimensions(0) 00054 { 00055 ifstream infile; 00056 infile.open(blocksfilename.c_str()); 00057 if (!infile.good()) 00058 { 00059 cout << "ERROR: cannot open file " << blocksfilename << endl; 00060 exit(1); 00061 } 00062 00063 if (format == "txt") 00064 { 00065 cout << "Sorry, .txt format isn't supported now." << endl; 00066 exit(0); 00067 } 00068 else if (format == "blocks") 00069 ParseBlocks(infile); 00070 } |
Here is the call graph for this function:

|
|
Definition at line 50 of file mixedpacking.h.
00050 {}
|
|
|
Definition at line 75 of file mixedpacking.h. References _blockARinfo, _currDimensions, blockARinfo, and currDimensions.
00076 : currDimensions(_currDimensions), 00077 blockARinfo(_blockARinfo), 00078 _currDimensions(blocknum), 00079 _blockARinfo(blocknum+2) 00080 {} |
|
|
Definition at line 72 of file mixedpacking.cxx. References _blockARinfo, _currDimensions, HardBlockInfoType::block_names, eatblank(), eathash(), HardBlockInfoType::in_block_names, HardBlockInfoType::in_blocks, parquetfp::needCaseChar(), ORIENT_NUM, set_blockARinfo_AR(), and HardBlockInfoType::set_dimensions(). Referenced by MixedBlockInfoType().
00073 {
00074 char block_name[1024];
00075 char block_type[1024];
00076 char tempWord1[1024];
00077
00078 vector<Point> vertices;
00079 int numVertices;
00080 bool success;
00081 double width, height;
00082
00083 double area,minAr,maxAr;
00084 int numSoftBl=0;
00085 int numHardBl=0;
00086 int numBl = numSoftBl + numHardBl;
00087 int numTerm=0;
00088
00089 int indexBlock=0;
00090 int indexTerm=0;
00091
00092 if(!input)
00093 {
00094 cout<<"ERROR: .blocks file could not be opened successfully"<<endl;
00095 exit(0);
00096 }
00097
00098 while(!input.eof())
00099 {
00100 input>>tempWord1;
00101 if(!(strcmp(tempWord1,"NumSoftRectangularBlocks")))
00102 break;
00103 }
00104 input>>tempWord1;
00105 input>>numSoftBl;
00106
00107 while(!input.eof())
00108 {
00109 input>>tempWord1;
00110 if(!(strcmp(tempWord1,"NumHardRectilinearBlocks")))
00111 break;
00112 }
00113 input>>tempWord1;
00114 input>>numHardBl;
00115
00116 while(!input.eof())
00117 {
00118 input>>tempWord1;
00119 if(!(strcmp(tempWord1,"NumTerminals")))
00120 break;
00121 }
00122 input>>tempWord1;
00123 input>>numTerm;
00124
00125 numBl = numHardBl + numSoftBl;
00126 _currDimensions.in_blocks.resize(numBl+2);
00127 _currDimensions.in_block_names.resize(numBl+2);
00128 _blockARinfo.resize(numHardBl+numSoftBl+2);
00129 while(!input.eof())
00130 {
00131 block_type[0] = '\0';
00132 eatblank(input);
00133 if(input.eof())
00134 break;
00135 if(input.peek()=='#')
00136 eathash(input);
00137 else
00138 {
00139 eatblank(input);
00140 if(input.peek() == '\n' || input.peek() == '\r')
00141 {
00142 input.get();
00143 continue;
00144 }
00145
00146 input >> block_name;
00147 input >> block_type ;
00148
00149 if(!strcmp(block_type,"softrectangular"))
00150 {
00151 input >> area;
00152 input >> minAr;
00153 input >> maxAr;
00154
00155 width = sqrt(area);
00156 height = sqrt(area);
00157
00158 // printf("[%d]: area: %.2lf minAR: %.2lf maxAR: %.2lf width: %.2lf height: %.2lf\n",
00159 // indexBlock, area, minAr, maxAr, width, height);
00160 _currDimensions.set_dimensions(indexBlock, width, height);
00161 if (indexBlock >= int(_currDimensions.block_names.size()))
00162 {
00163 cout << "ERROR: too many hard block specified." << endl;
00164 exit(1);
00165 }
00166 _currDimensions.in_block_names[indexBlock] = block_name;
00167
00168 _blockARinfo[indexBlock].area = area;
00169 set_blockARinfo_AR(indexBlock, min(minAr, maxAr), max(minAr, maxAr));
00170 _blockARinfo[indexBlock].isSoft = true;
00171
00172 ++indexBlock;
00173 //cout<<block_name<<" "<<area<<endl;
00174 }
00175 else if(!strcmp(block_type,"hardrectilinear"))
00176 {
00177 input >> numVertices; //maybe need voltage here
00178 input >> numVertices;
00179 Point tempPoint;
00180 success = 1;
00181 if(numVertices > 4)
00182 cout<<"ERROR in parsing .blocks file. rectilinear blocks can be only rectangles for now\n";
00183 for(int i=0; i<numVertices; ++i)
00184 {
00185 success &= needCaseChar(input, '('); input.get();
00186 input >> tempPoint.x;
00187 success &= needCaseChar(input, ','); input.get();
00188 input >> tempPoint.y;
00189 success &= needCaseChar(input, ')'); input.get();
00190 vertices.push_back(tempPoint);
00191 }
00192 if(!success)
00193 cout<<"ERROR in parsing .blocks file while processing hardrectilinear blocks"<<endl;
00194
00195 width = vertices[2].x - vertices[0].x;
00196 height = vertices[2].y - vertices[0].y;
00197 area = width*height;
00198 minAr = width/height;
00199 maxAr = minAr;
00200
00201 _currDimensions.set_dimensions(indexBlock, width, height);
00202 if (indexBlock >= int(_currDimensions.block_names.size()))
00203 {
00204 cout << "ERROR: too many hard block specified." << endl;
00205 exit(1);
00206 }
00207 _currDimensions.in_block_names[indexBlock] = block_name;
00208
00209 _blockARinfo[indexBlock].area = area;
00210 set_blockARinfo_AR(indexBlock, min(minAr, maxAr), max(minAr, maxAr));
00211 _blockARinfo[indexBlock].isSoft = false;
00212
00213 ++indexBlock;
00214 vertices.clear();
00215 //cout<<block_name<<" "<<area<<endl;
00216 }
00217 else if(!strcmp(block_type,"terminal"))
00218 {
00219 ++indexTerm;
00220 //cout<<indexTerm<<" "<<block_name<<endl;
00221 }
00222 /*
00223 else
00224 cout<<"ERROR in parsing .blocks file"<<endl;
00225 */
00226 }
00227 }
00228 input.close();
00229
00230 if(numSoftBl+numHardBl != indexBlock)
00231 cout << "ERROR in parsing .blocks file. No: of blocks do not tally "
00232 << (indexBlock+indexTerm) << " vs " << (numSoftBl+numHardBl+numTerm)
00233 << endl;
00234
00235 _currDimensions.set_dimensions(numBl, 0, Dimension::INFTY);
00236 _currDimensions.in_block_names[numBl] = "LEFT";
00237 _blockARinfo[numBl].area = 0;
00238 _blockARinfo[numBl].minAR.resize(ORIENT_NUM, 0);
00239 _blockARinfo[numBl].maxAR.resize(ORIENT_NUM, 0);
00240 _blockARinfo[numBl].isSoft = false;
00241
00242 _currDimensions.set_dimensions(numBl+1, Dimension::INFTY, 0);
00243 _currDimensions.in_block_names[numBl+1] = "BOTTOM";
00244 _blockARinfo[numBl+1].area = 0;
00245 _blockARinfo[numBl+1].minAR.resize(ORIENT_NUM, Dimension::INFTY);
00246 _blockARinfo[numBl+1].maxAR.resize(ORIENT_NUM, Dimension::INFTY);
00247 _blockARinfo[numBl+1].isSoft = false;
00248 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 97 of file mixedpacking.h. References _blockARinfo, and ORIENT_NUM. Referenced by MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), and ParseBlocks().
00100 {
00101 _blockARinfo[index].minAR.resize(ORIENT_NUM);
00102 _blockARinfo[index].maxAR.resize(ORIENT_NUM);
00103 for (int i = 0; i < ORIENT_NUM; i++)
00104 {
00105 _blockARinfo[index].minAR[i] = ((i%2 == 0)?
00106 minAR : (1.0 / maxAR));
00107 _blockARinfo[index].maxAR[i] = ((i%2 == 0)?
00108 maxAR : (1.0 / minAR));
00109 }
00110 }
|
|
||||||||||||||||||||
|
Definition at line 87 of file mixedpacking.h. References _currDimensions, and HardBlockInfoType::set_dimensions(). Referenced by BTreeAreaWireAnnealer::anneal(), MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), and BTreeAreaWireAnnealer::packSoftBlocks().
00091 {
00092 double realWidth = (theta % 2 == 0)? newWidth : newHeight;
00093 double realHeight = (theta % 2 == 0)? newHeight : newWidth;
00094 _currDimensions.set_dimensions(index, realWidth, realHeight);
00095 }
|
Here is the call graph for this function:

|
|
Definition at line 69 of file mixedpacking.h. Referenced by MixedBlockInfoType(), MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), ParseBlocks(), and set_blockARinfo_AR(). |
|
|
Definition at line 68 of file mixedpacking.h. Referenced by MixedBlockInfoType(), MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), ParseBlocks(), and setBlockDimensions(). |
|
|
Definition at line 61 of file mixedpacking.h. Referenced by BTreeAreaWireAnnealer::getSoftBlIndex(), BTreeAreaWireAnnealer::getSoftBlNewDimensions(), MixedBlockInfoType(), and OutputMixedBlockInfoType(). |
|
|
|
Definition at line 47 of file mixedpacking.cxx. Referenced by BTreeAreaWireAnnealer::constructor_core(), MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(), OutputMixedBlockInfoType(), ParseBlocks(), and set_blockARinfo_AR(). |
1.3.2