Exemplo n.º 1
0
  //Simple quick  sort to real
  void ParallelMergeMesh::SortTuplesByReal(TupleList &tup,
					   double eps)
  {
    bool canWrite = tup.get_writeEnabled();
    if(!canWrite) tup.enableWriteAccess();

    uint mi, ml, mul, mr;
    tup.getTupleSize(mi,ml,mul,mr);
    PerformRealSort(tup, 0, tup.get_n(), eps, mr);

    if(!canWrite) tup.disableWriteAccess();
  }
Exemplo n.º 2
0
  //Swap around tuples
  void ParallelMergeMesh::SwapTuples(TupleList &tup,
				     unsigned long a, unsigned long b)
  {
    if(a==b) return;

    uint mi, ml, mul, mr;
    tup.getTupleSize(mi, ml, mul, mr);

    //Swap mi
    unsigned long a_val = a*mi, b_val=b*mi;
    for(unsigned long i=0; i< mi;i++){
      sint t =tup.vi_rd[a_val];
      tup.vi_wr[a_val] = tup.vi_rd[b_val];
      tup.vi_wr[b_val] = t; 
      a_val++;
      b_val++;
    }
    //Swap ml
    a_val = a*ml;
    b_val = b*ml;
    for(unsigned long i=0; i< ml;i++){
      slong t =tup.vl_rd[a_val];
      tup.vl_wr[a_val] = tup.vl_rd[b_val];
      tup.vl_wr[b_val] = t;
      a_val++;
      b_val++;
    }
    //Swap mul
    a_val = a*mul;
    b_val = b*mul;
    for(unsigned long i=0; i< mul;i++){
      Ulong t =tup.vul_rd[a_val];
      tup.vul_wr[a_val] = tup.vul_rd[b_val];
      tup.vul_wr[b_val] = t; 
      a_val++;
      b_val++;
    }
    //Swap mr
    a_val = a*mr;
    b_val = b*mr;
    for(unsigned long i=0; i< mr;i++){
      realType t =tup.vr_rd[a_val];
      tup.vr_wr[a_val] = tup.vr_rd[b_val];
      tup.vr_wr[b_val] = t; 
      a_val++;
      b_val++;
    }
  }