OpendTect-6_4  6.4
Classes | Macros | Functions
sorting.h File Reference
Include dependency graph for sorting.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ParallelSorter< T >
 Sorting in parallel. Code is still experimental. More...
 

Macros

#define mDoSort(extra_var, extra_action, sztype)
 
#define mDoSort(extra_var, extra_action, sztype)
 
#define NSMALL   7
 
#define FM   7875
 
#define FA   211
 
#define FC   1663
 
#define NSTACK   50
 

Functions

template<class T , class I >
void sort_array (T *arr, I sz)
 
template<class T , class IT , class I >
void sort_coupled (T *arr, IT *idxs, I sz)
 
template<class T >
void sort_idxabl (T &arr, int sz)
 
template<class T , class IT >
void sort_idxabl_coupled (T &arr, IT *idxs, int sz)
 
template<class T , class I >
bool duplicate_sort (T *arr, I sz, int maxnrvals)
 
mExtern(Algo) Threads float getPartSortSeed ()
 
template<class T , class I >
void partSort (T *arr, I istart, I istop, I *jstart, I *jstop)
 
template<class T , class I >
void insertionSort (T *arr, I istart, I istop)
 
template<class T , class I >
void sortFor (T *arr, I sz, I itarget)
 
template<class T , class I >
void quickSort (T *arr, I sz)
 
template<class T , class IT >
void partSort (T *arr, IT *iarr, int istart, int istop, int *jstart, int *jstop)
 
template<class T , class IT >
void insertionSort (T *arr, IT *iarr, int istart, int istop)
 
template<class T , class IT >
void sortFor (T *arr, IT *iarr, int sz, int itarget)
 
template<class T , class IT >
void quickSort (T *arr, IT *iarr, int sz)
 

Macro Definition Documentation

#define FA   211
#define FC   1663
#define FM   7875
#define mDoSort (   extra_var,
  extra_action,
  sztype 
)
Value:
{ \
T tmp; extra_var; \
for ( sztype d=sz/2; d>0; d=d/2 ) \
for ( sztype i=d; i<sz; i++ ) \
for ( sztype j=i-d; j>=0 && arr[j]>arr[j+d]; j-=d ) \
{ \
tmp = arr[j]; arr[j] = arr[j+d]; arr[j+d] = tmp; \
extra_action; \
} \
}
#define mDoSort (   extra_var,
  extra_action,
  sztype 
)
Value:
{ \
extra_var; \
for ( sztype d=sz/2; d>0; d=d/2 ) \
for ( sztype i=d; i<sz; i++ ) \
for ( sztype j=i-d; j>=0 && arr[j]>arr[j+d]; j-=d ) \
{ \
Swap( arr[j], arr[j+d] ); \
extra_action; \
} \
}
void Swap(T &a, T &b)
Definition: commondefs.h:36
#define NSMALL   7
#define NSTACK   50

Function Documentation

template<class T , class I >
bool duplicate_sort ( T *  arr,
sz,
int  maxnrvals 
)
inline

Sorting for data with many duplicates.

mExtern (Algo) Threads float getPartSortSeed ( )
inline
template<class T , class I >
void insertionSort ( T *  arr,
istart,
istop 
)
inline
template<class T , class IT >
void insertionSort ( T *  arr,
IT *  iarr,
int  istart,
int  istop 
)
inline
template<class T , class I >
void partSort ( T *  arr,
istart,
istop,
I *  jstart,
I *  jstop 
)
inline
template<class T , class IT >
void partSort ( T *  arr,
IT *  iarr,
int  istart,
int  istop,
int *  jstart,
int *  jstop 
)
inline
template<class T , class I >
void quickSort ( T *  arr,
sz 
)
inline

is quicker than sort_array for arrays larger than about 100 values.

template<class T , class IT >
void quickSort ( T *  arr,
IT *  iarr,
int  sz 
)
inline
template<class T , class I >
void sort_array ( T *  arr,
sz 
)
inline

sort quickly (algorithm taken from xv).

template<class T , class IT , class I >
void sort_coupled ( T *  arr,
IT *  idxs,
sz 
)
inline

sort and remember where it was before sorting.

template<class T >
void sort_idxabl ( T &  arr,
int  sz 
)
inline

sort quickly (algorithm taken from xv).

template<class T , class IT >
void sort_idxabl_coupled ( T &  arr,
IT *  idxs,
int  sz 
)
inline

sort and remember where it was before sorting.

template<class T , class I >
void sortFor ( T *  arr,
sz,
itarget 
)
inline

sorts the array until the 'itarget' element has exactly the right

value. The rest of the array must be considered unsorted after the operation, although it will generally be better sorted.

template<class T , class IT >
void sortFor ( T *  arr,
IT *  iarr,
int  sz,
int  itarget 
)

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019