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

mixedpackingfromdb.cxx

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 #include "mixedpackingfromdb.h"
00036 #include "basepacking.h"
00037 #include "mixedpacking.h"
00038 #include "DB.h"
00039 
00040 #include "debugflags.h"
00041 
00042 #include <vector>
00043 using namespace std;
00044 using parquetfp::Node;
00045 using parquetfp::Nodes;
00046 using parquetfp::DB;
00047 
00048 // --------------------------------------------------------
00049 MixedBlockInfoTypeFromDB::MixedBlockInfoTypeFromDB(const DB& db)
00050    : MixedBlockInfoType(db.getNumNodes())
00051 {
00052    // extract information from DB
00053    vector<double> widths(db.getNodeWidths());
00054    vector<double> heights(db.getNodeHeights());
00055 
00056    Nodes& nodes = *(const_cast<DB&>(db).getNodes());
00057    int blocknum = db.getNumNodes();
00058    for (int i = 0; i < blocknum; i++)
00059    {
00060       Node& currBlk = nodes.getNode(i);
00061       int theta = (currBlk.getOrient());
00062       setBlockDimensions(i, widths[i], heights[i], theta);
00063       _currDimensions.in_block_names[i] = currBlk.getName();
00064 
00065 #ifdef PARQUET_DEBUG_HAYWARD_DISPLAY_MIXEDPACKINGFROMDB
00066       printf("[%d]: theta: %d, width: %lf, height %lf\n",
00067              i, theta, widths[i], heights[i]);
00068 #endif
00069       
00070       double currMaxAR = currBlk.getmaxAR();
00071       double currMinAR = currBlk.getminAR();
00072       double currArea = currBlk.getArea();
00073 
00074       _blockARinfo[i].area = currArea;
00075       set_blockARinfo_AR(i, currMinAR, currMaxAR);
00076       _blockARinfo[i].isSoft = (currMaxAR > currMinAR);
00077 
00078 #ifdef PARQUET_DEBUG_HAYWARD_DISPLAY_MIXEDPACKINGFROMDB
00079       printf("[%d]: theta: %d, maxAR: %lf, minAR: %lf, area: %lf\n",
00080              i, theta, currMaxAR, currMinAR, currArea);
00081 #endif
00082    }
00083 
00084    static const double INFTY = basepacking_h::Dimension::INFTY;   
00085    _currDimensions.set_dimensions(blocknum, 0, INFTY);
00086    _currDimensions.in_block_names[blocknum] = "LEFT";
00087    _blockARinfo[blocknum].area = 0;
00088    _blockARinfo[blocknum].minAR.resize(ORIENT_NUM, 0);
00089    _blockARinfo[blocknum].maxAR.resize(ORIENT_NUM, 0);
00090    _blockARinfo[blocknum].isSoft = false;
00091 
00092    _currDimensions.set_dimensions(blocknum+1, INFTY, 0);
00093    _currDimensions.in_block_names[blocknum+1] = "BOTTOM";
00094    _blockARinfo[blocknum+1].area = 0;
00095    _blockARinfo[blocknum+1].minAR.resize(ORIENT_NUM, INFTY);
00096    _blockARinfo[blocknum+1].maxAR.resize(ORIENT_NUM, INFTY);
00097    _blockARinfo[blocknum+1].isSoft = false;
00098 }
00099 // --------------------------------------------------------
00100 

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