#include <btreecompact.h>
Inheritance diagram for BTreeCompactor:


Public Types | |
| enum | MoveType { SWAP, ROTATE, MOVE } |
Public Member Functions | |
| BTreeCompactor (const BTree &orig_tree) | |
| void | operator= (const BTree &new_tree) |
| void | slimAssign (const BTree &new_tree) |
| int | compact () |
| void | build_orth_tree () |
| const vector< double > & | xloc () const |
| double | xloc (int index) const |
| const vector< double > & | yloc () const |
| double | yloc (int index) const |
| double | width (int index) const |
| double | height (int index) const |
| double | blockArea () const |
| double | totalArea () const |
| double | totalWidth () const |
| double | totalHeight () const |
| void | setTree (const vector< BTreeNode > &ntree) |
| void | evaluate (const vector< BTreeNode > &ntree) |
| void | evaluate (const vector< int > &tree_bits, const vector< int > &perm, const vector< int > &orient) |
| void | swap (int indexOne, int indexTwo) |
| void | rotate (int index, int newOrient) |
| void | move (int index, int target, bool leftChild) |
| void | save_bbb (const string &filename) const |
Static Public Member Functions | |
| void | bits2tree (const vector< int > &tree_bits, const vector< int > &perm, const vector< int > &orient, vector< BTreeNode > &ntree) |
| void | clean_tree (vector< BTreeNode > &otree) |
| void | clean_contour (vector< ContourNode > &oContour) |
Public Attributes | |
| const vector< BTreeNode > & | orth_tree |
| const vector< BTreeNode > & | tree |
| const vector< ContourNode > & | contour |
| const int | NUM_BLOCKS |
Static Public Attributes | |
| const int | UNDEFINED = Dimension::UNDEFINED |
Protected Member Functions | |
| void | contour_evaluate () |
| void | contour_add_block (int treePtr) |
| void | swap_parent_child (int parent, bool isLeft) |
| void | remove_left_up_right_down (int index) |
Protected Attributes | |
| const HardBlockInfoType & | in_blockinfo |
| vector< BTreeNode > | in_tree |
| vector< ContourNode > | in_contour |
| vector< double > | in_xloc |
| vector< double > | in_yloc |
| vector< double > | in_width |
| vector< double > | in_height |
| double | in_blockArea |
| double | in_totalArea |
| double | in_totalWidth |
| double | in_totalHeight |
| const double | TOLERANCE |
Private Member Functions | |
| void | build_orth_tree_add_block (int treePtr) |
Static Private Member Functions | |
| void | fix_orth_tree (vector< BTreeNode > &orth_tree) |
Private Attributes | |
| vector< BTreeNode > | in_orth_tree |
|
|
Definition at line 83 of file btree.h. Referenced by BTreeAreaWireAnnealer::get_move(), and BTreeAreaWireAnnealer::makeMove().
|
|
|
Definition at line 76 of file btreecompact.h. References OrientedPacking::flip(), in_orth_tree, OrientedPacking::ORIENT, and BTree::UNDEFINED.
00077 : BTree(orig_tree), 00078 orth_tree(in_orth_tree), 00079 in_orth_tree(orig_tree.tree.size()) 00080 { 00081 int vec_size = in_orth_tree.size(); 00082 for (int i = 0; i < vec_size; i++) 00083 { 00084 in_orth_tree[i].parent = UNDEFINED; 00085 in_orth_tree[i].left = UNDEFINED; 00086 in_orth_tree[i].right = UNDEFINED; 00087 in_orth_tree[i].block_index = orig_tree.tree[i].block_index; 00088 in_orth_tree[i].orient = 00089 OrientedPacking::flip(OrientedPacking::ORIENT(orig_tree.tree[i].orient)); 00090 } 00091 } |
Here is the call graph for this function:

|
||||||||||||||||||||
|
Definition at line 197 of file btree.cxx. References BTree::clean_tree(), and BTree::UNDEFINED. Referenced by BTree::evaluate().
00201 {
00202 int perm_size = perm.size();
00203 ntree.resize(perm_size+2);
00204 clean_tree(ntree);
00205
00206 int treePtr = perm_size;
00207 int bitsPtr = 0;
00208
00209 int lastAct = -1;
00210 for (int i = 0; i < perm_size; i++)
00211 {
00212 int currAct = tree_bits[bitsPtr];
00213 while (currAct == 1)
00214 {
00215 // move up a level/sibling
00216 if (lastAct == 1)
00217 treePtr = ntree[treePtr].parent;
00218
00219 // move among siblings
00220 while (ntree[treePtr].right != UNDEFINED)
00221 treePtr = ntree[treePtr].parent;
00222 bitsPtr++;
00223 lastAct = 1;
00224 currAct = tree_bits[bitsPtr];
00225 }
00226
00227 if (lastAct != 1)
00228 ntree[treePtr].left = perm[i];
00229 else // lastAct == 1
00230 ntree[treePtr].right = perm[i];
00231
00232 ntree[perm[i]].parent = treePtr;
00233 ntree[perm[i]].block_index = perm[i];
00234 ntree[perm[i]].orient = orient[i];
00235
00236 treePtr = perm[i];
00237 lastAct = 0;
00238 bitsPtr++;
00239 }
00240 }
|
Here is the call graph for this function:

