Go to the documentation of this file.
45 os <<
' ' << elems[elemI];
57 const label fromProcNo,
66 tagVal.
value() = values[elemI];
67 tagVal.
index() = indices[elemI];
68 tagVal.
procID() = fromProcNo;
82 pivots.
setSize(Pstream::nProcs());
88 pivots[pivotI] = elems[pivotPos];
90 pivotPos += elems.
size()/Pstream::nProcs();
101 const label destProcI
104 if (destProcI != Pstream::myProcNo())
111 Pout<<
"Sending to " << destProcI <<
" elements:" << values
116 OPstream toSlave(Pstream::blocking, destProcI);
117 toSlave << values << indices;
170 getPivots(sorted, pivots);
189 ListListOps::combine<labelList>
204 getPivots(sortedPivots, pivots);
210 Pout<<
"new pivots:";
235 if ((pivotI <
Pstream::nProcs()) && (sorted[sortedI] > pivots[pivotI]))
237 checkAndSend(sendValues, sendIndices, sendI, destProcI);
240 sendValues.
setSize(sorted.size());
241 sendIndices.
setSize(sorted.size());
250 sendValues[sendI] = sorted[sortedI];
251 sendIndices[sendI] = sorted.
indices()[sortedI];
256 ownValues[ownI] = sorted[sortedI];
257 ownIndices[ownI] = sorted.
indices()[sortedI];
266 checkAndSend(sendValues, sendIndices, sendI, destProcI);
275 Pout<<
"Not sending (to myself) elements "
276 << ownValues <<
endl;
296 Pout<<
"Copying from own:" << ownValues <<
endl;
300 copyInto(ownValues, ownIndices, procI, combinedI, combinedValues);
310 Pout<<
"Receiving from " << procI <<
endl;
315 fromSlave >> recValues >> recIndices;
319 Pout<<
"Received from " << procI
320 <<
" elements:" << recValues <<
endl;
326 Pout<<
"Copying starting at:" << combinedI <<
endl;
328 copyInto(recValues, recIndices, procI, combinedI, combinedValues);
331 combinedValues.
setSize(combinedI);
338 indices_.setSize(combinedI);
339 procs_.setSize(combinedI);
341 forAll(combinedValues, elemI)
343 this->operator[](elemI) = combinedValues[elemI].value();
344 indices_[elemI] = combinedValues[elemI].index();
345 procs_[elemI] = combinedValues[elemI].procID();
points setSize(newPointi)
#define forAll(list, i)
Loop across all elements in list.
Output inter-processor communications stream.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
void checkAndSend(List< Type > &values, labelList &indices, const label bufSize, const label destProcI) const
If destProc != myProcNo send & clear values and indices.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Private class for sorting. Sorts on value_.
void write(const List< Type > &elems, Ostream &os) const
Write for debugging.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void getPivots(const List< Type > &elems, List< Type > &pivots) const
Calculate pivots.
void sort()
(stable) sort the list (if changed after construction time)
A list that is sorted upon construction or when explicitly requested with the sort() method.
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.
ParSortableList(const UList< Type > &)
Construct from List, sorting the elements.
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static bool master(const label communicator=0)
Am I the master process.
void setSize(const label)
Reset size of List.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
prefixOSstream Pout(cout, "Pout")
const labelList & indices() const
Return the list of sorted indices. Updated every sort.
Input inter-processor communications stream.
void size(const label)
Override size to be inconsistent with allocated storage.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
const Type & value() const