FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

SortableList< T > Class Template Reference

A list that is sorted upon construction or when explicitly requested with the sort() method. More...

#include <OpenFOAM/SortableList.H>


Detailed Description

template<class T>
class Foam::SortableList< T >

A list that is sorted upon construction or when explicitly requested with the sort() method.

Uses the Foam::stableSort() algorithm.

Source files

Definition at line 53 of file SortableList.H.

Inheritance diagram for SortableList< T >:
Collaboration diagram for SortableList< T >:

List of all members.

Public Member Functions

 SortableList ()
 Null constructor, sort later (eg, after assignment or transfer)
 SortableList (const UList< T > &)
 Construct from UList, sorting immediately.
 SortableList (const Xfer< List< T > > &)
 Construct from transferred List, sorting immediately.
 SortableList (const label size)
 Construct given size. Sort later on.
 SortableList (const label size, const T &)
 Construct given size and initial value. Sort later on.
 SortableList (const SortableList< T > &)
 Construct as copy.
const labelList &  indices () const
 Return the list of sorted indices. Updated every sort.
labelList &  indices ()
 Return non-const access to the sorted indices. Updated every sort.
void  clear ()
 Clear the list and the indices.
List< T > &  shrink ()
 Clear the indices and return a reference to the underlying List.
void  sort ()
 (stable) sort the list (if changed after construction time)
void  reverseSort ()
 Reverse (stable) sort the list.
Xfer< List< T > >  xfer ()
 Transfer contents to the Xfer container as a plain List.
void  operator= (const T &)
 Assignment of all entries to the given value.
void  operator= (const UList< T > &)
 Assignment from UList operator. Takes linear time.
void  operator= (const SortableList< T > &)
 Assignment operator. Takes linear time.

Constructor & Destructor Documentation

SortableList (  )

Null constructor, sort later (eg, after assignment or transfer)

Definition at line 50 of file SortableList.C.

SortableList ( const UList< T > &   values  ) [explicit]

Construct from UList, sorting immediately.

Definition at line 55 of file SortableList.C.

References SortableList< T >::sort().

SortableList ( const Xfer< List< T > > &   values  ) [explicit]

Construct from transferred List, sorting immediately.

Definition at line 64 of file SortableList.C.

References SortableList< T >::sort().

SortableList ( const label   size  ) [explicit]

Construct given size. Sort later on.

The indices remain empty until the list is sorted

Definition at line 73 of file SortableList.C.

SortableList ( const label   size,
const T &   val  
)

Construct given size and initial value. Sort later on.

The indices remain empty until the list is sorted

Definition at line 80 of file SortableList.C.

SortableList ( const SortableList< T > &   lst  )

Construct as copy.

Definition at line 87 of file SortableList.C.


Member Function Documentation

labelList& indices (  ) [inline]

Return non-const access to the sorted indices. Updated every sort.

Definition at line 99 of file SortableList.H.

void clear (  )

Clear the list and the indices.

Reimplemented from List< T >.

Definition at line 98 of file SortableList.C.

References List< T >::clear().

Referenced by SortableList< T >::shrink().

Foam::List< T > & shrink (  )

Clear the indices and return a reference to the underlying List.

Definition at line 106 of file SortableList.C.

References SortableList< T >::clear().

Referenced by List< T >::transfer().

void sort (  )

(stable) sort the list (if changed after construction time)

also resizes the indices as required

Definition at line 114 of file SortableList.C.

References forAll, and List< T >::transfer().

Referenced by searchableBox::findNearestOnEdge(), triangleFuncs::intersect(), faceCollapser::setRefinement(), SortableList< T >::SortableList(), and PatchTools::sortedEdgeFaces().

void reverseSort (  )

Reverse (stable) sort the list.

Definition at line 129 of file SortableList.C.

References forAll, and List< T >::transfer().

Foam::Xfer< Foam::List< T > > xfer (  ) [inline]

Transfer contents to the Xfer container as a plain List.

Reimplemented from List< T >.

Definition at line 145 of file SortableList.C.

void operator= ( const T &   t  ) [inline]

Assignment of all entries to the given value.

Reimplemented from List< T >.

Definition at line 154 of file SortableList.C.

References UList< T >::operator=().

void operator= ( const UList< T > &   rhs  ) [inline]

Assignment from UList operator. Takes linear time.

Reimplemented from List< T >.

Definition at line 161 of file SortableList.C.

References List< T >::operator=().

void operator= ( const SortableList< T > &   rhs  ) [inline]

Assignment operator. Takes linear time.

Definition at line 169 of file SortableList.C.

References SortableList< T >::indices(), and List< T >::operator=().


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