|
|
Definition at line 217 of file btree.h. References BTree::in_blockArea. Referenced by BTreeCompactSlice(), OutputBTree(), BTreeAreaWireAnnealer::packOneBlock(), and slimAssign().
00218 { return in_blockArea; }
|
|
|
Definition at line 43 of file btreecompact.cxx. References build_orth_tree_add_block(), BTree::clean_contour(), BTree::clean_tree(), fix_orth_tree(), BTree::in_contour, in_orth_tree, BTree::in_totalArea, BTree::in_totalHeight, BTree::in_totalWidth, BTree::in_tree, BTree::NUM_BLOCKS, and BTree::UNDEFINED. Referenced by compact(), and BTreeSlackEval::evaluateXSlacks().
00044 {
00045 clean_contour(in_contour);
00046 clean_tree(in_orth_tree);
00047
00048 int tree_prev = NUM_BLOCKS;
00049 int tree_curr = in_tree[NUM_BLOCKS].left; // start with first block
00050 while (tree_curr != NUM_BLOCKS) // until reach the root again
00051 {
00052 if (tree_prev == in_tree[tree_curr].parent)
00053 {
00054 build_orth_tree_add_block(tree_curr);
00055 tree_prev = tree_curr;
00056 if (in_tree[tree_curr].left != UNDEFINED)
00057 tree_curr = in_tree[tree_curr].left;
00058 else if (in_tree[tree_curr].right != UNDEFINED)
00059 tree_curr = in_tree[tree_curr].right;
00060 else
00061 tree_curr = in_tree[tree_curr].parent;
00062 }
00063 else if (tree_prev == in_tree[tree_curr].left)
00064 {
00065 tree_prev = tree_curr;
00066 if (in_tree[tree_curr].right != UNDEFINED)
00067 tree_curr = in_tree[tree_curr].right;
00068 else
00069 tree_curr = in_tree[tree_curr].parent;
00070 }
00071 else
00072 {
00073 tree_prev = tree_curr;
00074 tree_curr = in_tree[tree_curr].parent;
00075 }
00076 }
00077 in_totalWidth = in_contour[NUM_BLOCKS+1].begin;
00078
00079 int contour_ptr = in_contour[NUM_BLOCKS].next;
00080 in_totalHeight = 0;
00081 while (contour_ptr != NUM_BLOCKS+1)
00082 {
00083 in_totalHeight = max(in_totalHeight, in_contour[contour_ptr].CTL);
00084 contour_ptr = in_contour[contour_ptr].next;
00085 }
00086 in_totalArea = in_totalWidth * in_totalHeight;
00087
00088 fix_orth_tree(in_orth_tree);
00089 }
|
Here is the call graph for this function:

