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);
127 if (Pstream::parRun() && Pstream::defaultCommsType == Pstream::scheduled)
129 label patchEvali = 0;
136 if (!isA<ProcPatch>(patches[
patchi]))
138 patchSchedule_[patchEvali].patch =
patchi;
139 patchSchedule_[patchEvali++].init =
true;
140 patchSchedule_[patchEvali].patch =
patchi;
141 patchSchedule_[patchEvali++].init =
false;
154 nComms += operator[](proci).size();
160 const labelList& nbrs = operator[](proci);
177 Pstream::nProcs(comm),
179 ).procSchedule()[Pstream::myProcNo(comm)]
184 label commI = mySchedule[iter];
187 label nb = comms[commI][0];
188 if (nb == Pstream::myProcNo(comm))
190 nb = comms[commI][1];
194 if (Pstream::myProcNo(comm) > nb)
196 patchSchedule_[patchEvali].patch =
patchi;
197 patchSchedule_[patchEvali++].init =
true;
198 patchSchedule_[patchEvali].patch =
patchi;
199 patchSchedule_[patchEvali++].init =
false;
203 patchSchedule_[patchEvali].patch =
patchi;
204 patchSchedule_[patchEvali++].init =
false;
205 patchSchedule_[patchEvali].patch =
patchi;
206 patchSchedule_[patchEvali++].init =
true;
212 patchSchedule_ = nonBlockingSchedule(patches);
219 template<
class Container,
class ProcPatch>
223 const Container& patches
228 label patchEvali = 0;
240 if (!isA<ProcPatch>(patches[
patchi]))
242 patchSchedule[patchEvali].patch =
patchi;
243 patchSchedule[patchEvali++].init =
true;
244 patchSchedule[patchEvali].patch =
patchi;
245 patchSchedule[patchEvali++].init =
false;
255 if (isA<ProcPatch>(patches[
patchi]))
257 patchSchedule[patchEvali].patch =
patchi;
258 patchSchedule[patchEvali++].init =
true;
265 if (isA<ProcPatch>(patches[
patchi]))
267 patchSchedule[patchEvali].patch =
patchi;
268 patchSchedule[patchEvali++].init =
false;
272 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.