Data Structures | Public Member Functions | Private Member Functions | Private Attributes
ParSortableList< Type > Class Template Reference

Implementation of PSRS parallel sorting routine. More...

Inheritance diagram for ParSortableList< Type >:
Inheritance graph
[legend]
Collaboration diagram for ParSortableList< Type >:
Collaboration graph
[legend]

Data Structures

class  taggedValue
 Private class for sorting. Sorts on value_. More...
 

Public Member Functions

 ParSortableList (const UList< Type > &)
 Construct from List, sorting the elements. More...
 
 ParSortableList (const label size)
 Construct given size. Sort later on. More...
 
void sort ()
 (stable) sort the list (if changed after construction time) More...
 
const labelListindices () const
 Return the list of sorted point indices. More...
 
const labelListprocs () const
 Return the list of processor number. More...
 
- Public Member Functions inherited from List< Type >
label size () const
 Return the number of elements in the UList. More...
 
 List ()
 Null constructor. More...
 
 List (const label)
 Construct with given size. More...
 
 List (const label, const T &)
 Construct with given size and value for all elements. More...
 
 List (const List< T > &)
 Copy constructor. More...
 
 List (const Xfer< List< T > > &)
 Construct by transferring the parameter contents. More...
 
 List (List< T > &, bool reUse)
 Construct as copy or re-use as specified. More...
 
 List (const UList< T > &, const labelUList &mapAddressing)
 Construct as subset. More...
 
 List (InputIterator first, InputIterator last)
 Construct given start and end iterators. More...
 
 List (const FixedList< T, Size > &)
 Construct as copy of FixedList<T, Size> More...
 
 List (const PtrList< T > &)
 Construct as copy of PtrList<T> More...
 
 List (const SLList< T > &)
 Construct as copy of SLList<T> More...
 
 List (const UIndirectList< T > &)
 Construct as copy of UIndirectList<T> More...
 
 List (const BiIndirectList< T > &)
 Construct as copy of BiIndirectList<T> More...
 
 List (Istream &)
 Construct from Istream. More...
 
 List (const label s)
 
 List (const label s, const T &a)
 
 List (const List< T > &a)
 
 List (const Xfer< List< T > > &lst)
 
 List (List< T > &a, bool reUse)
 
 List (const UList< T > &a, const labelUList &map)
 
 List (const PtrList< T > &lst)
 
 List (const SLList< T > &lst)
 
 List (const UIndirectList< T > &lst)
 
 List (const BiIndirectList< T > &lst)
 
 List ()
 
 List (Istream &is)
 
autoPtr< List< T > > clone () const
 Clone. More...
 
 ~List ()
 Destructor. More...
 
void resize (const label)
 Alias for setSize(const label) More...
 
void resize (const label, const T &)
 Alias for setSize(const label, const T&) More...
 
void setSize (const label)
 Reset size of List. More...
 
void setSize (const label, const T &)
 Reset size of List and value for new elements. More...
 
void clear ()
 Clear the list, i.e. set size to zero. More...
 
void append (const T &)
 Append an element at the end of the list. More...
 
void append (const UList< T > &)
 Append a List at the end of this list. More...
 
void append (const UIndirectList< T > &)
 Append a UIndirectList at the end of this list. More...
 