|
|
Definition at line 91 of file btreecompact.cxx. References BTree::in_blockinfo, BTree::in_contour, BTree::in_height, in_orth_tree, BTree::in_tree, BTree::in_width, BTree::in_xloc, BTree::in_yloc, BTree::NUM_BLOCKS, BTree::TOLERANCE, and BTree::UNDEFINED. Referenced by build_orth_tree().
00092 {
00093 int tree_parent = in_tree[tree_ptr].parent;
00094 int orth_tree_parent = NUM_BLOCKS;
00095
00096 double maxCTL = -1;
00097 int contour_ptr = UNDEFINED;
00098 int contour_prev = UNDEFINED;
00099
00100 if (tree_ptr == in_tree[in_tree[tree_ptr].parent].left)
00101 {
00102 in_contour[tree_ptr].begin = in_contour[tree_parent].end;
00103 contour_ptr = in_contour[tree_parent].next;
00104 }
00105 else
00106 {
00107 in_contour[tree_ptr].begin = in_contour[tree_parent].begin;
00108 contour_ptr = tree_parent;
00109 }
00110 contour_prev = in_contour[contour_ptr].prev; // begins of cPtr/tPtr match
00111 orth_tree_parent = contour_ptr; // initialize necessary
00112 maxCTL = in_contour[contour_ptr].CTL; // since width/height may be 0
00113
00114 int block = in_tree[tree_ptr].block_index;
00115 int theta = in_tree[tree_ptr].orient;
00116 in_contour[tree_ptr].end =
00117 in_contour[tree_ptr].begin + in_blockinfo[block].width[theta];
00118
00119 while (in_contour[contour_ptr].end <=
00120 in_contour[tree_ptr].end + TOLERANCE)
00121 {
00122 if (in_contour[contour_ptr].CTL > maxCTL)
00123 {
00124 maxCTL = in_contour[contour_ptr].CTL;
00125 orth_tree_parent = contour_ptr;
00126 }
00127 contour_ptr = in_contour[contour_ptr].next;
00128 }
00129
00130 if (in_contour[contour_ptr].begin + TOLERANCE <
00131 in_contour[tree_ptr].end)
00132 {
00133 if (in_contour[contour_ptr].CTL > maxCTL)
00134 {
00135 maxCTL = in_contour[contour_ptr].CTL;
00136 orth_tree_parent = contour_ptr;
00137 }
00138 }
00139
00140 in_xloc[tree_ptr] = in_contour[tree_ptr].begin;
00141 in_yloc[tree_ptr] = maxCTL;
00142 in_width[tree_ptr] = in_blockinfo[block].width[theta];
00143 in_height[tree_ptr] = in_blockinfo[block].height[theta];
00144
00145 in_contour[tree_ptr].CTL = maxCTL + in_blockinfo[block].height[theta];
00146 in_contour[tree_ptr].next = contour_ptr;
00147 in_contour[contour_ptr].prev = tree_ptr;
00148 in_contour[contour_ptr].begin = in_contour[tree_ptr].end;
00149
00150 in_contour[tree_ptr].prev = contour_prev;
00151 in_contour[contour_prev].next = tree_ptr;
00152 in_contour[tree_ptr].begin = in_contour[contour_prev].end;
00153
00154 // edit "in_orth_tree", the orthogonal tree
00155 if (in_orth_tree[orth_tree_parent].left == UNDEFINED)
00156 {
00157 // left-child of the parent
00158 in_orth_tree[orth_tree_parent].left = tree_ptr;
00159 in_orth_tree[tree_ptr].parent = orth_tree_parent;
00160 }
00161 else
00162 {
00163 // sibling fo the left-child of the parent
00164 int orth_tree_ptr = in_orth_tree[orth_tree_parent].left;
00165 while (in_orth_tree[orth_tree_ptr].right != UNDEFINED)
00166 orth_tree_ptr = in_orth_tree[orth_tree_ptr].right;
00167
00168 in_orth_tree[orth_tree_ptr].right = tree_ptr;
00169 in_orth_tree[tree_ptr].parent = orth_tree_ptr;
00170 }
00171 }
|
|
|
Definition at line 248 of file btree.h. References basepacking_h::Dimension::INFTY, and BTree::UNDEFINED. Referenced by build_orth_tree(), and BTree::contour_evaluate().
00249 {
00250 int vec_size = oContour.size();
00251 int Ledge = vec_size-2;
00252 int Bedge = vec_size-1;
00253
00254 oContour[Ledge].next = Bedge;
00255 oContour[Ledge].prev = UNDEFINED;
00256 oContour[Ledge].begin = 0;
00257 oContour[Ledge].end = 0;
00258 oContour[Ledge].CTL = basepacking_h::Dimension::INFTY;
00259
00260 oContour[Bedge].next = UNDEFINED;
00261 oContour[Bedge].prev = Ledge;
00262 oContour[Bedge].begin = 0;
00263 oContour[Bedge].end = basepacking_h::Dimension::INFTY;
00264 oContour[Bedge].CTL = 0;
00265 }
|
|
|
Definition at line 232 of file btree.h. References BTree::UNDEFINED. Referenced by BTree::bits2tree(), BTreeSlackEval::BTreeSlackEval(), build_orth_tree(), and BTreeSlackEval::reverse_tree().
00233 {
00234 int vec_size = otree.size();
00235 for (int i = 0; i < vec_size; i++)
00236 {
00237 otree[i].parent = UNDEFINED;
00238 otree[i].left = UNDEFINED;
00239 otree[i].right = UNDEFINED;
00240 }
00241 otree[vec_size-2].block_index = vec_size-2;
00242 otree[vec_size-1].block_index = vec_size-1;
00243
00244 otree[vec_size-2].orient = UNDEFINED;
00245 otree[vec_size-1].orient = UNDEFINED;
00246 }
|
|
|
Definition at line 122 of file btreecompact.h. References build_orth_tree(), in_orth_tree, BTree::in_tree, BTree::in_xloc, BTree::in_yloc, and BTree::NUM_BLOCKS. Referenced by BTreeCompactSlice(), BTreeAreaWireAnnealer::compactBlocks(), and BTreeAreaWireAnnealer::compactSoln().
00123 {
00124 vector<double> orig_xloc(in_xloc);
00125 vector<double> orig_yloc(in_yloc);
00126
00127 build_orth_tree();
00128 swap_ranges(in_tree.begin(), in_tree.end(),
00129 in_orth_tree.begin());
00130 // cout << "-----here1: after build_orth_tree()-----" << endl;
00131 // cout << "in_tree: " << endl;
00132 // OutputBTree(cout, in_tree);
00133 // cout << endl << endl;
00134 // cout << "in_orth_tree:" << endl;
00135 // OutputBTree(cout, in_orth_tree);
00136 // cout << endl << endl;
00137
00138 build_orth_tree();
00139 swap_ranges(in_tree.begin(), in_tree.end(),
00140 in_orth_tree.begin());
00141 // cout << "-----here2: after build_orth_tree()-----" << endl;
00142 // cout << "in_tree: " << endl;
00143 // OutputBTree(cout, in_tree);
00144 // cout << endl << endl;
00145 // cout << "in_orth_tree: " << endl;
00146 // OutputBTree(cout, in_orth_tree);
00147 // cout << endl << endl;
00148 // cout << "-----flipped packing-----" << endl;
00149 // OutputPacking(cout, BTreeOrientedPacking(*this));
00150
00151 // ofstream outfile;
00152 // outfile.open("dummy_flipped");
00153 // Save_bbb(outfile, BTreeOrientedPacking(*this));
00154 // outfile.close();
00155
00156 build_orth_tree();
00157
00158 int count = 0;
00159 for (int i = 0; i < NUM_BLOCKS; i++)
00160 {
00161 if ((orig_xloc[i] != in_xloc[i]) ||
00162 (orig_yloc[i] != in_yloc[i]))
00163 count ++;
00164 }
00165 return count;
00166 }
|
Here is the call graph for this function:

