54 label pointi = zoneElems[i];
56 if (elementToZone[pointi] == -1)
59 elementToZone[pointi] = zoneI;
61 else if (elementToZone[pointi] >= 0)
64 elementToZone[pointi] = -2;
80 facesInstancePointsPtr_
82 pointsInstance() != facesInstance()
98 decompDictFile_(decompDictFile),
107 ).
lookup(
"numberOfSubdomains")
111 cellToProc_(nCells()),
112 procPointAddressing_(nProcs_),
113 procFaceAddressing_(nProcs_),
114 procCellAddressing_(nProcs_),
115 procPatchSize_(nProcs_),
116 procPatchStartIndex_(nProcs_),
117 procNeighbourProcessors_(nProcs_),
118 procProcessorPatchSize_(nProcs_),
119 procProcessorPatchStartIndex_(nProcs_),
120 procProcessorPatchSubPatchIDs_(nProcs_),
121 procProcessorPatchSubPatchStarts_(nProcs_)
127 ).readIfPresent(
"distributed", distributed_);
141 Info<<
"\nConstructing processor meshes" <<
endl;
154 forAll(pointZones(), zoneI)
156 mark(pointZones()[zoneI], zoneI, pointToZone);
160 labelList faceToZone(faces().size(), -1);
162 forAll(faceZones(), zoneI)
164 mark(faceZones()[zoneI], zoneI, faceToZone);
170 forAll(cellZones(), zoneI)
172 mark(cellZones()[zoneI], zoneI, cellToZone);
182 IOobjectList objects(*
this, facesInstance(),
"polyMesh/sets");
224 label maxProcCells = 0;
225 label totProcFaces = 0;
226 label maxProcPatches = 0;
227 label totProcPatches = 0;
228 label maxProcFaces = 0;
232 for (
label procI = 0; procI < nProcs_; procI++)
235 const labelList& curPointLabels = procPointAddressing_[procI];
243 forAll(curPointLabels, pointi)
245 procPoints[pointi] = meshPoints[curPointLabels[pointi]];
247 pointLookup[curPointLabels[pointi]] = pointi;
251 const labelList& curFaceLabels = procFaceAddressing_[procI];
253 const faceList& meshFaces = faces();
259 forAll(curFaceLabels, facei)
264 label curF =
mag(curFaceLabels[facei]) - 1;
266 faceLookup[curF] = facei;
271 if (curFaceLabels[facei] >= 0)
274 origFaceLabels = meshFaces[curF];
278 origFaceLabels = meshFaces[curF].reverseFace();
282 face& procFaceLabels = procFaces[facei];
286 forAll(origFaceLabels, pointi)
288 procFaceLabels[pointi] = pointLookup[origFaceLabels[pointi]];
293 const labelList& curCellLabels = procCellAddressing_[procI];
299 forAll(curCellLabels, celli)
301 const labelList& origCellLabels = meshCells[curCellLabels[celli]];
303 cell& curCell = procCells[celli];
307 forAll(origCellLabels, cellFaceI)
309 curCell[cellFaceI] = faceLookup[origCellLabels[cellFaceI]];
321 mkDir(time().rootPath()/processorCasePath);
346 if (facesInstancePointsPtr_.valid())
351 facesInstancePointsPtr_(),
393 const labelList& curPatchSizes = procPatchSize_[procI];
395 const labelList& curPatchStarts = procPatchStartIndex_[procI];
397 const labelList& curNeighbourProcessors =
398 procNeighbourProcessors_[procI];
400 const labelList& curProcessorPatchSizes =
401 procProcessorPatchSize_[procI];
403 const labelList& curProcessorPatchStarts =
404 procProcessorPatchStartIndex_[procI];
407 procProcessorPatchSubPatchIDs_[procI];
410 procProcessorPatchSubPatchStarts_[procI];
416 label nInterProcPatches = 0;
417 forAll(curSubPatchIDs, procPatchI)
430 nInterProcPatches += curSubPatchIDs[procPatchI].
size();
476 forAll(curProcessorPatchSizes, procPatchI)
478 const labelList& subPatchID = curSubPatchIDs[procPatchI];
479 const labelList& subStarts = curSubStarts[procPatchI];
481 label curStart = curProcessorPatchStarts[procPatchI];
487 i < subPatchID.
size()-1
488 ? subStarts[i+1] - subStarts[i]
489 : curProcessorPatchSizes[procPatchI] - subStarts[i]
499 if (subPatchID[i] == -1)
507 +
Foam::name(curNeighbourProcessors[procPatchI]),
513 curNeighbourProcessors[procPatchI]
519 = refCast<const coupledPolyPatch>
525 const word& referPatch = pcPatch.
name();
532 +
Foam::name(curNeighbourProcessors[procPatchI])
540 curNeighbourProcessors[procPatchI],
579 zonePoints[zoneI].setCapacity(pz[zoneI].size() / nProcs_);
584 forAll(curPointLabels, pointi)
586 label curPoint = curPointLabels[pointi];
588 label zoneI = pointToZone[curPoint];
593 zonePoints[zoneI].
append(pointi);
595 else if (zoneI == -2)
600 label index = pz[zoneI].whichPoint(curPoint);
604 zonePoints[zoneI].
append(pointi);
621 zonePoints[zoneI].shrink()
646 label procSize = fz[zoneI].size() / nProcs_;
648 zoneFaces[zoneI].setCapacity(procSize);
649 zoneFaceFlips[zoneI].setCapacity(procSize);
655 forAll(curFaceLabels, facei)
659 label curF =
mag(curFaceLabels[facei]) - 1;
661 label zoneI = faceToZone[curF];
666 zoneFaces[zoneI].
append(facei);
668 label index = fz[zoneI].whichFace(curF);
670 bool flip = fz[zoneI].flipMap()[index];
672 if (curFaceLabels[facei] < 0)
677 zoneFaceFlips[zoneI].
append(flip);
679 else if (zoneI == -2)
684 label index = fz[zoneI].whichFace(curF);
688 zoneFaces[zoneI].
append(facei);
690 bool flip = fz[zoneI].flipMap()[index];
692 if (curFaceLabels[facei] < 0)
697 zoneFaceFlips[zoneI].
append(flip);
712 zoneFaces[zoneI].shrink(),
713 zoneFaceFlips[zoneI].shrink(),
739 zoneCells[zoneI].setCapacity(cz[zoneI].size() / nProcs_);
742 forAll(curCellLabels, celli)
744 label curCellI = curCellLabels[celli];
746 label zoneI = cellToZone[curCellI];
751 zoneCells[zoneI].
append(celli);
753 else if (zoneI == -2)
758 label index = cz[zoneI].whichCell(curCellI);
762 zoneCells[zoneI].
append(celli);
777 zoneCells[zoneI].shrink(),
797 if (facesInstancePointsPtr_.valid())
813 pointsInstancePoints.
write();
826 if (cs.
found(curCellLabels[i]))
839 if (cs.
found(
mag(curFaceLabels[i])-1))
852 if (cs.
found(curPointLabels[i]))
876 procCellAddressing_[procI],
877 procPointAddressing_[procI]
884 <<
"Processor " << procI <<
nl
885 <<
" Number of cells = " << procMesh.
nCells()
888 maxProcCells =
max(maxProcCells, procMesh.
nCells());
890 label nBoundaryFaces = 0;
891 label nProcPatches = 0;
892 label nProcFaces = 0;
899 refCast<const processorPolyPatch>
904 Info<<
" Number of faces shared with processor "
908 nProcFaces += ppp.size();
916 Info<<
" Number of processor patches = " << nProcPatches <<
nl
917 <<
" Number of processor faces = " << nProcFaces <<
nl
918 <<
" Number of boundary faces = " << nBoundaryFaces <<
endl;
920 totProcFaces += nProcFaces;
921 totProcPatches += nProcPatches;
922 maxProcPatches =
max(maxProcPatches, nProcPatches);
923 maxProcFaces =
max(maxProcFaces, nProcFaces);
930 "pointProcAddressing",
937 procPointAddressing_[procI]
939 pointProcAddressing.
write();
945 "faceProcAddressing",
952 procFaceAddressing_[procI]
960 "cellProcAddressing",
967 procCellAddressing_[procI]
969 cellProcAddressing.
write();
973 label nMeshPatches = curPatchSizes.
size();
975 procBoundaryAddressing.
setSize(nMeshPatches+nProcPatches, -1);
981 "boundaryProcAddressing",
988 procBoundaryAddressing
990 boundaryProcAddressing.
write();
993 scalar avgProcCells = scalar(nCells())/nProcs_;
994 scalar avgProcPatches = scalar(totProcPatches)/nProcs_;
995 scalar avgProcFaces = scalar(totProcFaces)/nProcs_;
998 if (totProcPatches == 0)
1002 if (totProcFaces == 0)
1008 <<
"Number of processor faces = " << totProcFaces/2 <<
nl
1009 <<
"Max number of cells = " << maxProcCells
1010 <<
" (" << 100.0*(maxProcCells-avgProcCells)/avgProcCells
1011 <<
"% above average " << avgProcCells <<
")" <<
nl
1012 <<
"Max number of processor patches = " << maxProcPatches
1013 <<
" (" << 100.0*(maxProcPatches-avgProcPatches)/avgProcPatches
1014 <<
"% above average " << avgProcPatches <<
")" <<
nl
1015 <<
"Max number of faces between processors = " << maxProcFaces
1016 <<
" (" << 100.0*(maxProcFaces-avgProcFaces)/avgProcFaces
1017 <<
"% above average " << avgProcFaces <<
")" <<
nl