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

plsptobtree.h

Go to the documentation of this file.
00001 /**************************************************************************
00002 ***    
00003 *** Copyright (c) 1995-2000 Regents of the University of California,
00004 ***               Andrew E. Caldwell, Andrew B. Kahng and Igor L. Markov
00005 *** Copyright (c) 2000-2004 Regents of the University of Michigan,
00006 ***               Saurabh N. Adya, Jarrod A. Roy and Igor L. Markov
00007 ***
00008 ***  Contact author(s): abk@cs.ucsd.edu, imarkov@umich.edu
00009 ***  Original Affiliation:   UCLA, Computer Science Department,
00010 ***                          Los Angeles, CA 90095-1596 USA
00011 ***
00012 ***  Permission is hereby granted, free of charge, to any person obtaining 
00013 ***  a copy of this software and associated documentation files (the
00014 ***  "Software"), to deal in the Software without restriction, including
00015 ***  without limitation 
00016 ***  the rights to use, copy, modify, merge, publish, distribute, sublicense, 
00017 ***  and/or sell copies of the Software, and to permit persons to whom the 
00018 ***  Software is furnished to do so, subject to the following conditions:
00019 ***
00020 ***  The above copyright notice and this permission notice shall be included
00021 ***  in all copies or substantial portions of the Software.
00022 ***
00023 *** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
00024 *** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00025 *** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
00026 *** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
00027 *** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
00028 *** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
00029 *** THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00030 ***
00031 ***
00032 ***************************************************************************/
00033 
00034 
00035 #ifndef PLSPTOBTREE_H
00036 #define PLSPTOBTREE_H
00037 
00038 #include "btree.h"
00039 
00040 #include <vector>
00041 using namespace std;
00042 
00043 // --------------------------------------------------------
00044 class PlSP2BTree
00045 {
00046 public:
00047    PlSP2BTree(const vector<double>& n_xloc,
00048               const vector<double>& n_yloc,
00049               const vector<double>& n_widths,
00050               const vector<double>& n_heights,
00051               const vector<int>& XX,
00052               const vector<int>& YY);
00053 
00054    PlSP2BTree(const vector<double>& n_xloc,
00055               const vector<double>& n_yloc,
00056               const vector<double>& n_widths,
00057               const vector<double>& n_heights,
00058               const vector<unsigned int>& XX,
00059               const vector<unsigned int>& YY);
00060 
00061    inline const vector<BTree::BTreeNode>& btree() const;
00062    inline const vector<int>& SP_XX() const;
00063    inline const vector<int>& SP_YY() const;
00064    inline const vector<int>& SP_XXinverse() const;
00065    inline const vector<int>& SP_YYinverse() const;
00066    
00067    const vector<double>& xloc;
00068    const vector<double>& yloc;
00069    const vector<double>& widths;
00070    const vector<double>& heights;
00071 
00072    inline bool SPleftof(int i, int j) const;
00073    inline bool SPrightof(int i , int j) const;
00074    inline bool SPabove(int i, int j) const;
00075    inline bool SPbelow(int i, int j) const;
00076 
00077    static const double INFTY;
00078    static const int UNDEFINED; // = BTree::UNDEFINED;
00079 
00080 private:
00081    int _blocknum;
00082    vector<int> _XX;
00083    vector<int> _YY;
00084    vector<int> _XXinverse;
00085    vector<int> _YYinverse;
00086    vector<BTree::BTreeNode> _btree;
00087 
00088    void constructor_core();
00089    void initializeTree();
00090 
00091    void build_tree();
00092    void build_tree_add_block(int currBlock, int otree_parent);
00093 };
00094 // --------------------------------------------------------
00095 
00096 // ===============
00097 // IMPLEMENTATIONS
00098 // ===============
00099 inline const vector<BTree::BTreeNode>& PlSP2BTree::btree() const
00100 {   return _btree; }
00101 // --------------------------------------------------------
00102 inline const vector<int>& PlSP2BTree::SP_XX() const
00103 {   return _XX; }
00104 // --------------------------------------------------------
00105 inline const vector<int>& PlSP2BTree::SP_YY() const
00106 {   return _YY; }
00107 // --------------------------------------------------------
00108 inline const vector<int>& PlSP2BTree::SP_XXinverse() const
00109 {   return _XXinverse; }
00110 // --------------------------------------------------------
00111 inline const vector<int>& PlSP2BTree::SP_YYinverse() const
00112 {   return _YYinverse; }
00113 // --------------------------------------------------------
00114 inline bool PlSP2BTree::SPleftof(int i, int j) const
00115 {   return (_XXinverse[i] < _XXinverse[j] &&
00116             _YYinverse[i] < _YYinverse[j]); }
00117 // --------------------------------------------------------
00118 inline bool PlSP2BTree::SPrightof(int i, int j) const
00119 {   return SPleftof(j, i); }
00120 // --------------------------------------------------------
00121 inline bool PlSP2BTree::SPabove(int i, int j) const
00122 {   return (_XXinverse[i] < _XXinverse[j] &&
00123             _YYinverse[i] > _YYinverse[j]); }
00124 // --------------------------------------------------------
00125 inline bool PlSP2BTree::SPbelow(int i, int j) const
00126 {   return SPabove(j, i); }
00127 // --------------------------------------------------------
00128 
00129 #endif

Generated on Mon Apr 25 01:09:25 2005 for Parquete by doxygen 1.3.2