|
|
Definition at line 484 of file btree.cxx. References BTree::in_blockinfo, BTree::in_contour, BTree::in_height, BTree::in_tree, BTree::in_width, BTree::in_xloc, BTree::in_yloc, BTree::TOLERANCE, and BTree::UNDEFINED. Referenced by BTree::contour_evaluate().
00485 {
00486 int tree_parent = in_tree[tree_ptr].parent;
00487 double maxCTL = -1;
00488 int contour_ptr = UNDEFINED;
00489 int contour_prev = UNDEFINED;
00490
00491 if (tree_ptr == in_tree[in_tree[tree_ptr].parent].left)
00492 {
00493 in_contour[tree_ptr].begin = in_contour[tree_parent].end;
00494 contour_ptr = in_contour[tree_parent].next;
00495 }
00496 else
00497 {
00498 in_contour[tree_ptr].begin = in_contour[tree_parent].begin;
00499 contour_ptr = tree_parent;
00500 }
00501 contour_prev = in_contour[contour_ptr].prev; // begins of cPtr/tPtr match
00502 maxCTL = in_contour[contour_ptr].CTL;
00503
00504 int block = in_tree[tree_ptr].block_index;
00505 int theta = in_tree[tree_ptr].orient;
00506 in_contour[tree_ptr].end =
00507 in_contour[tree_ptr].begin + in_blockinfo[block].width[theta];
00508
00509 while (in_contour[contour_ptr].end <=
00510 in_contour[tree_ptr].end + TOLERANCE)
00511 {
00512 maxCTL = max(maxCTL, in_contour[contour_ptr].CTL);
00513 contour_ptr = in_contour[contour_ptr].next;
00514 }
00515
00516 if (in_contour[contour_ptr].begin + TOLERANCE < in_contour[tree_ptr].end)
00517 maxCTL = max(maxCTL, in_contour[contour_ptr].CTL);
00518
00519 in_xloc[tree_ptr] = in_contour[tree_ptr].begin;
00520 in_yloc[tree_ptr] = maxCTL;
00521 in_width[tree_ptr] = in_blockinfo[block].width[theta];
00522 in_height[tree_ptr] = in_blockinfo[block].height[theta];
00523
00524 in_contour[tree_ptr].CTL = maxCTL + in_blockinfo[block].height[theta];
00525 in_contour[tree_ptr].next = contour_ptr;
00526 in_contour[contour_ptr].prev = tree_ptr;
00527 in_contour[contour_ptr].begin = in_contour[tree_ptr].end;
00528
00529 in_contour[tree_ptr].prev = contour_prev;
00530 in_contour[contour_prev].next = tree_ptr;
00531 in_contour[tree_ptr].begin = in_contour[contour_prev].end;
00532 }
|
|
|
Definition at line 438 of file btree.cxx. References BTree::clean_contour(), BTree::contour_add_block(), BTree::in_contour, BTree::in_totalArea, BTree::in_totalHeight, BTree::in_totalWidth, BTree::in_tree, BTree::NUM_BLOCKS, and BTree::UNDEFINED. Referenced by BTree::evaluate(), BTree::move(), BTree::rotate(), and BTree::swap().
00439 {
00440 clean_contour(in_contour);
00441
00442 int tree_prev = NUM_BLOCKS;
00443 int tree_curr = in_tree[NUM_BLOCKS].left; // start with first block
00444 while (tree_curr != NUM_BLOCKS) // until reach the root again
00445 {
00446 // cout << "tree_curr: " << tree_curr << endl;
00447 if (tree_prev == in_tree[tree_curr].parent)
00448 {
00449 contour_add_block(tree_curr);
00450 tree_prev = tree_curr;
00451 if (in_tree[tree_curr].left != UNDEFINED)
00452 tree_curr = in_tree[tree_curr].left;
00453 else if (in_tree[tree_curr].right != UNDEFINED)
00454 tree_curr = in_tree[tree_curr].right;
00455 else
00456 tree_curr = in_tree[tree_curr].parent;
00457 }
00458 else if (tree_prev == in_tree[tree_curr].left)
00459 {
00460 tree_prev = tree_curr;
00461 if (in_tree[tree_curr].right != UNDEFINED)
00462 tree_curr = in_tree[tree_curr].right;
00463 else
00464 tree_curr = in_tree[tree_curr].parent;
00465 }
00466 else
00467 {
00468 tree_prev = tree_curr;
00469 tree_curr = in_tree[tree_curr].parent;
00470 }
00471 }
00472 in_totalWidth = in_contour[NUM_BLOCKS+1].begin;
00473
00474 int contour_ptr = in_contour[NUM_BLOCKS].next;
00475 in_totalHeight = 0;
00476 while (contour_ptr != NUM_BLOCKS+1)
00477 {
00478 in_totalHeight = max(in_totalHeight, in_contour[contour_ptr].CTL);
00479 contour_ptr = in_contour[contour_ptr].next;
00480 }
00481 in_totalArea = in_totalWidth * in_totalHeight;
00482 }
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 182 of file btree.cxx. References BTree::bits2tree(), BTree::contour_evaluate(), BTree::in_tree, and BTree::NUM_BLOCKS.
00185 {
00186 if (int(perm.size()) != NUM_BLOCKS)
00187 {
00188 cout << "ERROR: the permutation length doesn't match with "
00189 << "size of the tree." << endl;
00190 exit(1);
00191 }
00192 bits2tree(tree_bits, perm, orient, in_tree);
00193 // OutputBTree(cout, in_tree);
00194 contour_evaluate();
00195 }
|
Here is the call graph for this function:

