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

mixedpacking.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 MIXEDPACKING_H
00036 #define MIXEDPACKING_H
00037 
00038 #include "basepacking.h"
00039 
00040 #include <vector>
00041 #include <string>
00042 using namespace std;
00043 
00044 // --------------------------------------------------------
00045 class MixedBlockInfoType
00046 {
00047 public:
00048    MixedBlockInfoType(const string& blocksfilename,
00049                       const string& format); // "blocks" or "txt"
00050    virtual ~MixedBlockInfoType() {}
00051    
00052    class BlockARInfo
00053    {
00054    public:
00055       double area;
00056       vector<double> maxAR; // maxAR/minAR for the "North" orientation
00057       vector<double> minAR;
00058       bool isSoft;
00059    };
00060    const HardBlockInfoType& currDimensions;
00061    const vector<BlockARInfo>& blockARinfo;
00062    static const int ORIENT_NUM; // = HardBlockInfoType::ORIENT_NUM;
00063 
00064    inline void setBlockDimensions(int index, double newWidth, double newHeight,
00065                                   int theta);
00066 
00067 protected:
00068    HardBlockInfoType _currDimensions;
00069    vector<BlockARInfo> _blockARinfo;
00070 
00071    void ParseBlocks(ifstream& input);
00072    inline void set_blockARinfo_AR(int index, double minAR, double maxAR);
00073 
00074    // used by descendent class "MixedBlockInfoTypeFromDB"
00075    MixedBlockInfoType(int blocknum)
00076       : currDimensions(_currDimensions),
00077         blockARinfo(_blockARinfo),
00078         _currDimensions(blocknum),
00079         _blockARinfo(blocknum+2)
00080       {}
00081 };
00082 // --------------------------------------------------------
00083 
00084 // ===============
00085 // IMPLEMENTATIONS
00086 // ===============
00087 void MixedBlockInfoType::setBlockDimensions(int index,
00088                                             double newWidth,
00089                                             double newHeight,
00090                                             int theta)
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 }
00096 // --------------------------------------------------------
00097 void MixedBlockInfoType::set_blockARinfo_AR(int index,
00098                                             double minAR,
00099                                             double maxAR)
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 }         
00111 // -------------------------------------------------------- 
00112 #endif

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