Example #1
0
int rechercheElement(Element* e, const Liste *l)
{
	Cellule *c;
	unsigned int i=0;

c = l->prem;
 while ( c->info != e ) { i++; c = c->suivant;} ;

if (i > nbElements(l)) i=-1;

return i;
 }
Example #2
0
Element* copieElement(const Liste * l, unsigned int position)
{
	Cellule *c;
	unsigned int i=1;
	
 assert(position <= nbElements(l));
 
 c = l->prem;
 while (i< position ) { c = c->suivant; i++;} ;

 return c->info;

}
Example #3
0
void ReducedMesh<MeshType>::fillElementPerFlag()
{
	int counter = 0;
    UInt nbElements( M_mesh->numElements( ) );

    for (UInt iElement(0); iElement < nbElements; iElement++)
    {
        // Extracting the marker
        UInt markerID = M_mesh->element( iElement ).markerID( );

        if( M_myflag == markerID )
        {
        	M_elements[ counter ] = iElement;
        	counter = counter + 1;
        }
    }
}
Example #4
0
Cellule* enleveCellule(Liste * l, unsigned int position)
{
	Cellule *c, *tmp;
	unsigned int i=1;
	
 assert(position <= nbElements(l));
 
 c = l->prem;
 while (i< position ) { c = c->suivant; i++;} ;
 /*! \todo revoir pcq les changements effectués posent encore probleme (a revoir en entier peut etre)
  *         mais voir aussi widget::switch_card()
  */
 if (c->suivant==NULL)
 {
   l->prem=NULL;
   l->last=NULL;
   c->precedent=c->suivant = NULL;
   return c;
 }
 if (c!=NULL)
   tmp=c->suivant;
 if(position <= 1) 
 {
   tmp->precedent=NULL;
   l->prem = tmp;
 }
 else if (tmp == NULL) 
 {
   c->precedent->suivant = NULL;
   l->last = c->precedent;
 }
 else { c->precedent->suivant=tmp;
        tmp->precedent=c->precedent;}
 
 c->precedent=c->suivant = NULL;
 return c;
}