|
|
Definition at line 170 of file btree.cxx. References BTree::contour_evaluate(), and BTree::in_tree. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeFromSoftPacking::BTreeFromSoftPacking(), BTreeSlackEval::evaluateXSlacks(), BTreeSlackEval::evaluateYSlacks(), BTreeAreaWireAnnealer::GenerateRandomSoln(), BTreeAreaWireAnnealer::packSoftBlocks(), and BTreeAreaWireAnnealer::takePlfromDB().
00171 {
00172 if (ntree.size() != in_tree.size())
00173 {
00174 cout << "ERROR: size of btree's doesn't match." << endl;
00175 exit(1);
00176 }
00177
00178 in_tree = ntree;
00179 contour_evaluate();
00180 }
|
Here is the call graph for this function:

|
|
Definition at line 168 of file btreecompact.h. References BTree::NUM_BLOCKS. Referenced by build_orth_tree().
00169 {
00170 // fix the tree s.t. in_tree[NUM_BLOCKS] corresponds to the root
00171 const int NUM_BLOCKS = orth_tree.size() - 2;
00172 int bottomLeftBlock = orth_tree[NUM_BLOCKS+1].left;
00173
00174 orth_tree[bottomLeftBlock].parent = NUM_BLOCKS;
00175 iter_swap(&(orth_tree[NUM_BLOCKS]), &(orth_tree[NUM_BLOCKS+1]));
00176 }
|
|
|
Definition at line 214 of file btree.h. References BTree::in_height. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeOrientedPacking::BTreeOrientedPacking(), BTreeAreaWireAnnealer::DBfromSoln(), BTreeSlackEval::evaluateYSlacks(), BTreeAreaWireAnnealer::getSoftBlIndex(), BTreeAreaWireAnnealer::getSoftBlNewDimensions(), BTreeOrientedPacking::operator=(), OutputBTree(), BTreeAreaWireAnnealer::packOneBlock(), and BTreeAreaWireAnnealer::packSoftBlocks().
00215 { return in_height[index]; }
|
|
||||||||||||||||
|
Definition at line 355 of file btree.cxx. References BTree::contour_evaluate(), BTree::in_tree, BTree::remove_left_up_right_down(), and BTree::UNDEFINED. Referenced by BTreeAreaWireAnnealer::makeARWLMove(), BTreeAreaWireAnnealer::makeHPWLMove(), BTreeAreaWireAnnealer::makeMoveSlacksCore(), and BTreeAreaWireAnnealer::perform_move().
00358 {
00359 int index_parent = in_tree[index].parent;
00360 int index_left = in_tree[index].left;
00361 int index_right = in_tree[index].right;
00362
00363 // remove "index" from the tree
00364 if ((index_left != UNDEFINED) && (index_right != UNDEFINED))
00365 remove_left_up_right_down(index);
00366 else if (index_left != UNDEFINED)
00367 {
00368 in_tree[index_left].parent = index_parent;
00369 if (index == in_tree[index_parent].left)
00370 in_tree[index_parent].left = index_left;
00371 else
00372 in_tree[index_parent].right = index_left;
00373 }
00374 else if (index_right != UNDEFINED)
00375 {
00376 in_tree[index_right].parent = index_parent;
00377 if (index == in_tree[index_parent].left)
00378 in_tree[index_parent].left = index_right;
00379 else
00380 in_tree[index_parent].right = index_right;
00381 }
00382 else
00383 {
00384 if (index == in_tree[index_parent].left)
00385 in_tree[index_parent].left = UNDEFINED;
00386 else
00387 in_tree[index_parent].right = UNDEFINED;
00388 }
00389
00390 int target_left = in_tree[target].left;
00391 int target_right = in_tree[target].right;
00392
00393 // add "index" to the required location
00394 if (leftChild)
00395 {
00396 in_tree[target].left = index;
00397 if (target_left != UNDEFINED)
00398 in_tree[target_left].parent = index;
00399
00400 in_tree[index].parent = target;
00401 in_tree[index].left = target_left;
00402 in_tree[index].right = UNDEFINED;
00403 }
00404 else
00405 {
00406 in_tree[target].right = index;
00407 if (target_right != UNDEFINED)
00408 in_tree[target_right].parent = index;
00409
00410 in_tree[index].parent = target;
00411 in_tree[index].left = UNDEFINED;
00412 in_tree[index].right = target_right;
00413 }
00414
00415 contour_evaluate();
00416 }
|
Here is the call graph for this function:

