A list that is sorted upon construction or when explicitly requested with the sort() method. More...
Public Member Functions | |
constexpr | SortableList () noexcept |
Default construct. More... | |
SortableList (const label size) | |
Construct given size, sort later. More... | |
SortableList (const label size, const Foam::zero) | |
Construct zero-initialized with given size, sort later. More... | |
SortableList (const label size, const T &val) | |
Construct given size and initial value, sorting later. More... | |
SortableList (const SortableList< T > &lst) | |
Copy construct. More... | |
SortableList (SortableList< T > &&lst) | |
Move construct. More... | |
SortableList (const UList< T > &values) | |
Copy construct from UList, sorting immediately. More... | |
SortableList (List< T > &&values) | |
Move construct from List, sorting immediately. More... | |
SortableList (std::initializer_list< T > values) | |
Construct from an initializer list, sorting immediately. More... | |
const labelList & | indices () const |
Return the list of sorted indices. Updated every sort. More... | |
labelList & | indices () |
Return non-const access to the sorted indices. Updated every sort. More... | |
void | clear () |
Clear the list and the indices. More... | |
List< T > & | shrink () |
Clear the indices and return a reference to the underlying List. More... | |
void | sort () |
Forward (stable) sort the list (if changed after construction). More... | |
void | reverseSort () |
Reverse (stable) sort the list. More... | |
void | partialSort (label n, label start=0) |
Forward partial sort the list until the middle point. More... | |
void | partialReverseSort (label n, label start=0) |
Reverse partial sort the list until the middle point. More... | |
void | swap (SortableList< T > &other) |
Swap content with another SortableList in constant time. More... | |
void | operator= (const T &val) |
Assignment of all entries to the given value, removing indices. More... | |
void | operator= (const UList< T > &lst) |
Assignment to UList operator, removing indices. Takes linear time. More... | |
void | operator= (const SortableList< T > &lst) |
Assignment operator. Takes linear time. More... | |
void | operator= (List< T > &&lst) |
Move assignment, removing indices. Takes linear time. More... | |
void | operator= (SortableList< T > &&lst) |
Move operator (constant time) More... | |
void | operator= (std::initializer_list< T > lst) |
Assignment to an initializer list. More... | |
A list that is sorted upon construction or when explicitly requested with the sort() method.
Uses the std::stable_sort() algorithm.
|
inlineconstexprnoexcept |
Default construct.
Definition at line 34 of file SortableList.C.
|
inlineexplicit |
Construct given size, sort later.
The indices remain empty until the list is sorted
Definition at line 42 of file SortableList.C.
|
inline |
Construct zero-initialized with given size, sort later.
The indices remain empty until the list is sorted
Definition at line 49 of file SortableList.C.
|
inline |
Construct given size and initial value, sorting later.
The indices remain empty until the list is sorted
Definition at line 56 of file SortableList.C.
|
inline |
Copy construct.
Definition at line 63 of file SortableList.C.
|
inline |
Move construct.
Definition at line 71 of file SortableList.C.
|
inlineexplicit |
Copy construct from UList, sorting immediately.
Definition at line 79 of file SortableList.C.
References SortableList< T >::sort().
|
inline |
Move construct from List, sorting immediately.
Definition at line 88 of file SortableList.C.
References SortableList< T >::sort().
|
inline |
Construct from an initializer list, sorting immediately.
Definition at line 97 of file SortableList.C.
References SortableList< T >::sort().
|
inline |
Return the list of sorted indices. Updated every sort.
Definition at line 108 of file SortableList.H.
Referenced by primitiveMesh::checkPointNearness(), commSchedule::commSchedule(), searchableBox::findNearestOnEdge(), triangleFuncs::intersect(), Foam::matchPoints(), SortableList< T >::operator=(), SprayCloud< Foam::DSMCCloud >::penetration(), faceCollapser::setRefinement(), ParSortableList< Type >::sort(), and PatchTools::sortedEdgeFaces().
|
inline |
Return non-const access to the sorted indices. Updated every sort.
Definition at line 114 of file SortableList.H.
void clear | ( | ) |
Clear the list and the indices.
Definition at line 108 of file SortableList.C.
References List< T >::clear().
Foam::List< T > & shrink | ( | ) |
Clear the indices and return a reference to the underlying List.
Definition at line 116 of file SortableList.C.
Referenced by DynamicList< Foam::FixedList< scalar, 3 > >::transfer(), and List< vectorField >::transfer().
void sort | ( | ) |
Forward (stable) sort the list (if changed after construction).
Resizes the indices as required
Definition at line 124 of file SortableList.C.
References Foam::sortedOrder(), and List< T >::transfer().
Referenced by searchableBox::findNearestOnEdge(), triangleFuncs::intersect(), SprayCloud< Foam::DSMCCloud >::penetration(), faceCollapser::setRefinement(), SortableList< T >::SortableList(), and PatchTools::sortedEdgeFaces().
void reverseSort | ( | ) |
Reverse (stable) sort the list.
Resizes the indices as required
Definition at line 134 of file SortableList.C.
References Foam::sortedOrder(), and List< T >::transfer().
void partialSort | ( | label | n, |
label | start = 0 |
||
) |
Forward partial sort the list until the middle point.
Definition at line 144 of file SortableList.C.
References Foam::ListOps::identity(), Foam::less(), n, and List< T >::transfer().
void partialReverseSort | ( | label | n, |
label | start = 0 |
||
) |
Reverse partial sort the list until the middle point.
Definition at line 164 of file SortableList.C.
References Foam::ListOps::identity(), n, and List< T >::transfer().
|
inline |
Swap content with another SortableList in constant time.
Definition at line 184 of file SortableList.C.
|
inline |
Assignment of all entries to the given value, removing indices.
Definition at line 199 of file SortableList.C.
References UList< T >::operator=().
Assignment to UList operator, removing indices. Takes linear time.
Definition at line 207 of file SortableList.C.
References List< T >::operator=().
|
inline |
Assignment operator. Takes linear time.
Definition at line 215 of file SortableList.C.
References SortableList< T >::indices(), and List< T >::operator=().
Move assignment, removing indices. Takes linear time.
Definition at line 228 of file SortableList.C.
References List< T >::transfer().
|
inline |
Move operator (constant time)
Definition at line 236 of file SortableList.C.
References clear().
|
inline |
Assignment to an initializer list.
Definition at line 249 of file SortableList.C.
References List< T >::operator=(), and Foam::sort().