OpendTect  6.6
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, od_int64 istart, od_int64 istop, od_int64 *jstart, od_int64 *jstop)
 
template<class T , class IT >
void insertionSort (T *arr, IT *iarr, od_int64 istart, od_int64 istop)
 
template<class T , class IT >
void sortFor (T *arr, IT *iarr, od_int64 sz, od_int64 itarget)
 
template<class T , class IT >
void quickSort (T *arr, IT *iarr, od_int64 sz)
 

Macro Definition Documentation

◆ FA

#define FA   211

◆ FC

#define FC   1663

◆ FM

#define FM   7875

◆ mDoSort [1/2]

#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; \
} \
}

◆ mDoSort [2/2]

#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; \
} \
}

◆ NSMALL

#define NSMALL   7

◆ NSTACK

#define NSTACK   50

Function Documentation

◆ duplicate_sort()

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

Sorting for data with many duplicates.

◆ getPartSortSeed()

mExtern (Algo) Threads float getPartSortSeed ( )
inline

◆ insertionSort() [1/2]

template<class T , class I >
void insertionSort ( T *  arr,
istart,
istop 
)
inline

◆ insertionSort() [2/2]

template<class T , class IT >
void insertionSort ( T *  arr,
IT *  iarr,
od_int64  istart,
od_int64  istop 
)
inline

◆ partSort() [1/2]

template<class T , class I >
void partSort ( T *  arr,
istart,
istop,
I *  jstart,
I *  jstop 
)
inline

◆ partSort() [2/2]

template<class T , class IT >
void partSort ( T *  arr,
IT *  iarr,
od_int64  istart,
od_int64  istop,
od_int64 jstart,
od_int64 jstop 
)
inline

◆ quickSort() [1/2]

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

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

◆ quickSort() [2/2]

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

◆ sort_array()

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

sort quickly (algorithm taken from xv).

◆ sort_coupled()

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

sort and remember where it was before sorting.

◆ sort_idxabl()

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

sort quickly (algorithm taken from xv).

◆ sort_idxabl_coupled()

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

sort and remember where it was before sorting.

◆ sortFor() [1/2]

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.

◆ sortFor() [2/2]

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

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