void transfer (List< T > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (DynamicList< T, SizeInc, SizeMult, SizeDiv > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (SortableList< T > &)
 Transfer the contents of the argument List into this list. More...
 
void transfer (List< T > &a)
 
void transfer (SortableList< T > &a)
 
Xfer< List< T > > xfer ()
 Transfer contents to the Xfer container. More...
 
TnewElmt (const label)
 Return subscript-checked element of UList. More...
 
void operator= (const UList< T > &)
 Assignment from UList operator. Takes linear time. More...
 
void operator= (const List< T > &)
 Assignment operator. Takes linear time. More...
 
void operator= (const SLList< T > &)
 Assignment from SLList operator. Takes linear time. More...
 
void operator= (const UIndirectList< T > &)
 Assignment from UIndirectList operator. Takes linear time. More...
 
void operator= (const BiIndirectList< T > &)
 Assignment from BiIndirectList operator. Takes linear time. More...
 
void operator= (const T &)
 Assignment of all entries to the given value. More...
 

Private Member Functions

void write (const List< Type > &elems, Ostream &os) const
 Write for debugging. More...
 
void copyInto (const List< Type > &values, const labelList &indices, const label fromProcNo, label &destI, List< taggedValue > &dest) const
 Copy into dest, setting indices and processor no. More...
 
void getPivots (const List< Type > &elems, List< Type > &pivots) const
 Calculate pivots. More...
 
void checkAndSend (List< Type > &values, labelList &indices, const label bufSize, const label destProcI) const
 If destProc != myProcNo send & clear values and indices. More...
 

Private Attributes

labelList indices_
 Original indices. More...
 
labelList procs_
 Processor numbers. More...
 

Additional Inherited Members

- Public Types inherited from List< Type >
typedef SubList< TsubList
 Declare type of subList. More...
 
- Static Public Member Functions inherited from List< Type >
static const List< T > & null ()
 Return a null List. More...
 
- Protected Member Functions inherited from List< Type >
void size (const label)
 Override size to be inconsistent with allocated storage. More...
 

Detailed Description

template<class Type>
class Foam::ParSortableList< Type >

Implementation of PSRS parallel sorting routine.

From "On the Versatility of Parallel Sorting by Regular Sampling" Xiaobo Li et. all.

Construct from list of things to sort (uses SortableList, 'thing' should implement >, ==).

Will contain sorted data and in

Can also be constructed from size, filled at ease and then sort()'ed.

Source files

Definition at line 69 of file ParSortableList.H.

Constructor & Destructor Documentation

◆ ParSortableList() [1/2]

ParSortableList ( const UList< Type > &  values)

Construct from List, sorting the elements.

Definition at line 127 of file ParSortableList.C.

References ParSortableList< Type >::sort().

Here is the call graph for this function:

◆ ParSortableList() [2/2]

ParSortableList ( const label  size)

Construct given size. Sort later on.

Definition at line 139 of file ParSortableList.C.

Member Function Documentation

◆ write()

void write ( const List< Type > &  elems,
Ostream os 
) const
private

Write for debugging.

Definition at line 36 of file ParSortableList.C.

References forAll.

◆ copyInto()

void copyInto ( const List< Type > &  values,
const labelList indices,
const label  fromProcNo,
label destI,
List< taggedValue > &  dest 
) const
private

Copy into dest, setting indices and processor no.

Definition at line 54 of file ParSortableList.C.

References forAll, ParSortableList< Type >::taggedValue::index(), ParSortableList< Type >::taggedValue::procID(), and ParSortableList< Type >::taggedValue::value().

Here is the call graph for this function:

◆ getPivots()

void getPivots ( const List< Type > &  elems,
List< Type > &  pivots 
) const
private

Calculate pivots.

Definition at line 77 of file ParSortableList.C.

References forAll, List::setSize(), and List::size().

Here is the call graph for this function:

◆ checkAndSend()

void checkAndSend ( List< Type > &  values,
labelList indices,
const label  bufSize,
const label  destProcI 
) const
private

If destProc != myProcNo send & clear values and indices.

Definition at line 97 of file ParSortableList.C.

References Foam::endl(), Foam::Pout, and List::setSize().

Here is the call graph for this function:

◆ sort()

void sort

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

Definition at line 151 of file ParSortableList.C.

References UPstream::blocking, Foam::endl(), forAll, Pstream::gatherList(), SortableList::indices(), UPstream::master(), UPstream::myProcNo(), n, UPstream::nProcs(), Foam::Pout, Foam::reduce(), Pstream::scatter(), List::setSize(), setSize(), Foam::sort(), and write().

Referenced by ParSortableList< Type >::ParSortableList().

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

◆ indices()

const labelList& indices ( ) const
inline

Return the list of sorted point indices.

Definition at line 186 of file ParSortableList.H.

References ParSortableList< Type >::indices_.

◆ procs()

const labelList& procs ( ) const
inline

Return the list of processor number.

Definition at line 192 of file ParSortableList.H.

References ParSortableList< Type >::procs_.

Field Documentation

◆ indices_

labelList indices_
private

Original indices.

Definition at line 77 of file ParSortableList.H.

Referenced by ParSortableList< Type >::indices().

◆ procs_

labelList procs_
private

Processor numbers.

Definition at line 80 of file ParSortableList.H.

Referenced by ParSortableList< Type >::procs().


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