30 #include "processorFvPatch.H"
36 #include <HashTable.H>
42 const faceList& faces = cMesh_.faces();
43 labelListList neighbourCellsForFace(cMesh_.nInternalFaces());
48 if(cMesh_.isInternalFace(facei))
50 labelList neighbourCells;
51 labelList pointsFacei = faces[facei];
55 label pointi = pointsFacei[k];
57 labelList neighbourCellsForPointI = cMesh_.pointCells()[pointi];
59 forAll(neighbourCellsForPointI, j)
61 label celli = neighbourCellsForPointI[j];
63 bool contained =
false;
67 label ncell=neighbourCells[f];
76 neighbourCells.append(celli);
80 neighbourCellsForFace[facei].append(neighbourCells);
87 if (Pstream::parRun())
90 labelIOList localPointProcAddr
94 "pointProcAddressing",
95 cMesh_.facesInstance(),
103 forAll(localPointProcAddr, iPoint)
105 globalPointProcAddr.insert
107 localPointProcAddr[iPoint],
112 labelIOList localCellProcAddr
116 "cellProcAddressing",
117 cMesh_.facesInstance(),
125 forAll(localCellProcAddr, iCell)
127 globalCellProcAddr.insert
129 localCellProcAddr[iCell],
134 forAll(cMesh_.boundary(), patchIndex)
136 if (isType<processorFvPatch>(cMesh_.boundary()[patchIndex]))
154 const label iProcPatchId =
procPairs_[iProcPair];
155 const fvPatch& fvp = cMesh_.boundary()[iProcPatchId];
156 const processorFvPatch& procp = refCast<const processorFvPatch>(fvp);
157 procGdf_[iProcPair].resize(fvp.size());
158 procWf2_[iProcPair].resize(fvp.size());
168 const label iProcPatchId =
procPairs_[iProcPatch];
169 const fvPatch& fvp = cMesh_.boundary()[iProcPatchId];
170 const polyPatch& pp = fvp.patch();
181 pointId = pp[facei][pointi];
183 vCells.insert(cMesh_.pointCells()[pointId]);
185 gPointId = localPointProcAddr[pointId];
187 if (locPointProcs.found(gPointId))
189 locPointProcs[gPointId].insert(
neigProcs_[iProcPatch]);
194 locPointProcs[gPointId].insert(
neigProcs_[iProcPatch]);
197 faceCells.append(vCells.toc());
212 PstreamBuffers pBuffers (Pstream::commsTypes::nonBlocking);
220 ownEnd_[iProcPatch].resize(nFaces);
228 UOPstream oProcStr(
neigProcs_[iProcPatch], pBuffers);
233 pBuffers.finishedSends();
241 List<label> neiLen (nFaces, 0);
242 neiEnd_[iProcPatch].resize(nFaces);
244 corEnd_[iProcPatch].resize(nFaces);
246 UIPstream iProcStr(
neigProcs_[iProcPatch], pBuffers);
258 DynamicList<label> multipleProcsPoints;
262 if (iter().size() > 1)
264 multipleProcsPoints.append(iter.key());
274 List<label> gPointCells;
277 forAll(multipleProcsPoints, iPoint)
279 gPointId = multipleProcsPoints[iPoint];
280 lPointId = globalPointProcAddr[gPointId];
281 const List<label>& lPointCells = cMesh_.pointCells(lPointId);
282 gPointCells.resize(lPointCells.size());
284 forAll(lPointCells, iCell)
286 gPointCells[iCell] = localCellProcAddr[lPointCells[iCell]];
287 if (!
cellProc_.found(gPointCells[iCell]))
289 cellProc_.insert(gPointCells[iCell], Pstream::myProcNo());
303 if (Pstream::master())
306 for (label proci = Pstream::firstSlave(); proci <= Pstream::lastSlave(); proci++)
308 IPstream fromSlave(Pstream::commsTypes::scheduled, proci);
313 fromSlave >> slaveCells;
329 fromSlave >> slaveCellProc;
340 Info <<
"Same cell located at two or more processors!" << endl;
348 OPstream toMaster(Pstream::commsTypes::scheduled, Pstream::masterNo());
356 if (Pstream::master())
358 for(label proci = Pstream::firstSlave(); proci <= Pstream::lastSlave(); proci++)
360 OPstream toSlave(Pstream::commsTypes::scheduled, proci);
372 IPstream fromMaster(Pstream::commsTypes::scheduled, Pstream::masterNo());
378 Info <<
"Data redistributed" << endl;
386 List<DynamicList<label> > globalCorCellIds;
396 forAll(multipleProcsPoints, iPoint)
398 gPointId = multipleProcsPoints[iPoint];
399 pointId = globalPointProcAddr[gPointId];
400 labelList locFaceIds = cMesh_.pointFaces()[pointId];
403 faceId = locFaceIds[iFace];
404 if (cMesh_.isInternalFace(faceId))
410 bool isProcPatch =
false;
411 fPatchId = cMesh_.boundaryMesh().whichPatch(faceId);
422 if (faceIds.found(faceId))
424 faceIds[faceId].append(pointId);
431 List<label>(1, pointId)
454 List<label> pIds = iter();
458 lPointId = pIds[iPoint];
459 gPointId = localPointProcAddr[lPointId];
464 gCellId = pCells[iCell];
468 bool cornerProcess =
true;
469 if (Pstream::myProcNo() == procId)
471 cornerProcess =
false;
473 patchId = cMesh_.boundaryMesh().whichPatch(iter.key());
476 cornerProcess =
false;
481 fCells.insert(gCellId);
482 if (neigProcFaces.found(procId))
484 neigProcFaces[procId].insert(iter.key());
489 neigProcFaces[procId].insert(iter.key());
505 corAddr_.resize(neigProcFaces.toc().size());
506 globalCorCellIds.resize(
corAddr_.size());
516 forAll(faceIds.toc(), iFaceId)
520 faceIds.toc()[iFaceId],
529 globalCorProcIds.insert(iter.key(),iNeiProc);
531 List<label> procFaceIds = iter().toc();
533 forAll(procFaceIds, iFace)
535 faceId = procFaceIds[iFace];
536 patchId= cMesh_.boundaryMesh().whichPatch(faceId);
538 faceNo = cMesh_.boundaryMesh()[patchId].whichFace(faceId);
540 List<label> cellIds = faceNeigCells[faceId];
544 gCellId = cellIds[iCell];
548 globalCorCellIds[iNeiProc].append(gCellId);
577 label
id = globalCorProcIds[procId];
579 OPstream oStream (Pstream::commsTypes::scheduled, procId);
580 oStream << globalCorCellIds[id];
591 IPstream iStream (Pstream::commsTypes::scheduled, procId);
592 List<label> neiGlobalCellIds (iStream);
600 corCellIds_[iCorProc].resize(neiGlobalCellIds.size());
602 forAll(neiGlobalCellIds, iCell)
605 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_