|
|
Reimplemented from BTree. Definition at line 93 of file btreecompact.h. References OrientedPacking::flip(), in_orth_tree, BTree::operator=(), OrientedPacking::ORIENT, BTree::tree, and BTree::UNDEFINED.
00094 {
00095 this->BTree::operator =(new_tree);
00096 for (unsigned int i = 0; i < in_orth_tree.size(); i++)
00097 {
00098 in_orth_tree[i].parent = UNDEFINED;
00099 in_orth_tree[i].left = UNDEFINED;
00100 in_orth_tree[i].right = UNDEFINED;
00101 in_orth_tree[i].block_index = new_tree.tree[i].block_index;
00102 in_orth_tree[i].orient =
00103 OrientedPacking::flip(OrientedPacking::ORIENT(new_tree.tree[i].orient));
00104 }
00105 }
|
Here is the call graph for this function:

|
|
Definition at line 418 of file btree.cxx. References BTree::in_tree, and BTree::UNDEFINED. Referenced by BTree::move().
00419 {
00420 int index_parent = in_tree[index].parent;
00421 int index_left = in_tree[index].left;
00422 int index_right = in_tree[index].right;
00423
00424 in_tree[index_left].parent = index_parent;
00425 if (index == in_tree[index_parent].left)
00426 in_tree[index_parent].left = index_left;
00427 else
00428 in_tree[index_parent].right = index_left;
00429
00430 int ptr = index_left;
00431 while (in_tree[ptr].right != UNDEFINED)
00432 ptr = in_tree[ptr].right;
00433
00434 in_tree[ptr].right = index_right;
00435 in_tree[index_right].parent = ptr;
00436 }
|
|
||||||||||||
|
Definition at line 267 of file btree.h. References BTree::contour_evaluate(), and BTree::in_tree. Referenced by BTreeAreaWireAnnealer::packOneBlock(), and BTreeAreaWireAnnealer::perform_rotate().
00269 {
00270 in_tree[index].orient = newOrient;
00271 contour_evaluate();
00272 }
|
Here is the call graph for this function:

