|
PSCF v1.4.0
|
Utilities for sorting real 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 real 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.
Referenced by Pscf::Prdc::Cpu::WaveList< D >::sortWaves(), Pscf::Prdc::Cuda::WaveList< D >::sortWaves(), and Pscf::Prdc::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(), and UTIL_CHECK.
Referenced by Pscf::Prdc::Cpu::WaveList< D >::sortWaves(), Pscf::Prdc::Cuda::WaveList< D >::sortWaves(), and Pscf::Prdc::sortWaves().