#include <plsptobtree.h>
Collaboration diagram for PlSP2BTree:
Public Member Functions | |
PlSP2BTree (const vector< double > &n_xloc, const vector< double > &n_yloc, const vector< double > &n_widths, const vector< double > &n_heights, const vector< int > &XX, const vector< int > &YY) | |
PlSP2BTree (const vector< double > &n_xloc, const vector< double > &n_yloc, const vector< double > &n_widths, const vector< double > &n_heights, const vector< unsigned int > &XX, const vector< unsigned int > &YY) | |
const vector< BTree::BTreeNode > & | btree () const |
const vector< int > & | SP_XX () const |
const vector< int > & | SP_YY () const |
const vector< int > & | SP_XXinverse () const |
const vector< int > & | SP_YYinverse () const |
bool | SPleftof (int i, int j) const |
bool | SPrightof (int i, int j) const |
bool | SPabove (int i, int j) const |
bool | SPbelow (int i, int j) const |
Public Attributes | |
const vector< double > & | xloc |
const vector< double > & | yloc |
const vector< double > & | widths |
const vector< double > & | heights |
Static Public Attributes | |
const double | INFTY = basepacking_h::Dimension::INFTY |
const int | UNDEFINED = BTree::UNDEFINED |
Private Member Functions | |
void | constructor_core () |
void | initializeTree () |
void | build_tree () |
void | build_tree_add_block (int currBlock, int otree_parent) |
Private Attributes | |
int | _blocknum |
vector< int > | _XX |
vector< int > | _YY |
vector< int > | _XXinverse |
vector< int > | _YYinverse |
vector< BTree::BTreeNode > | _btree |
|
Definition at line 48 of file plsptobtree.cxx. References constructor_core().
00054 : xloc(n_xloc), 00055 yloc(n_yloc), 00056 widths(n_widths), 00057 heights(n_heights), 00058 _blocknum(n_xloc.size()), 00059 _XX(XX), 00060 _YY(YY), 00061 _XXinverse(_blocknum), 00062 _YYinverse(_blocknum), 00063 _btree(_blocknum+2) 00064 { 00065 constructor_core(); 00066 } |
Here is the call graph for this function:
|
Definition at line 68 of file plsptobtree.cxx. References _blocknum, _XX, _YY, and constructor_core().
00074 : xloc(n_xloc), 00075 yloc(n_yloc), 00076 widths(n_widths), 00077 heights(n_heights), 00078 _blocknum(n_xloc.size()), 00079 _XX(_blocknum), 00080 _YY(_blocknum), 00081 _XXinverse(_blocknum), 00082 _YYinverse(_blocknum), 00083 _btree(_blocknum+2) 00084 { 00085 for (int i = 0; i < _blocknum; i++) 00086 { 00087 _XX[i] = int(XX[i]); 00088 _YY[i] = int(YY[i]); 00089 } 00090 constructor_core(); 00091 } |
Here is the call graph for this function:
|
Definition at line 99 of file plsptobtree.h. References _btree. Referenced by Pl2BTree::TCG_build_tree().
00100 { return _btree; } |
|
Definition at line 93 of file plsptobtree.cxx. References _blocknum, _XXinverse, _YY, build_tree_add_block(), SPleftof(), widths, and xloc. Referenced by constructor_core().
00094 { 00095 for (int i = 0; i < _blocknum; i++) 00096 { 00097 int currBlock = _YY[i]; 00098 int otree_parent = _blocknum; // left-edge initially 00099 00100 double currXStart = xloc[currBlock]; 00101 double minDistance = currXStart; 00102 int parentMaxIndex = _blocknum; 00103 for (int j = i-1; j >= 0; j--) 00104 { 00105 int tempBlock = _YY[j]; 00106 if (SPleftof(tempBlock, currBlock)) 00107 { 00108 if (_XXinverse[tempBlock] < parentMaxIndex) 00109 { 00110 double tempDistance = 00111 currXStart - xloc[tempBlock] - widths[tempBlock]; 00112 if (tempDistance < minDistance) 00113 { 00114 minDistance = tempDistance; 00115 otree_parent = tempBlock; 00116 } 00117 } 00118 } 00119 else // SPbelow(tempBlock, currBlock) 00120 parentMaxIndex = min(parentMaxIndex, _XXinverse[tempBlock]); 00121 } 00122 build_tree_add_block(currBlock, otree_parent); 00123 } 00124 } |
Here is the call graph for this function:
|
Definition at line 126 of file plsptobtree.cxx. References _btree, UNDEFINED, and yloc. Referenced by build_tree().
00128 { 00129 // printf("block %d added with block %d as its otree-parent\n", 00130 // currBlock, otree_parent); 00131 00132 if (_btree[otree_parent].left == UNDEFINED) 00133 { 00134 _btree[otree_parent].left = currBlock; 00135 _btree[currBlock].parent = otree_parent; 00136 } 00137 else 00138 { 00139 int tree_prev = otree_parent; 00140 int tree_curr = _btree[otree_parent].left; 00141 while ((tree_curr != UNDEFINED) && 00142 (yloc[tree_curr] < yloc[currBlock])) 00143 { 00144 tree_prev = tree_curr; 00145 tree_curr = _btree[tree_curr].right; 00146 } 00147 00148 // printf("tree_curr: %d tree_prev: %d\n", tree_curr, tree_prev); 00149 // printf("YLOC: tree_curr: %.2lf currBlock: %.2lf tree_prev: %.2lf\n", 00150 // (tree_curr != UNDEFINED)? yloc[tree_curr] : -1, 00151 // yloc[currBlock], yloc[tree_prev]); 00152 00153 if ((tree_curr != UNDEFINED) && 00154 (tree_curr == _btree[tree_prev].left)) 00155 _btree[tree_prev].left = currBlock; 00156 else 00157 _btree[tree_prev].right = currBlock; 00158 _btree[currBlock].parent = tree_prev; 00159 00160 _btree[currBlock].right = tree_curr; // possibly UNDEFINED 00161 if (tree_curr != UNDEFINED) 00162 _btree[tree_curr].parent = currBlock; 00163 } 00164 } |
|
Definition at line 166 of file plsptobtree.cxx. References _blocknum, _XX, _XXinverse, _YY, _YYinverse, build_tree(), and initializeTree(). Referenced by PlSP2BTree().
00167 { 00168 initializeTree(); 00169 for (int i = 0; i < _blocknum; i++) 00170 { 00171 _XXinverse[_XX[i]] = i; 00172 _YYinverse[_YY[i]] = i; 00173 } 00174 build_tree(); 00175 } |
Here is the call graph for this function:
|
Definition at line 177 of file plsptobtree.cxx. References _blocknum, _btree, and UNDEFINED. Referenced by constructor_core().
00178 { 00179 int vec_size = int(_btree.size()); 00180 for (int i = 0; i < vec_size; i++) 00181 { 00182 _btree[i].parent = _blocknum; 00183 _btree[i].left = UNDEFINED; 00184 _btree[i].right = UNDEFINED; 00185 _btree[i].block_index = i; 00186 _btree[i].orient = 0; 00187 } 00188 00189 _btree[_blocknum].parent = UNDEFINED; 00190 _btree[_blocknum].left = UNDEFINED; 00191 _btree[_blocknum].right = UNDEFINED; 00192 _btree[_blocknum].block_index = _blocknum; 00193 _btree[_blocknum].orient = UNDEFINED; 00194 00195 _btree[_blocknum+1].parent = _blocknum; 00196 _btree[_blocknum+1].left = UNDEFINED; 00197 _btree[_blocknum+1].right = UNDEFINED; 00198 _btree[_blocknum+1].block_index = _blocknum+1; 00199 _btree[_blocknum+1].orient = UNDEFINED; 00200 } |
|
Definition at line 102 of file plsptobtree.h. References _XX.
00103 { return _XX; } |
|
Definition at line 108 of file plsptobtree.h. References _XXinverse.
00109 { return _XXinverse; } |
|
Definition at line 105 of file plsptobtree.h. References _YY.
00106 { return _YY; } |
|
Definition at line 111 of file plsptobtree.h. References _YYinverse.
00112 { return _YYinverse; } |
|
Definition at line 121 of file plsptobtree.h. References _XXinverse, and _YYinverse. Referenced by SPbelow().
00122 { return (_XXinverse[i] < _XXinverse[j] && 00123 _YYinverse[i] > _YYinverse[j]); } |
|
Definition at line 125 of file plsptobtree.h. References SPabove().
00126 { return SPabove(j, i); } |
Here is the call graph for this function:
|
Definition at line 114 of file plsptobtree.h. References _XXinverse, and _YYinverse. Referenced by build_tree(), and SPrightof().
00115 { return (_XXinverse[i] < _XXinverse[j] && 00116 _YYinverse[i] < _YYinverse[j]); } |
|
Definition at line 118 of file plsptobtree.h. References SPleftof().
00119 { return SPleftof(j, i); } |
Here is the call graph for this function:
|
Definition at line 81 of file plsptobtree.h. Referenced by build_tree(), constructor_core(), initializeTree(), and PlSP2BTree(). |
|
Definition at line 86 of file plsptobtree.h. Referenced by btree(), build_tree_add_block(), and initializeTree(). |
|
Definition at line 82 of file plsptobtree.h. Referenced by constructor_core(), PlSP2BTree(), and SP_XX(). |
|
Definition at line 84 of file plsptobtree.h. Referenced by build_tree(), constructor_core(), SP_XXinverse(), SPabove(), and SPleftof(). |
|
Definition at line 83 of file plsptobtree.h. Referenced by build_tree(), constructor_core(), PlSP2BTree(), and SP_YY(). |
|
Definition at line 85 of file plsptobtree.h. Referenced by constructor_core(), SP_YYinverse(), SPabove(), and SPleftof(). |
|
Definition at line 70 of file plsptobtree.h. |
|
Definition at line 45 of file plsptobtree.cxx. |
|
Definition at line 46 of file plsptobtree.cxx. Referenced by build_tree_add_block(), and initializeTree(). |
|
Definition at line 69 of file plsptobtree.h. Referenced by build_tree(). |
|
Definition at line 67 of file plsptobtree.h. Referenced by build_tree(). |
|
Definition at line 68 of file plsptobtree.h. Referenced by build_tree_add_block(). |