Ejemplo n.º 1
0
void CLVColumnLabelView::UpdateDragGroups()
{
	//Make a copy of the DragGroups list.  Use it to store the CLVDragGroup's for recycling
	BList TempList(fDragGroups);
	fDragGroups.MakeEmpty();
	int32 NumberOfColumns = fDisplayList->CountItems();
	bool ContinueGroup = false;
	CLVDragGroup* CurrentGroup = NULL;
	for(int32 Counter = 0; Counter < NumberOfColumns; Counter++)
	{
		CLVColumn* CurrentColumn = (CLVColumn*)fDisplayList->ItemAt(Counter);
		if(!ContinueGroup)
		{
			//Recycle or obtain a new CLVDragGroup
			CurrentGroup = (CLVDragGroup*)TempList.RemoveItem(int32(0));
			if(CurrentGroup == NULL)
				CurrentGroup = new CLVDragGroup;
			//Add the CLVDragGroup to the DragGroups list
			fDragGroups.AddItem(CurrentGroup);
			//Set up the new DragGroup
			CurrentGroup->GroupStartDispListIndex = Counter;
			CurrentGroup->GroupStopDispListIndex = Counter;
			CurrentGroup->Flags = 0;
			if(CurrentColumn->IsShown())
			{
				CurrentGroup->GroupBegin = CurrentColumn->fColumnBegin;
				CurrentGroup->GroupEnd = CurrentColumn->fColumnEnd;
				CurrentGroup->LastColumnShown = CurrentColumn;
				CurrentGroup->Shown = true;
				if(CurrentColumn->fFlags & CLV_LOCK_AT_BEGINNING)
					CurrentGroup->AllLockBeginning = true;
				else
					CurrentGroup->AllLockBeginning = false;
				if(CurrentColumn->fFlags & CLV_LOCK_AT_END)
					CurrentGroup->AllLockEnd = true;
				else
					CurrentGroup->AllLockEnd = false;
			}
			else
			{
				CurrentGroup->GroupBegin = -1.0;
				CurrentGroup->GroupEnd = -1.0;
				CurrentGroup->LastColumnShown = NULL;
				CurrentGroup->Shown = false;
				if(CurrentColumn->fFlags & CLV_LOCK_AT_BEGINNING)
					CurrentGroup->AllLockBeginning = true;
				else
					CurrentGroup->AllLockBeginning = false;
				if(CurrentColumn->fFlags & CLV_LOCK_AT_END)
					CurrentGroup->AllLockEnd = true;
				else
					CurrentGroup->AllLockEnd = false;
			}
		}
		else
		{
			//Add this column to the current DragGroup
			CurrentGroup->GroupStopDispListIndex = Counter;
			if(CurrentColumn->IsShown())
			{
				if(CurrentGroup->GroupBegin == -1.0)
					CurrentGroup->GroupBegin = CurrentColumn->fColumnBegin;
				CurrentGroup->GroupEnd = CurrentColumn->fColumnEnd;
				CurrentGroup->LastColumnShown = CurrentColumn;
				CurrentGroup->Shown = true;
			}
			if(!(CurrentColumn->fFlags & CLV_LOCK_AT_BEGINNING))
				CurrentGroup->AllLockBeginning = false;
			if(!(CurrentColumn->fFlags & CLV_LOCK_AT_END))
				CurrentGroup->AllLockEnd = false;
		}
		CurrentGroup->Flags |= CurrentColumn->fFlags & (CLV_NOT_MOVABLE|CLV_LOCK_AT_BEGINNING|
			CLV_LOCK_AT_END);
		//See if I should add more columns to this group
		if(CurrentColumn->fFlags & CLV_LOCK_WITH_RIGHT)
			ContinueGroup = true;
		else
			ContinueGroup = false;
	}
	//If any unused groups remain in TempList, delete them
	while((CurrentGroup = (CLVDragGroup*)TempList.RemoveItem(int32(0))) != NULL)
		delete CurrentGroup;
}
Ejemplo n.º 2
0
void depchk(Element* EmTemp, HashTable* El_Table, HashTable* NodeTable, 
	    int* ifg, ElemPtrList* RefinedList)

  /*---
    refined[] stores the address of ready-for-refinement element of the sub-domain
    refined_temp[] stores the address of ready-for-refinement element triggered by one element refinement
    count is counting the number of refinement of the subdomain
    j is counting the number of refinement triggered by one element refinement
    ---------------*/
{

  int i, j, k;
  Element* element;
  Element* Neigh;
  ElemPtrList TempList(384);
  int myid;

  MPI_Comm_rank(MPI_COMM_WORLD, &myid);

  TempList.add(EmTemp); 

  j = 0; k = 0;
  element = EmTemp;//-- EmTemp is the trigger of this round of refinement

  while(element&&(j<NumTriggerRef)) {//--element is temporary varible
   
    for(i=0;i<4;i++) {//-- checking the four neighbors to identify which must be refined
	
      int neigh_proc = *(element->get_neigh_proc()+i);
      
      if((neigh_proc!=-1)&&(neigh_proc!=-2)) {//-- if there is a neighbor
	   
	      
	Neigh = (Element*)(El_Table->lookup(element->get_neighbors()+i*KEYLENGTH));

	//assert(Neigh);
	if(Neigh != NULL && neigh_proc == myid) {//-- if this neighbor is in the same proc as element is
		
	  if(element->get_gen()>Neigh->get_gen()) {
	    //-- if the neighbor is bigger, then it must be refined
	    
	    if((Neigh->get_adapted_flag()==NOTRECADAPTED)||
	       (Neigh->get_adapted_flag()==NEWFATHER)
	       ) {
	      int flag = 1;
	      for(int m=0;m<TempList.get_num_elem();m++)
		if(compare_key(TempList.get_key(m), 
			       Neigh->pass_key())) {
		    flag = 0; 
		    break;
		}
	      
	      if(flag) {//-- if this neighbor has not yet been marked
		
		j++;
		TempList.add(Neigh);
	      }
	    }
	    else if(Neigh->get_adapted_flag()!=OLDFATHER){
	      *ifg=0;
	      TempList.trashlist();
	      break;
	    }
	  }
	  
	}
	else {//-- need neighbor's generation infomation
	  
	  if(element->get_gen()>*(element->get_neigh_gen()+i)) {//--stop this round of refinement
	    
	    *ifg = 0;
	    TempList.trashlist();
	    break;
	  }
	}
      }			    
      
    }
    if(!*ifg) break;
    k++;
    element = TempList.get(k);//--check next
  }
  

  //copy TempList to RefinedList
  if(*ifg) {
    
    if(j<NumTriggerRef)//-- NumTriggerRef is the maximum tolerence of related refinement
      for(int m=0;m<TempList.get_num_elem();m++) {
	int sur = 0;
	for(int mi=0;mi<RefinedList->get_num_elem();mi++)
	  if(sur=compare_key(RefinedList->get_key(mi), 
			     TempList.get_key(m)))
	    break;
	if(!sur)
	  RefinedList->add(TempList.get(m));
      }
    else {
	
      *ifg = 0;//-- refuse to do the refinement
    }
  }

  for(int m=0;m<TempList.get_num_elem()-1;m++)
    for(int mi=m+1;mi<TempList.get_num_elem();mi++)
      assert(!compare_key(TempList.get_key(m),TempList.get_key(mi)));
 
  return;
}
Ejemplo n.º 3
0
	assem::InstructionList newbody;

	TempList alive_regs;
	TempList used = findRegsInBody(body);
	std::copy(used.begin(), used.end(), std::back_inserter(alive_regs));
	std::sort(alive_regs.begin(), alive_regs.end(), LessTemp());
	alive_regs.erase(std::unique(alive_regs.begin(), alive_regs.end()), alive_regs.end());

	std::string comment;
#if 1
	BOOST_FOREACH(Temp *r, alive_regs) {
		comment += r->toString();
		comment += " ";
	}
#endif		
	assem::OPER *sink1 = _aOPER5("", "", alive_regs, TempList(), "@def " + comment);
	assem::OPER *sink2 = _aOPER5("", "", TempList(), alive_regs, "@use " + comment);
	
	assem::Instruction *funcLabel = body.front();
	assert(funcLabel->isLABEL());
	newbody.push_back(funcLabel);
	
	newbody.push_back(sink1);
	std::copy(body.begin()+1, body.end(), std::back_inserter(newbody));
	
	//insert end label
	assert(endFuncLabel);
	std::string assem = format("%s:", endFuncLabel->toString().c_str());
	assem::LABEL *end_lab = _aLABEL(assem, endFuncLabel);
	newbody.push_back(end_lab);