34 template<
class Container,
class ProcPatch>
38 const Container& patches
43 label nNeighbours = 0;
47 boolList isNeighbourProc(nProcs,
false);
51 const typename Container::const_reference patch = patches[
patchi];
53 if (isA<ProcPatch>(patch))
55 const ProcPatch& procPatch =
56 refCast<const ProcPatch>(patch);
58 label pNeighbProcNo = procPatch.neighbProcNo();
60 if (!isNeighbourProc[pNeighbProcNo])
64 maxNb =
max(maxNb, procPatch.neighbProcNo());
66 isNeighbourProc[pNeighbProcNo] =
true;
75 forAll(isNeighbourProc, proci)
77 if (isNeighbourProc[proci])
79 neighbours[nNeighbours++] = proci;
83 procPatchMap_.setSize(maxNb + 1);
88 const typename Container::const_reference patch = patches[
patchi];
90 if (isA<ProcPatch>(patch))
92 const ProcPatch& procPatch =
93 refCast<const ProcPatch>(patch);
96 procPatchMap_[procPatch.neighbProcNo()] =
patchi;
106 template<
class Container,
class ProcPatch>
109 const Container& patches,
114 patchSchedule_(2*patches.size())
116 if (Pstream::parRun())
119 operator[](Pstream::myProcNo(comm)) =
120 procNeighbours(this->size(), patches);
123 Pstream::gatherList(*
this, Pstream::msgType(), comm);
124 Pstream::scatterList(*
this, Pstream::msgType(), comm);
130 && Pstream::defaultCommsType == Pstream::commsTypes::scheduled
133 label patchEvali = 0;
140 if (!isA<ProcPatch>(patches[
patchi]))
142 patchSchedule_[patchEvali].patch =
patchi;
143 patchSchedule_[patchEvali++].init =
true;
144 patchSchedule_[patchEvali].patch =
patchi;
145 patchSchedule_[patchEvali++].init =
false;
158 nComms += operator[](proci).size();
164 const labelList& nbrs = operator[](proci);
181 Pstream::nProcs(comm),
183 ).procSchedule()[Pstream::myProcNo(comm)]
188 label commI = mySchedule[iter];
191 label nb = comms[commI][0];
192 if (nb == Pstream::myProcNo(comm))
194 nb = comms[commI][1];
198 if (Pstream::myProcNo(comm) > nb)
200 patchSchedule_[patchEvali].patch =
patchi;
201 patchSchedule_[patchEvali++].init =
true;
202 patchSchedule_[patchEvali].patch =
patchi;
203 patchSchedule_[patchEvali++].init =
false;
207 patchSchedule_[patchEvali].patch =
patchi;
208 patchSchedule_[patchEvali++].init =
false;
209 patchSchedule_[patchEvali].patch =
patchi;
210 patchSchedule_[patchEvali++].init =
true;
216 patchSchedule_ = nonBlockingSchedule(patches);
223 template<
class Container,
class ProcPatch>
227 const Container& patches
232 label patchEvali = 0;
244 if (!isA<ProcPatch>(patches[
patchi]))
246 patchSchedule[patchEvali].patch =
patchi;
247 patchSchedule[patchEvali++].init =
true;
248 patchSchedule[patchEvali].patch =
patchi;
249 patchSchedule[patchEvali++].init =
false;
259 if (isA<ProcPatch>(patches[
patchi]))
261 patchSchedule[patchEvali].patch =
patchi;
262 patchSchedule[patchEvali++].init =
true;
269 if (isA<ProcPatch>(patches[
patchi]))
271 patchSchedule[patchEvali].patch =
patchi;
272 patchSchedule[patchEvali++].init =
false;
276 return patchSchedule;
List< labelList > labelListList
A List of labelList.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Determines processor-processor connection. After instantiation contains on all processors the process...
Various functions to operate on Lists.
List< bool > boolList
Bool container classes.
ProcessorTopology(const Container &patches, const label comm)
Construct from boundaryMesh.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static lduSchedule nonBlockingSchedule(const Container &patches)
Calculate non-blocking (i.e. unscheduled) schedule.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
Pair< label > labelPair
Label pair.
List< label > labelList
A List of labels.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
Determines the order in which a set of processors should communicate with one another.