A list that is sorted upon construction or when explicitly requested with the sort() method. More...
Public Member Functions | |
| constexpr | SortableList () noexcept |
| Null constructor, sort later (eg, after assignment or transfer) More... | |
| SortableList (const label size) | |
| Construct given size, sort later. More... | |
| SortableList (const label size, const 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... | |
| template<class InputIterator > | |
| SortableList (InputIterator begIter, InputIterator endIter) | |
| Construct given begin/end iterators. 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 > &lst) |
| 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. Takes linear 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 |
Null constructor, sort later (eg, after assignment or transfer)
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 given begin/end iterators.
Uses std::distance to determine the size.
Definition at line 99 of file SortableList.C.
References Foam::sort().
|
inline |
Construct from an initializer list, sorting immediately.
Definition at line 111 of file SortableList.C.
References SortableList< T >::sort().
|
inline |
Return the list of sorted indices. Updated every sort.
Definition at line 113 of file SortableList.H.
Referenced by primitiveMesh::checkPointNearness(), commSchedule::commSchedule(), faMesh::faMesh(), 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 119 of file SortableList.H.
| void clear | ( | ) |
Clear the list and the indices.
Definition at line 122 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 130 of file SortableList.C.
Referenced by DynamicList< Foam::FixedList< scalar, 3 > >::transfer(), and List< substance >::transfer().
| void sort | ( | ) |
Forward (stable) sort the list (if changed after construction).
Resizes the indices as required
Definition at line 138 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 148 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 158 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 178 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 198 of file SortableList.C.
Referenced by Foam::Swap().
|
inline |
Assignment of all entries to the given value, removing indices.
Definition at line 213 of file SortableList.C.
References UList< T >::operator=().
Assignment to UList operator, removing indices. Takes linear time.
Definition at line 221 of file SortableList.C.
References List< T >::operator=().
|
inline |
Assignment operator. Takes linear time.
Definition at line 229 of file SortableList.C.
References SortableList< T >::indices(), and List< T >::operator=().
Move assignment, removing indices. Takes linear time.
Definition at line 242 of file SortableList.C.
References List< T >::transfer().
|
inline |
Move operator. Takes linear time.
Definition at line 250 of file SortableList.C.
References clear().
|
inline |
Assignment to an initializer list.
Definition at line 263 of file SortableList.C.
References List< T >::operator=(), and Foam::sort().