|
PSCF v1.5.0
|
Utilities for sorting values. More...
Classes | |
| struct | Pscf::Sort::Item< T > |
| Struct with value and index, to keep track of permutation. More... | |
Functions | |
| template<typename T> | |
| bool | Pscf::Sort::operator< (Item< T > const &a, Item< T > const &b) |
| Less than comparator for Item<T> objects. | |
| template<typename T> | |
| void | Pscf::Sort::sort (std::vector< Item< T > > &items) |
| Sort a std::vector< Item<T> > by ascending item value. | |
| template<typename T> | |
| void | Pscf::Sort::findBunches (std::vector< Item< T > > const &items, GArray< Bunch > &bunches, T epsilon) |
| Identify "bunches" of equal values within a sorted vector. | |
Utilities for sorting values.
| void Pscf::Sort::sort | ( | std::vector< Item< T > > & | items | ) |
Sort a std::vector< Item<T> > by ascending item value.
On return, array "items" is sorted with non-descending values.
| items | array of comparable items |
Definition at line 22 of file Sort.cpp.
References sort().
Referenced by sort(), Pscf::sortWaves(), Pscf::WaveList< D, CPT >::sortWaves(), and Pscf::WaveList< D, CUT >::sortWaves().
| void Pscf::Sort::findBunches | ( | std::vector< Item< T > > const & | items, |
| GArray< Bunch > & | bunches, | ||
| T | epsilon ) |
Identify "bunches" of equal values within a sorted vector.
The array "items" must be sorted on entry to this function. The "sort" function is thus called before this.
On return, each element of array "bunches" contains the begin and end indices delimiting a "bunch" of contiguous items in the sorted "items" array with equal value. Each item belongs to one bunch, and each bunch contains one or more items. Bunches are listed in order increasing beginning index, and span the entire array.
| items | sorted array of items |
| bunches | array of bunches of items with equal value |
| epsilon | tolerance |
Definition at line 29 of file Sort.cpp.
References Util::GArray< Data >::append(), Util::GArray< Data >::clear(), findBunches(), and UTIL_CHECK.
Referenced by findBunches(), Pscf::sortWaves(), Pscf::WaveList< D, CPT >::sortWaves(), and Pscf::WaveList< D, CUT >::sortWaves().