50 Info<<
"\nCalculating original mesh data" <<
endl;
56 const labelList& neighbour = faceNeighbour();
61 Info<<
"\nDistributing cells to processors" <<
endl;
67 forAll (cellToProc_, celli)
69 if (cellToProc_[celli] >= nProcs_)
72 <<
"Impossible processor label " << cellToProc_[celli]
73 <<
"for cell " << celli
78 procCellList[cellToProc_[celli]].append(celli);
83 forAll (procCellList, procI)
85 procCellAddressing_[procI] = procCellList[procI];
89 Info <<
"\nDistributing faces to processors" <<
endl;
102 if (cellToProc_[owner[facei]] == cellToProc_[neighbour[facei]])
105 procFaceList[cellToProc_[owner[facei]]].append(facei);
121 if (cellToProc_[owner[facei]] != cellToProc_[neighbour[facei]])
127 label ownerProc = cellToProc_[owner[facei]];
128 label neighbourProc = cellToProc_[neighbour[facei]];
131 interProcBoundaries[ownerProc].
begin();
134 interProcBFaces[ownerProc].
begin();
136 bool interProcBouFound =
false;
143 curInterProcBdrsOwnIter
144 != interProcBoundaries[ownerProc].
end()
145 && curInterProcBFacesOwnIter
146 != interProcBFaces[ownerProc].
end();
147 ++curInterProcBdrsOwnIter, ++curInterProcBFacesOwnIter
150 if (curInterProcBdrsOwnIter() == neighbourProc)
153 interProcBouFound =
true;
155 curInterProcBFacesOwnIter().
append(facei);
158 interProcBoundaries[neighbourProc].
begin();
161 curInterProcBFacesNeiIter =
162 interProcBFaces[neighbourProc].
begin();
164 bool neighbourFound =
false;
171 curInterProcBdrsNeiIter !=
172 interProcBoundaries[neighbourProc].
end()
173 && curInterProcBFacesNeiIter !=
174 interProcBFaces[neighbourProc].
end();
175 ++curInterProcBdrsNeiIter,
176 ++curInterProcBFacesNeiIter
179 if (curInterProcBdrsNeiIter() == ownerProc)
182 neighbourFound =
true;
184 curInterProcBFacesNeiIter().
append(facei);
187 if (neighbourFound)
break;
190 if (interProcBouFound && !neighbourFound)
193 <<
"Inconsistency in inter - "
194 <<
"processor boundary lists for processors "
195 << ownerProc <<
" and " << neighbourProc
200 if (interProcBouFound)
break;
203 if (!interProcBouFound)
211 interProcBoundaries[ownerProc].append(neighbourProc);
215 interProcBoundaries[neighbourProc].append(ownerProc);
227 forAll (procPatchSize_, procI)
229 procPatchSize_[procI].setSize(patches.
size());
230 procPatchStartIndex_[procI].setSize(patches.
size());
236 forAll (procPatchSize_, procI)
238 procPatchSize_[procI][
patchi] = 0;
239 procPatchStartIndex_[procI][
patchi] =
240 procFaceList[procI].size();
243 const label patchStart = patches[
patchi].start();
245 if (!isA<cyclicPolyPatch>(patches[
patchi]))
251 patches[
patchi].faceCells();
253 forAll (patchFaceCells, facei)
255 const label curProc = cellToProc_[patchFaceCells[facei]];
258 procFaceList[curProc].append(patchStart + facei);
261 procPatchSize_[curProc][
patchi]++;
270 const label cycOffset = cPatch.size()/2;
286 forAll (firstFaceCells, facei)
290 cellToProc_[firstFaceCells[facei]]
291 != cellToProc_[secondFaceCells[facei]]
300 cyclicParallel_ =
true;
302 label ownerProc = cellToProc_[firstFaceCells[facei]];
303 label neighbourProc =
304 cellToProc_[secondFaceCells[facei]];
307 interProcBoundaries[ownerProc].
begin();
310 curInterProcBFacesOwnIter =
311 interProcBFaces[ownerProc].
begin();
313 bool interProcBouFound =
false;
320 curInterProcBdrsOwnIter !=
321 interProcBoundaries[ownerProc].
end()
322 && curInterProcBFacesOwnIter !=
323 interProcBFaces[ownerProc].
end();
324 ++curInterProcBdrsOwnIter,
325 ++curInterProcBFacesOwnIter
328 if (curInterProcBdrsOwnIter() == neighbourProc)
332 interProcBouFound =
true;
334 curInterProcBFacesOwnIter().
append
335 (patchStart + facei);
338 = interProcBoundaries[neighbourProc].
begin();
341 curInterProcBFacesNeiIter =
342 interProcBFaces[neighbourProc].
begin();
344 bool neighbourFound =
false;
351 curInterProcBdrsNeiIter
352 != interProcBoundaries[neighbourProc].
end()
353 && curInterProcBFacesNeiIter
354 != interProcBFaces[neighbourProc].
end();
355 ++curInterProcBdrsNeiIter,
356 ++curInterProcBFacesNeiIter
359 if (curInterProcBdrsNeiIter() == ownerProc)
362 neighbourFound =
true;
364 curInterProcBFacesNeiIter()
373 if (neighbourFound)
break;
376 if (interProcBouFound && !neighbourFound)
380 "domainDecomposition::decomposeMesh()"
381 ) <<
"Inconsistency in inter-processor "
382 <<
"boundary lists for processors "
383 << ownerProc <<
" and " << neighbourProc
384 <<
" in cyclic boundary matching"
389 if (interProcBouFound)
break;
392 if (!interProcBouFound)
400 interProcBoundaries[ownerProc]
401 .append(neighbourProc);
402 interProcBFaces[ownerProc]
406 interProcBoundaries[neighbourProc]
408 interProcBFaces[neighbourProc]
423 label ownerProc = cellToProc_[firstFaceCells[facei]];
426 procFaceList[ownerProc].append(patchStart + facei);
429 procPatchSize_[ownerProc][
patchi]++;
441 forAll (secondFaceCells, facei)
445 cellToProc_[firstFaceCells[facei]]
446 == cellToProc_[secondFaceCells[facei]]
450 label ownerProc = cellToProc_[firstFaceCells[facei]];
453 procFaceList[ownerProc].append
454 (patchStart + cycOffset + facei);
457 procPatchSize_[ownerProc][
patchi]++;
465 forAll (procFaceList, procI)
471 labelList& curProcFaceAddressing = procFaceAddressing_[procI];
474 procNeighbourProcessors_[procI];
477 procProcessorPatchSize_[procI];
479 labelList& curProcProcessorPatchStartIndex =
480 procProcessorPatchStartIndex_[procI];
483 label nFacesOnProcessor = curProcFaces.
size();
488 interProcBFaces[procI].begin();
489 curInterProcBFacesIter != interProcBFaces[procI].
end();
490 ++curInterProcBFacesIter
493 nFacesOnProcessor += curInterProcBFacesIter().size();
496 curProcFaceAddressing.
setSize(nFacesOnProcessor);
512 curProcFacesIter != curProcFaces.
end();
516 curProcFaceAddressing[nFaces] = curProcFacesIter() + 1;
523 curProcNeighbourProcessors.
setSize
525 interProcBoundaries[procI].size()
528 curProcProcessorPatchSize.
setSize
530 interProcBoundaries[procI].size()
533 curProcProcessorPatchStartIndex.
setSize
535 interProcBoundaries[procI].size()
538 label nProcPatches = 0;
541 interProcBoundaries[procI].
begin();
544 interProcBFaces[procI].
begin();
549 curInterProcBdrsIter != interProcBoundaries[procI].
end()
550 && curInterProcBFacesIter != interProcBFaces[procI].
end();
551 ++curInterProcBdrsIter, ++curInterProcBFacesIter
554 curProcNeighbourProcessors[nProcPatches] =
555 curInterProcBdrsIter();
558 curProcProcessorPatchStartIndex[nProcPatches] = nFaces;
561 curProcProcessorPatchSize[nProcPatches];
570 curInterProcBFacesIter().begin();
571 curFacesIter != curInterProcBFacesIter().
end();
579 if (cellToProc_[owner[curFacesIter()]] == procI)
581 curProcFaceAddressing[nFaces] = curFacesIter() + 1;
586 curProcFaceAddressing[nFaces] = -(curFacesIter() + 1);
600 Info <<
"\nCalculating processor boundary addressing" <<
endl;
606 forAll (procPatchSize_, procI)
609 const labelList oldPatchSizes = procPatchSize_[procI];
611 const labelList oldPatchStarts = procPatchStartIndex_[procI];
613 labelList& curPatchSizes = procPatchSize_[procI];
615 labelList& curPatchStarts = procPatchStartIndex_[procI];
617 const labelList& curProcessorPatchSizes =
618 procProcessorPatchSize_[procI];
620 labelList& curBoundaryAddressing = procBoundaryAddressing_[procI];
625 + curProcessorPatchSizes.
size()
630 forAll (oldPatchSizes, patchi)
632 if (!filterEmptyPatches || oldPatchSizes[patchi] > 0)
645 curPatchSizes.
setSize(nPatches);
646 curPatchStarts.
setSize(nPatches);
648 forAll (curProcessorPatchSizes, procPatchI)
650 curBoundaryAddressing[
nPatches] = -1;
655 curBoundaryAddressing.
setSize(nPatches);
658 Info <<
"\nDistributing points to processors" <<
endl;
664 forAll (procPointAddressing_, procI)
669 const labelList& procFaceLabels = procFaceAddressing_[procI];
671 forAll (procFaceLabels, facei)
674 const labelList& facePoints = fcs[
mag(procFaceLabels[facei]) - 1];
676 forAll (facePoints, pointi)
684 labelList& procPointLabels = procPointAddressing_[procI];
688 label nUsedPoints = 0;
694 procPointLabels[nUsedPoints] = pointi;
701 procPointLabels.
setSize(nUsedPoints);
721 for (label procI = 0; procI < nProcs_; procI++)
724 const labelList& curFaceLabels = procFaceAddressing_[procI];
727 const labelList& curProcessorPatchStarts =
728 procProcessorPatchStartIndex_[procI];
730 const labelList& curProcessorPatchSizes =
731 procProcessorPatchSize_[procI];
736 forAll (curProcessorPatchStarts, patchi)
738 const label curStart = curProcessorPatchStarts[
patchi];
739 const label curEnd = curStart + curProcessorPatchSizes[
patchi];
743 label facei = curStart;
751 const label curF =
mag(curFaceLabels[facei]) - 1;
753 const face&
f = fcs[curF];
757 if (pointsUsage[f[pointi]] == 0)
760 pointsUsage[f[pointi]] = patchi + 1;
762 else if (pointsUsage[f[pointi]] != patchi + 1)
765 gSharedPoints.insert(f[pointi]);
773 globallySharedPoints_ = gSharedPoints.toc();
774 sort(globallySharedPoints_);