SortList< T > Class Template Reference

An indirect list with addressing based on sorting. The list is sorted upon construction or when explicitly requested. More...

Inheritance diagram for SortList< T >:
[legend]
Collaboration diagram for SortList< T >:
[legend]

Public Member Functions

 SortList (const UList< T > &values)
 Shallow copy values list reference, sort immediately. More...
 
template<class Compare >
 SortList (const UList< T > &values, const Compare &comp)
 
const labelUListindices () const
 Return the list of sorted indices. Updated every sort. More...
 
labelListindices ()
 Return the list of indices. Updated every sort. More...
 
void reverse ()
 Reverse the indices. More...
 
void reset ()
 Reset list indices to identity. More...
 
template<class Compare >
void sort (const Compare &comp)
 Sort the list using the given value comparator. More...
 
void sort ()
 
void reverseSort ()
 Reverse (stable) sort the list. More...
 
- Public Member Functions inherited from IndirectList< T >
 IndirectList (const UList< T > &values, const labelUList &addr)
 Copy construct addressing, shallow copy values reference. More...
 
 IndirectList (const UList< T > &values, labelList &&addr)
 Move construct addressing, shallow copy values reference. More...
 
 IndirectList (const UList< T > &values, const Foam::zero)
 Zero-sized addressing, shallow copy values reference. More...
 
 IndirectList (const IndirectList< T > &list)
 Copy construct addressing, shallow copy values reference. More...
 
 IndirectList (IndirectList< T > &&list)
 Move construct addressing, shallow copy values reference. More...
 
 IndirectList (const UIndirectList< T > &list)
 Copy construct addressing, shallow copy values reference. More...
 
void operator= (const IndirectList< T > &rhs)
 Deep copy values, Fatal if list sizes are not identical. More...
 
const Addr & addressing () const noexcept
 The list addressing. More...
 
Addr & addressing () noexcept
 The list addressing. More...
 
- Public Member Functions inherited from UIndirectList< T >
 UIndirectList (const UList< T > &values, const labelUList &addr)
 Shallow copy values and addressing. More...
 
 UIndirectList (const UIndirectList< T > &list)
 Copy construct (shallow copy values and addressing) More...
 
void operator= (const UIndirectList< T > &rhs)
 Deep copy values, Fatal if list sizes are not identical. More...
 

Detailed Description

template<class T>
class Foam::SortList< T >

An indirect list with addressing based on sorting. The list is sorted upon construction or when explicitly requested.

Uses the std::stable_sort() algorithm.

Source files

Definition at line 54 of file SortList.H.

Constructor & Destructor Documentation

◆ SortList() [1/2]

SortList ( const UList< T > &  values)
inlineexplicit

Shallow copy values list reference, sort immediately.

Definition at line 33 of file SortListI.H.

References SortList< T >::sort().

Here is the call graph for this function:

◆ SortList() [2/2]

SortList ( const UList< T > &  values,
const Compare &  comp 
)
inline

Shallow copy values list reference, sort with given value comparator.

Note
The comparator is not stored in the class.

Definition at line 43 of file SortListI.H.

Member Function Documentation

◆ indices() [1/2]

const Foam::labelUList & indices ( ) const
inline

Return the list of sorted indices. Updated every sort.

Same as addressing()

Definition at line 54 of file SortListI.H.

◆ indices() [2/2]

Foam::labelList & indices ( )
inline

Return the list of indices. Updated every sort.

Same as addressing()

Definition at line 61 of file SortListI.H.

◆ reverse()

void reverse ( )
inline

Reverse the indices.

Definition at line 68 of file SortListI.H.

References Foam::reverse().

Here is the call graph for this function:

◆ reset()

void reset ( )
inline

Reset list indices to identity.

Definition at line 75 of file SortListI.H.

References Foam::ListOps::identity(), List< T >::resize(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ sort() [1/2]

void sort ( const Compare &  comp)
inline

Sort the list using the given value comparator.

Definition at line 87 of file SortListI.H.

References Foam::constant::physicoChemical::b, Foam::ListOps::identity(), List< T >::resize(), UList< T >::size(), and Foam::HashTableOps::values().

Here is the call graph for this function:

◆ sort() [2/2]

void sort ( )
inline

Forward (stable) sort the list. Functionally identical to sort with std::less<T>()

Definition at line 108 of file SortListI.H.

References Foam::constant::physicoChemical::b, Foam::ListOps::identity(), List< T >::resize(), UList< T >::size(), and Foam::HashTableOps::values().

Referenced by SortList< T >::SortList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reverseSort()

void reverseSort ( )
inline

Reverse (stable) sort the list.

Definition at line 130 of file SortListI.H.

References Foam::constant::physicoChemical::b, Foam::ListOps::identity(), List< T >::resize(), UList< T >::size(), and Foam::HashTableOps::values().

Here is the call graph for this function:

The documentation for this class was generated from the following files: