当前位置: 首页>>代码示例>>C++>>正文


C++ Cell类代码示例

本文整理汇总了C++中Cell的典型用法代码示例。如果您正苦于以下问题:C++ Cell类的具体用法?C++ Cell怎么用?C++ Cell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

void MazeRouter::routePowerNet(oaInt4 nid) {
    //We assume that each contact that needs to connect to VDD can route directly up in Metal1.
    //We assume that each contact that needs to connect to VSS can route directly down in Metal1.
    //This appears reasonable with the given test cases, and the knowledge of P/N diffusion regions and normal CMOS logic.
    oaUInt4 dim_m, dim_n, dim_k = 0;
    __grid->getDims(&dim_m, &dim_n, &dim_k);
	
	//Metal 1 cannot be used to route vertically to VDD/VSS if it's direction is not V or B
	//Use metal 2 instead if that's the case
	//oaUInt4 layer = 0;
	//if(__rules->getMetal1Direction() == 'H') {
	//	layer = 1;
	//}

    //cout << "In routePowerNet! dim_m = " << dim_m << " dim_n = " << dim_n << endl; //Weiche
    //Let's loop through all contacts that are on the net, and generate their routes one-by-one.
    for (oaInt4 i = 0; i < __contactCells[nid].size(); i++) {
        Cell* contact = __contactCells[nid][i];
        oaUInt4 m,n,k = 0;
        contact->getPosition(&m, &n, &k);
        oaInt4 j = n;
        bool done = false;
		
		//if(layer == 1) {
		//	contact->setNeedsVia();
		//}
		
		//int nCellsInRail=11; //Weiche
		//int nCellsInRail=0; //Weiche	
			while (!done) { //Iterate through cells until we hit a rail
            //cout<<"before at m="<<m<<" j="<<j<<" k="<<k<<endl; //Weiche
			Cell* curr = __grid->at(m,j,k);
			//Cell* curr = __grid->at(m,j,layer);
			//Cell* vdd_vss = __grid->at(m,j,k);
            //cout<<"after at m="<<m<<" j="<<j<<" k="<<k; //Weiche
			CellStatus status = curr->getStatus();
			//CellStatus status2 = vdd_vss->getStatus();
            oaUInt4 net_id = curr->getNetID();
            //oaUInt4 net_id2 = vdd_vss->getNetID();
			
			//Check cell underneath to see it it's vdd or vss
			/*if(layer == 1) {
				if(status2 == CellVDDRail && nid == VDD_NET_ID) {
					done = true;
					/*__grid->at(m,j+1,layer)->setBacktrace(__grid->at(m,j,layer));
					__grid->at(m,j+2,layer)->setBacktrace(__grid->at(m,j+1,layer));
					__grid->at(m,j+3,layer)->setBacktrace(__grid->at(m,j+2,layer));
					__grid->at(m,j+4,layer)->setBacktrace(__grid->at(m,j+3,layer));
					__grid->at(m,j+5,layer)->setBacktrace(__grid->at(m,j+4,layer));
					__grid->at(m,j+5,0)->setBacktrace(__grid->at(m,j+5,layer));
					__grid->at(m,j+5,0)->setNeedsVia();
					vdd_vss->setNeedsVia();
					vdd_vss->setBacktrace(curr);
				}
				else if(status2 == CellVSSRail && nid == VSS_NET_ID) {
					done = true;
					/*__grid->at(m,j-1,layer)->setBacktrace(__grid->at(m,j,layer));
					__grid->at(m,j-2,layer)->setBacktrace(__grid->at(m,j-1,layer));
					__grid->at(m,j-3,layer)->setBacktrace(__grid->at(m,j-2,layer));
					__grid->at(m,j-4,layer)->setBacktrace(__grid->at(m,j-3,layer));
					__grid->at(m,j-5,layer)->setBacktrace(__grid->at(m,j-4,layer));
					__grid->at(m,j-5,0)->setBacktrace(__grid->at(m,j-5,layer));
					__grid->at(m,j-5,0)->setNeedsVia();
					vdd_vss->setNeedsVia();
					vdd_vss->setBacktrace(curr);
				}
			}*/

            switch (status) {
                case CellVDDRail:
				//cout<<"  case CellVDDRail"<<endl; //Weiche
                    if (nid == VDD_NET_ID)
					{
						/*if(nCellsInRail>0) //Weiche
						{
							curr->setStatus(CellFilled);
			                curr->setNetType(contact->getNetType());
				            curr->setNetID(nid);
							nCellsInRail--;
							if(nCellsInRail==5)
								curr->setNeedsVia();
						}*/
						/*if(nCellsInRail==0){ //Weiche
							curr->setStatus(CellFilled);
			                curr->setNetType(contact->getNetType());
				            curr->setNetID(nid);
							curr->setNeedsVia();
							done = true;
						}*/
                        done = true;
					}
                    else {
                        cout << "Somehow hit the VDD rail while routing VSS!" << endl;
						__foundRoute = false;
                        //__grid->print();
                        exit(1);
                    }
                    break;
                case CellVSSRail:
                    //cout<<"  case CellVSSRail"<<endl; //Weiche
//.........这里部分代码省略.........
开发者ID:anchigel,项目名称:SR,代码行数:101,代码来源:MazeRouter.cpp

示例2: GetEnergyCell

void Margolus::PareEnergyFull(Cell& cellIn, Cell& cellOut, double& energy) {
    // modifier & active in one cell
    for (pSub & subA : cellIn.GetSubs()) {
        if (subA->GetType() == ACTIVE) {
            for (pSub & subM : cellIn.GetSubs()) {
                if (subM->GetType() == MODIFIER) {
                    energy += GetEnergyCell(subA->GetName(), subM->GetName());
                }
            }
        }
    }
    // other
    if (cellOut.HaveSolid()) {
        if (cellIn.HaveModifier()) {
            for (pSub & subIn : cellIn.GetSubs()) {
                if (subIn->GetType() != ACTIVE) {
                    energy += GetEnergy(subIn->GetName(), cellOut.GetSub(0)->GetName());
                }
            }
        } else {
            for (pSub & subIn : cellIn.GetSubs()) {
                energy += GetEnergy(subIn->GetName(), cellOut.GetSub(0)->GetName());
            }
        }
    } else {
        if (cellIn.HaveSolid()) {
            if (cellOut.HaveModifier()) {
                for (pSub & subOut : cellOut.GetSubs()) {
                    if (subOut->GetType() != ACTIVE) {
                        energy += GetEnergy(subOut->GetName(), cellIn.GetSub(0)->GetName());
                    }
                }
            } else {
                for (pSub & subOut : cellOut.GetSubs()) {
                    energy += GetEnergy(subOut->GetName(), cellIn.GetSub(0)->GetName());
                }
            }
        } else {
            for (pSub & subIn : cellIn.GetSubs()) {
                for (pSub & subOut : cellOut.GetSubs()) {
                    energy += GetEnergy(subIn->GetName(), subOut->GetName());
                }
            }
        }
    }
}
开发者ID:igmit,项目名称:MargolusCA-src,代码行数:46,代码来源:margolus_base.cpp

示例3: range

//The core function which summarizes the data and forms the pivot table.
void PivotMain::Summarize()
{
  
    
    Map* myMap = d->selection->lastSheet()->map();
    const QRect range3=d->selection->lastRange();
    Sheet* sheet=myMap->createSheet("Filtered Sheet");
    
    sheet=filter();
    if(sheet==d->selection->lastSheet())
    {
      d->filtersize=range3.bottom();
    }
    const QRect range(1,1,d->selection->lastRange().right(),d->filtersize);
    
    QColor color,color2("lightGray");
    color.setBlue(50);
    QPen pen(color);
    

    Style st,st2,st3,str,stl,stb,stt;
    st.setFontUnderline(true);
    st3.setBackgroundColor("lightGray");
    st.setRightBorderPen(pen);
    st.setLeftBorderPen(pen);
    st.setTopBorderPen(pen);
    st.setBottomBorderPen(pen);
    str.setRightBorderPen(pen);
    stl.setLeftBorderPen(pen);
    stt.setTopBorderPen(pen);
    stb.setBottomBorderPen(pen);
    
    
    static int z=1;
    
    Sheet* mySheet=myMap->createSheet("Pivot Sheet"+QString::number(z++));
    
    int r = range.right();
    int row=range.top();
    int bottom=range.bottom();
    Cell cell;
    
    ValueConverter *c;
    
    Value res(0);
    ValueCalc *calc= new ValueCalc(c);
    
    QVector<Value> vect;    
    for (int i = 1; i <= r; ++i) {
	cell= Cell(sheet,i,row);
	vect.append(Value(cell.value()));
    }

  d->func=d->mainWidget.selectOption->currentText();//check for the function to be performed
  
  //For Creating QLists for Rows,Columns,Values and PageField
  int counter;
  QListWidgetItem *item1;
  QList<QListWidgetItem *> rowList,columnList,valueList,pageList;
  
  counter= d->mainWidget.Rows->count();
  for(int i=0;i<counter;i++)
  {
	
        item1=d->mainWidget.Rows->item(i);
        rowList.append(item1);
    
  }
  counter= d->mainWidget.Columns->count();
  for(int i=0;i<counter;i++)
  {
	
        item1=d->mainWidget.Columns->item(i);
        columnList.append(item1); 
  }
  /*counter= d->mainWidget.PageFields->count();
  for(int i=0;i<counter;i++)
  {
        item1=d->mainWidget.PageFields->item(i);
        pageList.append(item1);
  }*/
  counter= d->mainWidget.Values->count();
  for(int i=0;i<counter;i++)
  {
        item1=d->mainWidget.Values->item(i);
        valueList.append(item1); 
  }
  
  //Summarization using vectors
  int rowpos=-1,colpos=-1,valpos=-1;
  QVector<Value> rowVector;
  QVector<QVector<Value> > rowVectorArr(rowList.size());
  QVector<QVector<Value> > columnVectorArr(columnList.size());
  QVector<Value> columnVector,valueVector;
  QVector<int> rowposVect,colposVect,valposVect;
  
  for(int i=0;i<rowList.size();i++)
  {
      rowpos=vect.indexOf(Value(rowList.at(i)->text()));
//.........这里部分代码省略.........
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:101,代码来源:pivotmain.cpp

示例4: Cell

double GlobalPlanner::getRisk(Cell & cell) {
  double risk = explorePenalty;
  if (occProb.find(cell) != occProb.end()) {
    risk = octomap::probability(occProb[cell]);
  }
  Cell front = Cell(cell.x()+1, cell.y(), cell.z());
  Cell back = Cell(cell.x()-1, cell.y(), cell.z());
  Cell right = Cell(cell.x(), cell.y()+1, cell.z());
  Cell left = Cell(cell.x(), cell.y()-1, cell.z());
  Cell up = Cell(cell.x(), cell.y(), cell.z()+1);
  Cell down = Cell(cell.x(), cell.y(), cell.z()-1);
  if (occProb.find(front) != occProb.end()) {
    risk += octomap::probability(occProb[front]);
  }
  if (occProb.find(back) != occProb.end()) {
    risk += octomap::probability(occProb[back]);
  }
  if (occProb.find(right) != occProb.end()) {
    risk += octomap::probability(occProb[right]);
  }
  if (occProb.find(left) != occProb.end()) {
    risk += octomap::probability(occProb[left]);
  }
  if (occProb.find(up) != occProb.end()) {
    risk += octomap::probability(occProb[up]);
  }
  if (occProb.find(down) != occProb.end()) {
    risk += octomap::probability(occProb[down]);
  }
  double prior = heightPrior[floor(cell.z())];
  // ROS_INFO("risk: %f \t prior: %f \n", risk, prior);
  return risk * prior;
}
开发者ID:vilhjalmur89,项目名称:rotors_simulator,代码行数:33,代码来源:global_planner.cpp

示例5: distance2D

double distance2D(const Cell & a, const Cell & b) {
  return sqrt(squared(a.x() - b.x()) + squared(a.y() - b.y()));
}
开发者ID:vilhjalmur89,项目名称:rotors_simulator,代码行数:3,代码来源:global_planner.cpp

示例6: while

bool MainWindow::updateConnections()
{
  bool newconnection[BoardSize * BoardSize];
  for(int i = 0; i < BoardSize * BoardSize; i++)
    newconnection[i] = false;

  CellList list;
  if(!root->isRotated())
  {
    newconnection[root->index()] = true;
    list.append(root);
  }
  while(!list.isEmpty())
  {
    Cell* cell = list.first();
    Cell* ucell = uCell(cell);
    Cell* rcell = rCell(cell);
    Cell* dcell = dCell(cell);
    Cell* lcell = lCell(cell);

    if((cell->dirs() & Cell::U) && ucell && (ucell->dirs() & Cell::D) && !newconnection[ucell->index()] && !ucell->isRotated())
    {
      newconnection[ucell->index()] = true;
      list.append(ucell);
    }
    if((cell->dirs() & Cell::R) && rcell && (rcell->dirs() & Cell::L) && !newconnection[rcell->index()] && !rcell->isRotated())
    {
      newconnection[rcell->index()] = true;
      list.append(rcell);
    }
    if((cell->dirs() & Cell::D) && dcell && (dcell->dirs() & Cell::U) && !newconnection[dcell->index()] && !dcell->isRotated())
    {
      newconnection[dcell->index()] = true;
      list.append(dcell);
    }
    if((cell->dirs() & Cell::L) && lcell && (lcell->dirs() & Cell::R) && !newconnection[lcell->index()] && !lcell->isRotated())
    {
      newconnection[lcell->index()] = true;
      list.append(lcell);
    }
    list.removeFirst();
  }

  bool isnewconnection = false;
  for(int i = 0; i < BoardSize * BoardSize; i++)
  {
    if(!board[i]->isConnected() && newconnection[i])
      isnewconnection = true;
    board[i]->setConnected(newconnection[i]);
  }

  return isnewconnection;
}
开发者ID:radekp,项目名称:qneoroid,代码行数:53,代码来源:mainwindow.cpp

示例7: orientation

//-----------------------------------------------------------------------------
std::size_t QuadrilateralCell::orientation(const Cell& cell) const
{
  const Point up(0.0, 0.0, 1.0);
  return cell.orientation(up);
}
开发者ID:vincentqb,项目名称:dolfin,代码行数:6,代码来源:QuadrilateralCell.cpp

示例8: UNUSED

Cell* Parser::Parse_Define(Cell* cell, bool topLevel)
{
    UNUSED(topLevel);
    THROW_ERROR_IF(cell->Length() < 3, cell, "'define' does not take " << cell->Length() << " arguments");

    // Example: (define (add a b) (+ a b))
    // (define add (lambda (a b) (+ a b)))
    Cell* pParams = cell->Cdr()->Car();
    Cell* pBody = cell->Cdr()->Cdr();
               
    // (define (f args..) body)
    // Parse the arguments, if necessary, and call back into the Parse
    if (pParams->GetType() & Cell::PairType)
    {
        // f
        Cell* f = pParams->Car();

        // (Args)
        Cell* args = pParams->Cdr();

        // (define)
        Cell* pDefine = Cell::Pair(Cell::Symbol(Sym::Symbol("_define")), nullptr);
        
        // (lambda)
        Cell* pLambda = Cell::Pair(Cell::Symbol(Sym::Symbol("_lambda")), nullptr);
        
        // (lambda (args)
        pLambda = pLambda->Append(args);

        // (lambda (args) (body)
        // Body is a list of expressions. ((+ a a) ...)
        while (pBody && pBody->Car())
        {
            pLambda = pLambda->Append(pBody->Car());
            pBody = pBody->Cdr();
        }
        
        // (define f)
        pDefine = pDefine->Append(f);

        // (define f (lamda ...))
        pDefine = pDefine->Append(pLambda);

        return Parse_Cell(pDefine);
    }
    // A parsed define, ready to store
    else
    {
        THROW_ERROR_IF(cell->Length()!= 3, cell, "'define' does not take " << cell->Length() << " arguments");
        THROW_ERROR_IF(!(pParams->GetType() & Cell::SymbolType), cell, "Expected Symbol in define");
        
        pBody = Parse_Cell(pBody->Car());

        // (define)
        Cell* pDefine = Cell::Pair(Cell::Symbol(Sym::Symbol("_define")), nullptr);

        // (define (params)
        pDefine = pDefine->Append(pParams);

        // (define (params) (pBody))
        pDefine = pDefine->Append(pBody);

        return pDefine;
    }
}
开发者ID:cmaughan,项目名称:JorvikScheme,代码行数:65,代码来源:Parser.cpp

示例9: doorCell

void Random::doorCell(Cell &cell) {
	cell.dungeonFloorA();
}
开发者ID:CaptainGobelin,项目名称:BGS-dev,代码行数:3,代码来源:mapPattern.cpp

示例10: routePowerNet

bool MazeRouter::route() {
	 __foundRoute = true; //assume true until we find an issue

    cout << "Special routing power nets..." << endl;
    //cout << "Special routing power nets: " << VDD_NET_ID << " for VDD and " << VSS_NET_ID << " for VSS." << endl; //Weiche
    routePowerNet(VDD_NET_ID);
    routePowerNet(VSS_NET_ID);
    
    //Single-contact IO nets: special case. No routing, only pin needed, but it gets high priority.
    cout << "Generating pins for single-contact IO nets..." << endl;
    __grid->reset();
    for (oaInt4 net = 2; net < __contactCells.size(); net++) {
        if (__contactCells[net][0]->getNetType() == "IO" && __contactCells[net].size() == 1) { 
            oaUInt4 m,n,k = 0;
            Cell* c = __contactCells[net][0];
            c->getPosition(&m,&n,&k);
            
            //We want to do this at the contact M1, since M2 pins are not required.
            //Propagate pin name (used later in creating text label))
            __grid->at(m,n,k)->setPin(true);
            __grid->at(m,n,k)->setPinName(c->getPinName());
        }
    }
    
    //Multi-contact IO nets. Need routing. Choose pin location after routing is done
    cout << "Maze routing multi-contact IO nets..." << endl;
    for (oaInt4 net = 2; net < __contactCells.size(); net++) {
        if (__contactCells[net][0]->getNetType() == "IO" && __contactCells[net].size() > 1) {
            //Clean reset for each net
            __grid->reset();
            generateKeepouts(net);
            
            //Basic approach: route from contact to contact in order of appearance.
            for (oaInt4 contactIndex = 0; contactIndex < __contactCells[net].size()-1; contactIndex++) {
                __grid->softReset(); //Preserve keepouts during soft reset so we don't waste time recomputing them
                if (contactIndex == 0) //set pin during first segment
                    mazeRoute(net, contactIndex+1, contactIndex, true);
                else   
                    mazeRoute(net, contactIndex+1, contactIndex, false);
            }

            /*
            //Yasmine's "better" approach: route between closest pairs of contacts first. You are welcome to try this. Disabled by default.
            //Get closest pairs
            vector<ClosestPairIndices> closestPairs;
            closestPairs=ClosestPairIndices::getClosestPairs(__contactCells[net]);
            int nPairs=closestPairs.size();
            for (oaInt4 pairIndex = 0; pairIndex <nPairs; pairIndex++) {
                __grid->softReset(); //Preserve keepouts during soft reset so we don't waste time recomputing them
                if (pairIndex == 0) //set pin during first segment
                    mazeRoute(net, closestPairs[pairIndex].getIndex1(),
                                   closestPairs[pairIndex].getIndex2(), true);
                else   
                   mazeRoute(net, closestPairs[pairIndex].getIndex1(),
                                   closestPairs[pairIndex].getIndex2(), false);
            }
            */
        }
    }
    
    //Multi-contact S nets, no pins needed.
    cout << "Maze routing S nets..." << endl;
    for (oaInt4 net = 2; net < __contactCells.size(); net++) { //Mark: perhaps change this to order by HPWL bounding box of nets? Smallest first?
          //Reset the grid weights, distances, sources, and sinks. Clear any keepout cells that were leftover from a previous maze route.    
        if (__contactCells[net][0]->getNetType() == "S") {
            //Clean reset for each net
            __grid->reset();
            generateKeepouts(net); //Generate keepouts for all nets OTHER than this one!
           
            for (oaInt4 contactIndex = 0; contactIndex < __contactCells[net].size()-1; contactIndex++) {
                __grid->softReset();
                mazeRoute(net, contactIndex+1, contactIndex, false); //Assume we always have >=2 pins for this net type, otherwise it wouldn't even make sense.
            }

            /*
            //Yasmine's "better" approach: route between closest pairs of contacts first. You are welcome to try this. Disabled by default.
            vector<ClosestPairIndices> closestPairs;
            closestPairs=ClosestPairIndices::getClosestPairs(__contactCells[net]);
            int nPairs=closestPairs.size();
            for (oaInt4 pairIndex = 0; pairIndex <nPairs; pairIndex++) {
                __grid->softReset(); //Preserve keepouts during soft reset so we don't waste time recomputing them
                mazeRoute(net, closestPairs[pairIndex].getIndex1(),
                                   closestPairs[pairIndex].getIndex2(), false);
            }
            */
        }
    }
   
    __grid->reset();
    //__grid->print();
	
	 return __foundRoute;
}
开发者ID:anchigel,项目名称:SR,代码行数:93,代码来源:MazeRouter.cpp

示例11: return

	bool Cell::operator==(const Cell& other) const    
	{
	    return ((coordinateX == other.getX()) && (coordinateY == other.getY()));
	}
开发者ID:murataltuntas,项目名称:Object_Oriented_Programming,代码行数:4,代码来源:HW06_111044043_Cell.cpp

示例12: if

void MazeRouter::generateKeepout(Cell* c) {
    oaUInt4 mtmp,ntmp,ktmp = 0;
    oaInt4 m,n,k = 0;
    oaUInt4 dim_m, dim_n, dim_k = 0;
    c->getPosition(&mtmp,&ntmp,&ktmp);
    m = mtmp;
    n = ntmp;
    k = ktmp;
    __grid->getDims(&dim_m, &dim_n, &dim_k);
    
    oaInt4 leftBound = 0;
    oaInt4 rightBound = 0;
    oaInt4 topBound = 0;
    oaInt4 bottomBound = 0;
    
    Cell* tmp = NULL;
    CellStatus tmpStatus;
    CellStatus cStatus = c->getStatus();
    
    
       //SET LATERAL AND LONGITUDINAL BOUNDS DEPENDING ON LAYER AND LINE END STATUS
    if (k == 0) { //metal1
		if(__rules->getMetal1Direction() == 'V') { //vertical only
			
			leftBound = m-__keepoutRadius_lateral;
			if (leftBound < 0)
				leftBound = 0;
			
			rightBound = m+__keepoutRadius_lateral;
			if (rightBound > dim_m-1)
				rightBound = dim_m-1;
			
			//check line end top condition
			if (n+1 < dim_n) {
				tmp = __grid->at(m,n+1,k); //get cell above
				tmpStatus = tmp->getStatus();
				if (tmpStatus == CellFilled || tmpStatus == CellContact) //not line end
					topBound = n;
				else { //line end
					if (cStatus == CellVDDRail || cStatus == CellVSSRail) //cell of interest is power rail
						 topBound = n+__keepoutRadius_powerRail;
					else //cell of interest is regular net
						 topBound = n+__keepoutRadius_longitudinal;
				}
				if (topBound > dim_n-1)
					topBound = dim_n-1;
			}
			
			//check line end bottom condition
			if (n-1 >= 0) {
				tmp = __grid->at(m,n-1,k); //get cell below
				tmpStatus = tmp->getStatus();
				if (tmpStatus == CellFilled || tmpStatus == CellContact) //not line end
					bottomBound = n;
				else { //line end
					if (cStatus == CellVDDRail || cStatus == CellVSSRail) //cell of interest is power rail
							bottomBound = n-__keepoutRadius_powerRail;
					else //cell of interest is regular net
							bottomBound = n-__keepoutRadius_longitudinal;
				}
				if (bottomBound < 0)
					bottomBound = 0;
			}
		}
		else if(__rules->getMetal1Direction() == 'H') { //horizontal only
			bottomBound = n-__keepoutRadius_lateral;
			if (bottomBound < 0)
				bottomBound = 0;
			
			topBound = n+__keepoutRadius_lateral;
			if (topBound > dim_n-1)
				topBound = dim_n-1;
			
			//check line end right condition
			if (m+1 < dim_m) {
				tmp = __grid->at(m+1,n,k); //get cell to right
				tmpStatus = tmp->getStatus();
				if (tmpStatus == CellFilled || tmpStatus == CellContact) //not line end
					rightBound = m;
				else //line end
					rightBound = m+__keepoutRadius_longitudinal;
				
				if (rightBound > dim_m-1)
					rightBound = dim_m-1;
			}
			
			//check line end left condition
			if (m-1 >= 0) {
				tmp = __grid->at(m-1,n,k); //get cell to left
				tmpStatus = tmp->getStatus();
				if (tmpStatus == CellFilled || tmpStatus == CellContact) //not line end
					leftBound = m;
				else //line end
					leftBound = m-__keepoutRadius_longitudinal;
				
				if (leftBound < 0)
					leftBound = 0;
			}
		}
		else { //bidirectional 
//.........这里部分代码省略.........
开发者ID:anchigel,项目名称:SR,代码行数:101,代码来源:MazeRouter.cpp

示例13: contact

void MazeRouter::doBacktrace(Cell* source, Cell* sink, bool setPin) {
    Cell* curr = sink;
    Cell* tmp = NULL;
    oaUInt4 currm,currn,currk = 0;
    oaUInt4 tmpm,tmpn,tmpk = 0;
    
    //Handle pin
    if (setPin) {
        curr->getPosition(&currm,&currn,&currk);
        tmp = curr->getBacktrace();
        tmp->getPosition(&tmpm,&tmpn,&tmpk);
        
        if (currm == tmpm && currn == tmpn && currk == (tmpk+1)%2) { //backtrace is above the contact, set pin on M2 (the backtraced cell).
            tmp->setPin(true);
            tmp->setPinName(source->getPinName());
        }
        else { //set pin on the contact (sink)
            curr->setPin(true);
        }
    }
    
    // backtrace sink to source
    curr = sink;
    tmp = curr;
    while (tmp != source) {       
        if (curr->getStatus() == CellFree) {
            curr->setStatus(CellFilled);
            curr->setNetID(source->getNetID());
            curr->setNetType(source->getNetType());
        }
        
        //check if we need a via.
		  oaInt4 currm_dbu, currn_dbu = 0;
		  oaInt4 tmpm_dbu, tmpn_dbu = 0;

        curr->getPosition(&currm, &currn, &currk);
		  curr->getAbsolutePosition(&currm_dbu,&currn_dbu);
        tmp->getPosition(&tmpm,&tmpn,&tmpk);
		  tmp->getAbsolutePosition(&tmpm_dbu,&tmpn_dbu);

        if (currk == 0 && tmpk == 1) { //change from layer 1 to layer 0
            //set via on curr, which is M1.
            curr->setNeedsVia();
            cout << "Via needed at cell (" << currm << "," << currn << "," << currk << ") ---> (" << currm_dbu << "," << currn_dbu << ")" << endl;
        }
        else if (currk == 1 && tmpk == 0) { //change from layer 0 to layer 1
            //set via on tmp, which is M1.
            tmp->setNeedsVia();
            cout << "Via needed at cell (" << tmpm << "," << tmpn << "," << tmpk << ") ---> (" << tmpm_dbu << "," << tmpn_dbu << ")" << endl;
        }
		else if (currk == 1 && tmpk == 2) { //change from layer 2 to layer 1
            //set via on curr, which is M2.
            curr->setNeedsVia();
            cout << "Via needed at cell (" << currm << "," << currn << "," << currk << ") ---> (" << currm_dbu << "," << currn_dbu << ")" << endl;
        }
		else if (currk == 2 && tmpk == 1) { //change from layer 1 to layer 2
            //set via on tmp, which is M2.
            tmp->setNeedsVia();
            cout << "Via needed at cell (" << tmpm << "," << tmpn << "," << tmpk << ") ---> (" << tmpm_dbu << "," << tmpn_dbu << ")" << endl;
        }
		else if (currk == 0 && tmpk == 2) { //change from layer 2 to layer 0
            //set via on curr, which is M1.
            curr->setNeedsVia();
			Cell * temp = __grid->at(currm, currn, (currk+1));
			CellStatus tempStatus = temp->getStatus();
			//if(tempStatus == CellFree)
				temp->setStatus(CellFilled);
			temp->setNeedsVia();
            cout << "Via needed at cell (" << currm << "," << currn << "," << currk << ") ---> (" << currm_dbu << "," << currn_dbu << ")" << endl;
            cout << "Via needed at cell (" << currm << "," << currn << "," << currk+1 << ") ---> (" << currm_dbu << "," << currn_dbu << ")" << endl;
			cout << "temp->needsVia(): " << temp->needsVia() << endl;
        }
		else if (currk == 2 && tmpk == 0) { //change from layer 0 to layer 2
            //set via on tmp, which is M1.
            tmp->setNeedsVia();
			Cell * temp = __grid->at(currm, currn, (currk-1));
			CellStatus tempStatus = temp->getStatus();
			//if(tempStatus == CellFree)
				temp->setStatus(CellFilled);
			temp->setNeedsVia();
            cout << "Via needed at cell (" << tmpm << "," << tmpn << "," << tmpk << ") ---> (" << tmpm_dbu << "," << tmpn_dbu << ")" << endl;
			cout << "Via needed at cell (" << currm << "," << currn << "," << currk-1 << ") ---> (" << currm_dbu << "," << currn_dbu << ")" << endl;
			cout << "temp->needsVia(): " << temp->needsVia() << endl;
        }
        
        tmp = curr;
        curr = curr->getBacktrace();
    }
}
开发者ID:anchigel,项目名称:SR,代码行数:89,代码来源:MazeRouter.cpp

示例14: i18n

bool MergeCommand::preProcessing()
{
    if (isColumnOrRowSelected()) {
        KMessageBox::information(0, i18n("Merging of columns or rows is not supported."));
        return false;
    }

    if (m_firstrun) {
        setText(name());

        // reduce the region to the region occupied by merged cells
        Region mergedCells;
        ConstIterator endOfList = constEnd();
        for (ConstIterator it = constBegin(); it != endOfList; ++it) {
            Element* element = *it;
            QRect range = element->rect();
            int right = range.right();
            int bottom = range.bottom();
            for (int row = range.top(); row <= bottom; ++row) {
                for (int col = range.left(); col <= right; ++col) {
                    Cell cell = Cell(m_sheet, col, row);
                    if (cell.doesMergeCells()) {
                        QRect rect(col, row, cell.mergedXCells() + 1, cell.mergedYCells() + 1);
                        mergedCells.add(rect);
                    }
                }
            }
        }

        if (m_merge) { // MergeCommand
            // we're in the manipulator's first execution
            // initialize the undo manipulator
            m_unmerger = new MergeCommand();
            if (!m_mergeHorizontal && !m_mergeVertical) {
                m_unmerger->setReverse(true);
            }
            m_unmerger->setSheet(m_sheet);
            m_unmerger->setRegisterUndo(false);
            m_unmerger->add(mergedCells);
        } else { // DissociateManipulator
            clear();
            add(mergedCells);
        }
    }

    if (m_merge) { // MergeCommand
        if (m_reverse) { // dissociate
        } else { // merge
            // Dissociate cells before merging the whole region.
            // For horizontal/vertical merging the cells stay
            // as they are. E.g. the region contains a merged cell
            // occupying two rows. Then the horizontal merge should
            // keep the height of two rows and extend the merging to the
            // region's width. In this case the unmerging is done while
            // processing each region element.
            if (!m_mergeHorizontal && !m_mergeVertical) {
                m_unmerger->redo();
            }
        }
    }
    // Clear the associated selection, if any. The merge/dissociate process will restore
    // selections. This ensures that the selection isn't broken after merging.
    if (m_selection) m_selection->Region::clear();

    return AbstractRegionCommand::preProcessing();
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:66,代码来源:MergeCommand.cpp

示例15: wallItemCell

void Random::wallItemCell(Cell &cell) {
	cell.dungeonWallA();
}
开发者ID:CaptainGobelin,项目名称:BGS-dev,代码行数:3,代码来源:mapPattern.cpp


注:本文中的Cell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。