32 #include "processorFvPatch.H"
38 #include <HashTable.H>
44 const faceList& faces = cMesh_.faces();
45 labelListList neighbourCellsForFace(cMesh_.nInternalFaces());
50 if(cMesh_.isInternalFace(facei))
52 labelList neighbourCells;
53 labelList pointsFacei = faces[facei];
57 label pointi = pointsFacei[k];
59 labelList neighbourCellsForPointI = cMesh_.pointCells()[pointi];
61 forAll(neighbourCellsForPointI, j)
63 label celli = neighbourCellsForPointI[j];
65 bool contained =
false;
69 label ncell=neighbourCells[f];
78 neighbourCells.append(celli);
82 neighbourCellsForFace[facei].append(neighbourCells);
89 if (Pstream::parRun())
92 labelIOList localPointProcAddr
96 "pointProcAddressing",
97 cMesh_.facesInstance(),
105 forAll(localPointProcAddr, iPoint)
107 globalPointProcAddr.insert
109 localPointProcAddr[iPoint],
114 labelIOList localCellProcAddr
118 "cellProcAddressing",
119 cMesh_.facesInstance(),
127 forAll(localCellProcAddr, iCell)
129 globalCellProcAddr.insert
131 localCellProcAddr[iCell],
136 forAll(cMesh_.boundary(), patchIndex)
138 if (isType<processorFvPatch>(cMesh_.boundary()[patchIndex]))
156 const label iProcPatchId =
procPairs_[iProcPair];
157 const fvPatch& fvp = cMesh_.boundary()[iProcPatchId];
158 const processorFvPatch& procp = refCast<const processorFvPatch>(fvp);
159 procGdf_[iProcPair].resize(fvp.size());
160 procWf2_[iProcPair].resize(fvp.size());
170 const label iProcPatchId =
procPairs_[iProcPatch];
171 const fvPatch& fvp = cMesh_.boundary()[iProcPatchId];
172 const polyPatch& pp = fvp.patch();
183 pointId = pp[facei][pointi];
185 vCells.insert(cMesh_.pointCells()[pointId]);
187 gPointId = localPointProcAddr[pointId];
189 if (locPointProcs.found(gPointId))
191 locPointProcs[gPointId].insert(
neigProcs_[iProcPatch]);
196 locPointProcs[gPointId].insert(
neigProcs_[iProcPatch]);
199 faceCells.append(vCells.toc());
214 PstreamBuffers pBuffers (Pstream::commsTypes::nonBlocking);
222 ownEnd_[iProcPatch].resize(nFaces);
230 UOPstream oProcStr(
neigProcs_[iProcPatch], pBuffers);
235 pBuffers.finishedSends();
243 List<label> neiLen (nFaces, 0);
244 neiEnd_[iProcPatch].resize(nFaces);
246 corEnd_[iProcPatch].resize(nFaces);
248 UIPstream iProcStr(
neigProcs_[iProcPatch], pBuffers);
260 DynamicList<label> multipleProcsPoints;
264 if (iter().size() > 1)
266 multipleProcsPoints.append(iter.key());
276 List<label> gPointCells;
279 forAll(multipleProcsPoints, iPoint)
281 gPointId = multipleProcsPoints[iPoint];
282 lPointId = globalPointProcAddr[gPointId];
283 const List<label>& lPointCells = cMesh_.pointCells(lPointId);
284 gPointCells.resize(lPointCells.size());
286 forAll(lPointCells, iCell)
288 gPointCells[iCell] = localCellProcAddr[lPointCells[iCell]];
289 if (!
cellProc_.found(gPointCells[iCell]))
291 cellProc_.insert(gPointCells[iCell], Pstream::myProcNo());
305 if (Pstream::master())
308 for (label proci = Pstream::firstSlave(); proci <= Pstream::lastSlave(); proci++)
310 IPstream fromSlave(Pstream::commsTypes::scheduled, proci);
315 fromSlave >> slaveCells;
331 fromSlave >> slaveCellProc;
342 Info <<
"Same cell located at two or more processors!" << endl;
350 OPstream toMaster(Pstream::commsTypes::scheduled, Pstream::masterNo());
358 if (Pstream::master())
360 for(label proci = Pstream::firstSlave(); proci <= Pstream::lastSlave(); proci++)
362 OPstream toSlave(Pstream::commsTypes::scheduled, proci);
374 IPstream fromMaster(Pstream::commsTypes::scheduled, Pstream::masterNo());
380 Info <<
"Data redistributed" << endl;
388 List<DynamicList<label> > globalCorCellIds;
398 forAll(multipleProcsPoints, iPoint)
400 gPointId = multipleProcsPoints[iPoint];
401 pointId = globalPointProcAddr[gPointId];
402 labelList locFaceIds = cMesh_.pointFaces()[pointId];
405 faceId = locFaceIds[iFace];
406 if (cMesh_.isInternalFace(faceId))
412 bool isProcPatch =
false;
413 fPatchId = cMesh_.boundaryMesh().whichPatch(faceId);
424 if (faceIds.found(faceId))
426 faceIds[faceId].append(pointId);
433 List<label>(1, pointId)
456 List<label> pIds = iter();
460 lPointId = pIds[iPoint];
461 gPointId = localPointProcAddr[lPointId];
466 gCellId = pCells[iCell];
470 bool cornerProcess =
true;
471 if (Pstream::myProcNo() == procId)
473 cornerProcess =
false;
475 patchId = cMesh_.boundaryMesh().whichPatch(iter.key());
478 cornerProcess =
false;
483 fCells.insert(gCellId);
484 if (neigProcFaces.found(procId))
486 neigProcFaces[procId].insert(iter.key());
491 neigProcFaces[procId].insert(iter.key());
507 corAddr_.resize(neigProcFaces.toc().size());
508 globalCorCellIds.resize(
corAddr_.size());
518 forAll(faceIds.toc(), iFaceId)
522 faceIds.toc()[iFaceId],
531 globalCorProcIds.insert(iter.key(),iNeiProc);
533 List<label> procFaceIds = iter().toc();
535 forAll(procFaceIds, iFace)
537 faceId = procFaceIds[iFace];
538 patchId= cMesh_.boundaryMesh().whichPatch(faceId);
540 faceNo = cMesh_.boundaryMesh()[patchId].whichFace(faceId);
542 List<label> cellIds = faceNeigCells[faceId];
546 gCellId = cellIds[iCell];
550 globalCorCellIds[iNeiProc].append(gCellId);
579 label
id = globalCorProcIds[procId];
581 OPstream oStream (Pstream::commsTypes::scheduled, procId);
582 oStream << globalCorCellIds[id];
593 IPstream iStream (Pstream::commsTypes::scheduled, procId);
594 List<label> neiGlobalCellIds (iStream);
602 corCellIds_[iCorProc].resize(neiGlobalCellIds.size());
604 forAll(neiGlobalCellIds, iCell)
607 globalCellProcAddr[neiGlobalCellIds[iCell]];
HashTable< T, label, Hash< label >> labelHashTable
labelHashTable< label > cellProc_
labelHashTable< label > corProcIds_
List2< label > corCellIds_
labelHashTable< label > idProcPatchPairs_
HashSet< label, Hash< label > > labelHashSet
List2< Triple< label > > corAddr_
List3< label > myProcPatchCells_
void findNeighbours()
Find neighbour cells for each face (throught face points).
labelListList neighbourCells_
labelHashTable< List< label > > pointCells_