48 if (procI != Pstream::myProcNo())
50 if (subMap[procI].size())
55 if (constructMap[procI].size())
62 allComms = commsSet.
toc();
67 if (Pstream::master())
72 int slave=Pstream::firstSlave();
73 slave<=Pstream::lastSlave();
77 IPstream fromSlave(Pstream::blocking, slave);
82 if (
findIndex(allComms, nbrData[i]) == -1)
84 label sz = allComms.
size();
86 allComms[sz] = nbrData[i];
93 int slave=Pstream::firstSlave();
94 slave<=Pstream::lastSlave();
98 OPstream toSlave(Pstream::blocking, slave);
105 OPstream toMaster(Pstream::blocking, Pstream::masterNo());
106 toMaster << allComms;
109 IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
110 fromMaster >> allComms;
122 ).procSchedule()[Pstream::myProcNo()]
154 if (schedulePtr_.
empty())
164 return schedulePtr_();
173 const label constructSize,
178 constructSize_(constructSize),
180 constructMap_(constructMap),
188 const label constructSize,
194 constructSize_(constructSize),
195 subMap_(subMap, reUse),
196 constructMap_(constructMap, reUse),
210 if (sendProcs.
size() != recvProcs.
size())
214 "mapDistribute::mapDistribute(const labelList&, const labelList&)"
215 ) <<
"The send and receive data is not the same length. sendProcs:"
216 << sendProcs.
size() <<
" recvProcs:" << recvProcs.
size()
224 forAll(sendProcs, sampleI)
226 label sendProc = sendProcs[sampleI];
227 label recvProc = recvProcs[sampleI];
248 subMap_[procI].setSize(nSend[procI]);
249 constructMap_[procI].setSize(nRecv[procI]);
254 forAll(sendProcs, sampleI)
256 label sendProc = sendProcs[sampleI];
257 label recvProc = recvProcs[sampleI];
262 subMap_[recvProc][nSend[recvProc]++] = sampleI;
267 constructMap_[sendProc][nRecv[sendProc]++] = sampleI;
269 constructSize_ = sampleI+1;
277 constructSize_(map.constructSize_),
278 subMap_(map.subMap_),
279 constructMap_(map.constructMap_),
299 const labelList& map = constructMap_[domain];
303 boolList& subField = sendFields[domain];
307 subField[i] = elemIsUsed[map[i]];
314 reinterpret_cast<const char*>(subField.
begin()),
315 subField.
size()*
sizeof(bool)
335 reinterpret_cast<char*>(recvFields[domain].begin()),
336 recvFields[domain].size()*
sizeof(
bool)
371 if (recvFields[domain][i])
374 newMap[newI++] = map[i];
377 if (newI < map.
size())
380 subMap_[domain].transfer(newMap);
389 label maxConstructIndex = -1;
393 const labelList& map = constructMap_[domain];
400 label destinationI = map[i];
403 if (elemIsUsed[destinationI])
405 maxConstructIndex =
max(maxConstructIndex, destinationI);
407 newMap[newI++] = destinationI;
410 if (newI < map.
size())
412 newMap.setSize(newI);
413 constructMap_[domain].transfer(newMap);
417 constructSize_ = maxConstructIndex+1;
420 schedulePtr_.clear();
433 "Foam::mapDistribute::operator=(const Foam::mapDistribute&)"
434 ) <<
"Attempted assignment to self"
437 constructSize_ = rhs.constructSize_;
438 subMap_ = rhs.subMap_;
439 constructMap_ = rhs.constructMap_;
440 schedulePtr_.
clear();