|
|
Definition at line 534 of file btree.cxx. References BTree::in_height, BTree::in_totalHeight, BTree::in_totalWidth, BTree::in_width, BTree::in_xloc, BTree::in_yloc, and BTree::NUM_BLOCKS. Referenced by DebugBTreeAnnealerFromDB().
00535 {
00536 ofstream outfile;
00537 outfile.open(filename.c_str());
00538 if (!outfile.good())
00539 {
00540 cout << "ERROR: cannot open file" << filename << endl;
00541 exit(1);
00542 }
00543
00544 outfile.setf(ios::fixed);
00545 outfile.precision(3);
00546
00547 outfile << in_totalWidth << endl;
00548 outfile << in_totalHeight << endl;
00549 outfile << NUM_BLOCKS << endl;
00550 for (int i = 0; i < NUM_BLOCKS; i++)
00551 outfile << in_width[i] << " " << in_height[i] << endl;
00552 outfile << endl;
00553
00554 for (int i = 0; i < NUM_BLOCKS; i++)
00555 outfile << in_xloc[i] << " " << in_yloc[i] << endl;
00556 outfile << endl;
00557 }
|
|
|
Definition at line 229 of file btree.h. References BTree::in_tree. Referenced by BTreeAreaWireAnnealer::perform_move(), and BTreeAreaWireAnnealer::perform_rotate().
00230 { in_tree = ntree; }
|
|
|
Definition at line 107 of file btreecompact.h. References BTree::blockArea(), OrientedPacking::flip(), BTree::in_blockArea, in_orth_tree, BTree::in_tree, OrientedPacking::ORIENT, BTree::tree, and BTree::UNDEFINED. Referenced by BTreeSlackEval::evaluateSlacks().
00108 {
00109 in_tree = new_tree.tree;
00110 in_blockArea = new_tree.blockArea();
00111 for (unsigned int i = 0; i < in_orth_tree.size(); i++)
00112 {
00113 in_orth_tree[i].parent = UNDEFINED;
00114 in_orth_tree[i].left = UNDEFINED;
00115 in_orth_tree[i].right = UNDEFINED;
00116 in_orth_tree[i].block_index = new_tree.tree[i].block_index;
00117 in_orth_tree[i].orient =
00118 OrientedPacking::flip(OrientedPacking::ORIENT(new_tree.tree[i].orient));
00119 }
00120 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 242 of file btree.cxx. References BTree::contour_evaluate(), BTree::in_tree, BTree::swap_parent_child(), and BTree::UNDEFINED. Referenced by BTreeAreaWireAnnealer::perform_swap().
00244 {
00245 int indexOne_left = in_tree[indexOne].left;
00246 int indexOne_right = in_tree[indexOne].right;
00247 int indexOne_parent = in_tree[indexOne].parent;
00248
00249 int indexTwo_left = in_tree[indexTwo].left;
00250 int indexTwo_right = in_tree[indexTwo].right;
00251 int indexTwo_parent = in_tree[indexTwo].parent;
00252
00253 if (indexOne == indexTwo_parent)
00254 swap_parent_child(indexOne, (indexTwo == in_tree[indexOne].left));
00255 else if (indexTwo == indexOne_parent)
00256 swap_parent_child(indexTwo, (indexOne == in_tree[indexTwo].left));
00257 else
00258 {
00259 // update around indexOne
00260 in_tree[indexOne].parent = indexTwo_parent;
00261 in_tree[indexOne].left = indexTwo_left;
00262 in_tree[indexOne].right = indexTwo_right;
00263
00264 if (indexOne == in_tree[indexOne_parent].left)
00265 in_tree[indexOne_parent].left = indexTwo;
00266 else
00267 in_tree[indexOne_parent].right = indexTwo;
00268
00269 if (indexOne_left != UNDEFINED)
00270 in_tree[indexOne_left].parent = indexTwo;
00271
00272 if (indexOne_right != UNDEFINED)
00273 in_tree[indexOne_right].parent = indexTwo;
00274
00275 // update around indexTwo
00276 in_tree[indexTwo].parent = indexOne_parent;
00277 in_tree[indexTwo].left = indexOne_left;
00278 in_tree[indexTwo].right = indexOne_right;
00279
00280 if (indexTwo == in_tree[indexTwo_parent].left)
00281 in_tree[indexTwo_parent].left = indexOne;
00282 else
00283 in_tree[indexTwo_parent].right = indexOne;
00284
00285 if (indexTwo_left != UNDEFINED)
00286 in_tree[indexTwo_left].parent = indexOne;
00287
00288 if (indexTwo_right != UNDEFINED)
00289 in_tree[indexTwo_right].parent = indexOne;
00290 }
00291 contour_evaluate();
00292 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 294 of file btree.cxx. References BTree::in_tree, and BTree::UNDEFINED. Referenced by BTree::swap().
00296 {
00297 int parent_parent = in_tree[parent].parent;
00298 int parent_left = in_tree[parent].left;
00299 int parent_right = in_tree[parent].right;
00300
00301 int child = (isLeft)? in_tree[parent].left : in_tree[parent].right;
00302 int child_left = in_tree[child].left;
00303 int child_right = in_tree[child].right;
00304
00305 if (isLeft)
00306 {
00307 in_tree[parent].parent = child;
00308 in_tree[parent].left = child_left;
00309 in_tree[parent].right = child_right;
00310
00311 if (parent == in_tree[parent_parent].left)
00312 in_tree[parent_parent].left = child;
00313 else
00314 in_tree[parent_parent].right = child;
00315
00316 if (parent_right != UNDEFINED)
00317 in_tree[parent_right].parent = child;
00318
00319 in_tree[child].parent = parent_parent;
00320 in_tree[child].left = parent;
00321 in_tree[child].right = parent_right;
00322
00323 if (child_left != UNDEFINED)
00324 in_tree[child_left].parent = parent;
00325
00326 if (child_right != UNDEFINED)
00327 in_tree[child_right].parent = parent;
00328 }
00329 else
00330 {
00331 in_tree[parent].parent = child;
00332 in_tree[parent].left = child_left;
00333 in_tree[parent].right = child_right;
00334
00335 if (parent == in_tree[parent_parent].left)
00336 in_tree[parent_parent].left = child;
00337 else
00338 in_tree[parent_parent].right = child;
00339
00340 if (parent_left != UNDEFINED)
00341 in_tree[parent_left].parent = child;
00342
00343 in_tree[child].parent = parent_parent;
00344 in_tree[child].left = parent_left;
00345 in_tree[child].right = parent;
00346
00347 if (child_left != UNDEFINED)
00348 in_tree[child_left].parent = parent;
00349
00350 if (child_right != UNDEFINED)
00351 in_tree[child_right].parent = parent;
00352 }
00353 }
|
|
|
Definition at line 220 of file btree.h. References BTree::in_totalArea. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeCompactSlice(), BTreeAreaWireAnnealer::compactSoln(), BTreeAreaWireAnnealer::go(), OutputBTree(), and BTreeAreaWireAnnealer::packSoftBlocks().
00221 { return in_totalArea; }
|
|
|
Definition at line 226 of file btree.h. References BTree::in_totalHeight. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeCompactSlice(), BTreeAreaWireAnnealer::DBfromSoln(), DebugBTreeAnnealerFromDB(), BTreeSlackEval::evaluateYSlacks(), BTreeAreaWireAnnealer::locateSearchBlocks(), BTreeAreaWireAnnealer::makeARMove(), BTreeAreaWireAnnealer::makeARWLMove(), and OutputBTree().
00227 { return in_totalHeight; }
|
|
|
Definition at line 223 of file btree.h. References BTree::in_totalWidth. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeCompactSlice(), BTreeAreaWireAnnealer::DBfromSoln(), DebugBTreeAnnealerFromDB(), BTreeSlackEval::evaluateXSlacks(), BTreeAreaWireAnnealer::locateSearchBlocks(), BTreeAreaWireAnnealer::makeARMove(), BTreeAreaWireAnnealer::makeARWLMove(), and OutputBTree().
00224 { return in_totalWidth; }
|
|
|
Definition at line 211 of file btree.h. References BTree::in_width. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeOrientedPacking::BTreeOrientedPacking(), BTreeAreaWireAnnealer::DBfromSoln(), BTreeSlackEval::evaluateXSlacks(), BTreeAreaWireAnnealer::getSoftBlIndex(), BTreeAreaWireAnnealer::getSoftBlNewDimensions(), BTreeOrientedPacking::operator=(), OutputBTree(), BTreeAreaWireAnnealer::packOneBlock(), and BTreeAreaWireAnnealer::packSoftBlocks().
00212 { return in_width[index]; }
|
|
|
Definition at line 205 of file btree.h. References BTree::in_xloc.
00206 { return in_xloc[index]; }
|
|
|
Definition at line 199 of file btree.h. References BTree::in_xloc. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeOrientedPacking::BTreeOrientedPacking(), BTreeAreaWireAnnealer::DBfromSoln(), BTreeSlackEval::evaluateXSlacks(), BTreeAreaWireAnnealer::locateSearchBlocks(), BTreeOrientedPacking::operator=(), and OutputBTree().
00200 { return in_xloc; }
|
|
|
Definition at line 208 of file btree.h. References BTree::in_yloc.
00209 { return in_yloc[index]; }
|
|
|
Definition at line 202 of file btree.h. References BTree::in_yloc. Referenced by BTreeAreaWireAnnealer::anneal(), BTreeOrientedPacking::BTreeOrientedPacking(), BTreeAreaWireAnnealer::DBfromSoln(), BTreeSlackEval::evaluateXSlacks(), BTreeSlackEval::evaluateYSlacks(), BTreeAreaWireAnnealer::locateSearchBlocks(), BTreeOrientedPacking::operator=(), and OutputBTree().
00203 { return in_yloc; }
|
|
|
Definition at line 56 of file btree.h. Referenced by OutputBTree(). |
|
|
Definition at line 128 of file btree.h. Referenced by BTree::blockArea(), BTree::operator=(), and slimAssign(). |
|
|
Definition at line 118 of file btree.h. Referenced by build_orth_tree_add_block(), and BTree::contour_add_block(). |
|
|
Definition at line 120 of file btree.h. Referenced by BTree::BTree(), build_orth_tree(), build_orth_tree_add_block(), BTree::contour_add_block(), BTree::contour_evaluate(), and BTree::operator=(). |
|
|
Definition at line 126 of file btree.h. Referenced by BTree::BTree(), build_orth_tree_add_block(), BTree::contour_add_block(), BTree::height(), BTree::operator=(), and BTree::save_bbb(). |
|
|
Definition at line 61 of file btreecompact.h. Referenced by BTreeCompactor(), build_orth_tree(), build_orth_tree_add_block(), compact(), operator=(), and slimAssign(). |
|
|
Definition at line 129 of file btree.h. Referenced by build_orth_tree(), BTree::contour_evaluate(), BTree::operator=(), and BTree::totalArea(). |
|
|
Definition at line 131 of file btree.h. Referenced by build_orth_tree(), BTree::contour_evaluate(), BTree::operator=(), BTree::save_bbb(), and BTree::totalHeight(). |
|
|
Definition at line 130 of file btree.h. Referenced by build_orth_tree(), BTree::contour_evaluate(), BTree::operator=(), BTree::save_bbb(), and BTree::totalWidth(). |
|
|
|
Definition at line 125 of file btree.h. Referenced by BTree::BTree(), build_orth_tree_add_block(), BTree::contour_add_block(), BTree::operator=(), BTree::save_bbb(), and BTree::width(). |
|
|
Definition at line 123 of file btree.h. Referenced by BTree::BTree(), build_orth_tree_add_block(), compact(), BTree::contour_add_block(), BTree::operator=(), BTree::save_bbb(), and BTree::xloc(). |
|
|
Definition at line 124 of file btree.h. Referenced by BTree::BTree(), build_orth_tree_add_block(), compact(), BTree::contour_add_block(), BTree::operator=(), BTree::save_bbb(), and BTree::yloc(). |
|
|
|
Definition at line 58 of file btreecompact.h. Referenced by BTreeSlackEval::evaluateXSlacks(). |
|
|
Definition at line 133 of file btree.h. Referenced by build_orth_tree_add_block(), and BTree::contour_add_block(). |
|
|
1.3.2