00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
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