Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

template<>
void Impala::Core::Column::ApplyOrder ( Vector::VectorSet< Array::Array2dScalarReal64 > *  data,
ColumnTem< int > *  orderCol 
)

specialisation for VectorSet (of doubles)

Definition at line 38 of file ApplyOrder.h.

References Impala::Core::Vector::VectorSet< ArrayT >::Get(), Impala::Core::Column::ColumnTem< ElemT >::GetData(), Impala::Core::Vector::VectorSet< ArrayT >::Set(), and Impala::Core::Column::ColumnTem< ElemT >::Size().

00039 {
00040     typedef Vector::VectorTem<Array::Array2dScalarReal64::StorType> Type;
00041 
00042     int length = orderCol->Size();
00043     // order is copied to keep callers code simpler
00044     int* order = new int[length];
00045     memcpy(order, orderCol->GetData(), length*sizeof(int));
00046     
00047     int i;
00048     for(i=0 ; i<length ; ++i)
00049     {
00050         if(order[i] != i)
00051         {
00052             // keep swapping until an element is put at the correct position (this will happen!)
00053             int indexFrom = i;
00054             int indexTo = order[i];
00055             order[i] = i;
00056             Type value = data->Get(indexFrom);
00057             while(indexFrom != indexTo)
00058             {
00059                 Type temp = data->Get(indexTo);
00060                 data->Set(indexTo, value);
00061                 value = temp;
00062                 indexFrom = indexTo;
00063                 indexTo = order[indexFrom];
00064                 order[indexFrom] = indexFrom;
00065             }
00066         }
00067     }
00068 }

Here is the call graph for this function:


Generated on Fri Mar 19 11:06:08 2010 for ImpalaSrc by  doxygen 1.5.1