42template<
class Compare>
77 auto& addr = this->indices();
85template<
class Compare>
88 auto& vals = this->values();
89 auto& addr = this->indices();
91 addr.resize_nocopy(vals.size());
98 [&](label a, label
b) ->
bool { return comp(vals[a], vals[b]); }
Various functions to operate on Lists.
const UList< T > & values() const noexcept
label size() const noexcept
A List with indirect addressing.
IndirectList(const UList< T > &values, const labelUList &addr)
Copy construct addressing, shallow copy values reference.
const Addr & addressing() const noexcept
The list addressing.
void reverse()
Reverse the indices.
void sort()
Forward (stable) sort the list. Functionally identical to sort with std::less<T>().
const labelUList & indices() const noexcept
Return the list of sorted indices (updated every sort).
void reverseSort()
Reverse (stable) sort the list. Functionally identical to sort with std::greater<T>().
void uniqueSort()
Sort the list, only retaining unique entries.
void sort(const Compare &comp)
Sort the list using the given value comparator.
void reset()
Reset list indices to identity.
SortList(const UList< T > &values)
Shallow copy values list reference, sort immediately.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
List< label > labelList
A List of labels.
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
labelList uniqueOrder(const UList< T > &input)
Return (sorted) indices corresponding to unique list values.
UList< label > labelUList
A UList of labels.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
A list compare binary predicate for reverse sort.