Back to index

salome-med  6.5.0
Functions
MEDMEM_Connectivity.cxx File Reference
#include "MEDMEM_Connectivity.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDMEM_Group.hxx"
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_SkyLineArray.hxx"
#include "MEDMEM_ModulusArray.hxx"
#include "MEDMEM_STRING.hxx"
#include "MEDMEM_Utilities.hxx"
#include <iomanip>

Go to the source code of this file.

Functions

static void insert_vector (vector< int > &Vect, int Indice, int Element)
void mergeOrderedTabs (const int *tab1, int lgth1, const int *tab2, int lgth2, int *result, int &lgth)

Function Documentation

static void insert_vector ( vector< int > &  Vect,
int  Indice,
int  Element 
) [inline, static]

Definition at line 40 of file MEDMEM_Connectivity.cxx.

{
  if (Indice >=(int) Vect.capacity())
    Vect.reserve(Indice + 1000);

  if (Indice >=(int) Vect.size())
    Vect.resize(Indice+1);

  Vect[Indice] = Element;
}
void mergeOrderedTabs ( const int *  tab1,
int  lgth1,
const int *  tab2,
int  lgth2,
int *  result,
int &  lgth 
)

Definition at line 53 of file MEDMEM_Connectivity.cxx.

{
  int cpt[2]={0,0};
  lgth=0;
  unsigned char switcher=0;
  const int *tabS[2]={tab1,tab2};
  while(cpt[0]<lgth1 && cpt[1]<lgth2)
  {
    if(tabS[1-switcher][cpt[1-switcher]]<tabS[switcher][cpt[switcher]])
      cpt[1-switcher]++;
    else if(tabS[1-switcher][cpt[1-switcher]]>tabS[switcher][cpt[switcher]])
      switcher=1-switcher;
    else
    {
      int tmp=tabS[switcher][cpt[switcher]];
      cpt[switcher]++; cpt[1-switcher]++;
      result[lgth++]=tmp;
    }
  }
}