38 void domainDecomposition::mark
47 label pointi = zoneElems[i];
49 if (elementToZone[pointi] == -1)
52 elementToZone[pointi] = zoneI;
54 else if (elementToZone[pointi] >= 0)
57 elementToZone[pointi] = -2;
80 nProcs_(
readInt(decompositionDict_.lookup(
"numberOfSubdomains"))),
82 cellToProc_(nCells()),
83 procPointAddressing_(nProcs_),
84 procFaceAddressing_(nProcs_),
85 procCellAddressing_(nProcs_),
86 procBoundaryAddressing_(nProcs_),
87 procPatchSize_(nProcs_),
88 procPatchStartIndex_(nProcs_),
89 procNeighbourProcessors_(nProcs_),
90 procProcessorPatchSize_(nProcs_),
91 procProcessorPatchStartIndex_(nProcs_),
92 globallySharedPoints_(0),
93 cyclicParallel_(false)
95 if (decompositionDict_.found(
"distributed"))
97 Switch distributed(decompositionDict_.lookup(
"distributed"));
98 distributed_ = distributed;
113 Info<<
"\nConstructing processor meshes" <<
endl;
116 Map<label> sharedPointLookup(2*globallySharedPoints_.size());
118 forAll (globallySharedPoints_, pointi)
120 sharedPointLookup.insert(globallySharedPoints_[pointi], pointi);
135 forAll(pointZones(), zoneI)
137 mark(pointZones()[zoneI], zoneI, pointToZone);
141 labelList faceToZone(faces().size(), -1);
143 forAll(faceZones(), zoneI)
145 mark(faceZones()[zoneI], zoneI, faceToZone);
151 forAll(cellZones(), zoneI)
153 mark(cellZones()[zoneI], zoneI, cellToZone);
157 label totProcFaces = 0;
158 label maxProcPatches = 0;
159 label maxProcFaces = 0;
163 for (label procI = 0; procI < nProcs_; procI++)
166 const labelList& curPointLabels = procPointAddressing_[procI];
174 forAll (curPointLabels, pointi)
176 procPoints[pointi] = meshPoints[curPointLabels[pointi]];
178 pointLookup[curPointLabels[pointi]] = pointi;
182 const labelList& curFaceLabels = procFaceAddressing_[procI];
184 const faceList& meshFaces = faces();
190 forAll (curFaceLabels, facei)
195 label curF =
mag(curFaceLabels[facei]) - 1;
197 faceLookup[curF] = facei;
202 if (curFaceLabels[facei] >= 0)
205 origFaceLabels = meshFaces[curF];
209 origFaceLabels = meshFaces[curF].reverseFace();
213 face& procFaceLabels = procFaces[facei];
217 forAll (origFaceLabels, pointi)
219 procFaceLabels[pointi] = pointLookup[origFaceLabels[pointi]];
224 const labelList& curCellLabels = procCellAddressing_[procI];
230 forAll (curCellLabels, celli)
232 const labelList& origCellLabels = meshCells[curCellLabels[celli]];
234 cell& curCell = procCells[celli];
238 forAll (origCellLabels, cellFaceI)
240 curCell[cellFaceI] = faceLookup[origCellLabels[cellFaceI]];
252 mkDir(time().rootPath()/processorCasePath);
279 const labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
281 const labelList& curPatchSizes = procPatchSize_[procI];
283 const labelList& curPatchStarts = procPatchStartIndex_[procI];
285 const labelList& curNeighbourProcessors =
286 procNeighbourProcessors_[procI];
288 const labelList& curProcessorPatchSizes =
289 procProcessorPatchSize_[procI];
291 const labelList& curProcessorPatchStarts =
292 procProcessorPatchStartIndex_[procI];
299 + curProcessorPatchSizes.
size(),
308 meshPatches[curBoundaryAddressing[
patchi]].clone
310 procMesh.boundaryMesh(),
319 forAll (curProcessorPatchSizes, procPatchI)
326 +
Foam::name(curNeighbourProcessors[procPatchI]),
327 curProcessorPatchSizes[procPatchI],
328 curProcessorPatchStarts[procPatchI],
330 procMesh.boundaryMesh(),
332 curNeighbourProcessors[procPatchI]
339 procMesh.addPatches(procPatches);
355 zonePoints[zoneI].setCapacity(pz[zoneI].size() / nProcs_);
360 forAll (curPointLabels, pointi)
362 label curPoint = curPointLabels[pointi];
364 label zoneI = pointToZone[curPoint];
369 zonePoints[zoneI].
append(pointi);
371 else if (zoneI == -2)
376 label index = pz[zoneI].whichPoint(curPoint);
380 zonePoints[zoneI].append(pointi);
387 procMesh.pointZones().setSize(zonePoints.size());
390 procMesh.pointZones().set
395 procMesh.pointZones(),
397 zonePoints[zoneI].shrink()
422 label procSize = fz[zoneI].
size() / nProcs_;
424 zoneFaces[zoneI].setCapacity(procSize);
425 zoneFaceFlips[zoneI].setCapacity(procSize);
431 forAll (curFaceLabels, facei)
435 label curF =
mag(curFaceLabels[facei]) - 1;
437 label zoneI = faceToZone[curF];
442 zoneFaces[zoneI].append(facei);
444 label index = fz[zoneI].whichFace(curF);
446 bool flip = fz[zoneI].flipMap()[index];
448 if (curFaceLabels[facei] < 0)
453 zoneFaceFlips[zoneI].append(flip);
455 else if (zoneI == -2)
460 label index = fz[zoneI].whichFace(curF);
464 zoneFaces[zoneI].append(facei);
466 bool flip = fz[zoneI].flipMap()[index];
468 if (curFaceLabels[facei] < 0)
473 zoneFaceFlips[zoneI].append(flip);
480 procMesh.faceZones().setSize(zoneFaces.size());
483 procMesh.faceZones().set
488 zoneFaces[zoneI].shrink(),
489 zoneFaceFlips[zoneI].shrink(),
515 zoneCells[zoneI].setCapacity(cz[zoneI].size() / nProcs_);
518 forAll (curCellLabels, celli)
520 label curCellI = curCellLabels[celli];
522 label zoneI = cellToZone[curCellI];
527 zoneCells[zoneI].append(celli);
529 else if (zoneI == -2)
534 label index = cz[zoneI].whichCell(curCellI);
538 zoneCells[zoneI].append(celli);
545 procMesh.cellZones().setSize(zoneCells.size());
548 procMesh.cellZones().set
553 zoneCells[zoneI].shrink(),
573 <<
"Processor " << procI <<
nl
574 <<
" Number of cells = " << procMesh.nCells()
577 label nBoundaryFaces = 0;
578 label nProcPatches = 0;
579 label nProcFaces = 0;
585 procMesh.boundaryMesh()[
patchi].type()
586 == processorPolyPatch::typeName
590 refCast<const processorPolyPatch>
592 procMesh.boundaryMesh()[
patchi]
595 Info<<
" Number of faces shared with processor "
599 nProcFaces += ppp.size();
607 Info<<
" Number of processor patches = " << nProcPatches <<
nl
608 <<
" Number of processor faces = " << nProcFaces <<
nl
609 <<
" Number of boundary faces = " << nBoundaryFaces <<
endl;
611 totProcFaces += nProcFaces;
612 maxProcPatches =
max(maxProcPatches, nProcPatches);
613 maxProcFaces =
max(maxProcFaces, nProcFaces);
620 "pointProcAddressing",
621 procMesh.facesInstance(),
627 procPointAddressing_[procI]
629 pointProcAddressing.write();
635 "faceProcAddressing",
636 procMesh.facesInstance(),
642 procFaceAddressing_[procI]
644 faceProcAddressing.write();
650 "cellProcAddressing",
651 procMesh.facesInstance(),
657 procCellAddressing_[procI]
659 cellProcAddressing.write();
665 "boundaryProcAddressing",
666 procMesh.facesInstance(),
672 procBoundaryAddressing_[procI]
674 boundaryProcAddressing.write();
678 <<
"Number of processor faces = " << totProcFaces/2 <<
nl
679 <<
"Max number of processor patches = " << maxProcPatches <<
nl
680 <<
"Max number of faces between processors = " << maxProcFaces