69 bool Foam::localPointRegion::isDuplicate
76 if (f0.size() != f1.size())
81 label fp1 = f1.find(f0[0]);
90 if (f0[fp0] != f1[fp1])
97 fp1 = f1.fcIndex(fp1);
101 fp1 = f1.rcIndex(fp1);
109 void Foam::localPointRegion::countPointRegions
111 const polyMesh&
mesh,
113 const Map<label>& candidateFace,
121 meshPointMap_.
resize(candidateFace.size()/100);
123 DynamicList<labelList> pointRegions(meshPointMap_.size());
126 meshFaceMap_.resize(meshPointMap_.size());
130 const label facei = iter.key();
136 if (minRegion[facei].empty())
139 <<
"Face from candidateFace without minRegion set." <<
endl
146 const label pointi =
f[fp];
151 if (candidatePoint[pointi])
153 const label region = minRegion[facei][fp];
155 if (minPointRegion[pointi] == -1)
157 minPointRegion[pointi] = region;
159 else if (minPointRegion[pointi] != region)
162 const auto iter = meshPointMap_.cfind(pointi);
165 labelList& regions = pointRegions[iter.val()];
166 if (!regions.found(region))
168 label sz = regions.size();
170 regions[sz] = region;
175 label localPointi = meshPointMap_.size();
176 meshPointMap_.insert(pointi, localPointi);
178 regions[0] = minPointRegion[pointi];
180 pointRegions.append(regions);
183 label meshFaceMapI = meshFaceMap_.size();
184 meshFaceMap_.insert(facei, meshFaceMapI);
190 minPointRegion.clear();
196 const label facei = iter.key();
206 if (candidatePoint[
f[fp]] && meshPointMap_.found(
f[fp]))
208 const label meshFaceMapI = meshFaceMap_.size();
209 meshFaceMap_.insert(facei, meshFaceMapI);
217 pointRegions.shrink();
218 pointRegions_.setSize(pointRegions.size());
221 pointRegions_[i].transfer(pointRegions[i]);
225 faceRegions_.setSize(meshFaceMap_.size());
228 faceRegions_[iter()].labelList::transfer(minRegion[iter.key()]);
250 void Foam::localPointRegion::calcPointRegions
252 const polyMesh&
mesh,
274 Map<label> candidateFace(2*nBnd);
275 label candidateFacei = 0;
277 Map<label> candidateCell(nBnd);
278 label candidateCelli = 0;
286 if (candidatePoint[
f[fp]])
289 if (candidateFace.insert(facei, candidateFacei))
295 if (candidateCell.insert(faceOwner[facei], candidateCelli))
302 label nei = faceNeighbour[facei];
303 if (candidateCell.insert(nei, candidateCelli))
327 label facei = iter.key();
332 label globOwn = globalCells.toGlobal(faceOwner[facei]);
333 label globNei = globalCells.toGlobal(faceNeighbour[facei]);
334 minRegion[facei].
setSize(
f.size(),
min(globOwn, globNei));
338 label globOwn = globalCells.toGlobal(faceOwner[facei]);
339 minRegion[facei].setSize(
f.size(), globOwn);
352 Map<label> minPointValue(128);
356 minPointValue.clear();
358 label celli = iter.key();
359 const cell& cFaces =
mesh.
cells()[celli];
364 label facei = cFaces[cFacei];
366 if (minRegion[facei].size())
372 const label pointi =
f[fp];
373 auto iter = minPointValue.find(pointi);
375 if (iter == minPointValue.end())
377 minPointValue.insert(pointi, minRegion[facei][fp]);
381 label currentMin = iter();
382 iter() =
min(currentMin, minRegion[facei][fp]);
391 label facei = cFaces[cFacei];
393 if (minRegion[facei].size())
399 label minVal = minPointValue[
f[fp]];
401 if (minVal != minRegion[facei][fp])
403 minRegion[facei][fp] = minVal;
437 label f0 = baffles[i].first();
438 label f1 = baffles[i].second();
439 minEqOpFace()(minRegion[f0], minRegion[f1]);
440 minRegion[f1] = minRegion[f0];
446 countPointRegions(
mesh, candidatePoint, candidateFace, minRegion);
477 if (!
patches[patchi].coupled())
506 forAll(candidatePoints, i)
508 candidatePoint[candidatePoints[i]] =
true;
530 forAll(candidatePoints, i)
532 candidatePoint[candidatePoints[i]] =
true;
535 calcPointRegions(
mesh, baffles, candidatePoint);
556 labelList duplicateFace(allPatch.size(), -1);
557 label nDuplicateFaces = 0;
562 const face&
f = allPatch.localFaces()[bFacei];
570 label otherFacei =
pFaces[i];
572 if (otherFacei > bFacei)
574 const face& otherF = allPatch.localFaces()[otherFacei];
576 if (isDuplicate(
f, otherF,
true))
580 <<
" has local points:" <<
f <<
" at:"
582 <<
" which are in same order as face:"
584 <<
" with local points:" << otherF
587 else if (isDuplicate(
f, otherF,
false))
594 duplicateFace[bFacei] != -1
595 || duplicateFace[otherFacei] != -1
599 <<
"One of two duplicate faces already marked"
600 <<
" as duplicate." <<
nl
601 <<
"This means that three or more faces share"
602 <<
" the same points and this is illegal." <<
nl
603 <<
"Face:" << meshFace0
604 <<
" with local points:" <<
f <<
" at:"
606 <<
" which are in same order as face:"
608 <<
" with local points:" << otherF
612 duplicateFace[bFacei] = otherFacei;
613 duplicateFace[otherFacei] = bFacei;
620 return duplicateFace;
638 const labelList duplicateFace(findDuplicateFaces(
mesh, testFaces));
645 label otherFacei = duplicateFace[i];
647 if (otherFacei != -1 && i < otherFacei)
649 label meshFace0 = testFaces[i];
651 label meshFace1 = testFaces[otherFacei];
657 (patch0 != -1 && isA<processorPolyPatch>(
patches[patch0]))
658 || (patch1 != -1 && isA<processorPolyPatch>(
patches[patch1]))
662 <<
"One of two duplicate faces is on"
663 <<
" processorPolyPatch."
664 <<
"This is not allowed." <<
nl
665 <<
"Face:" << meshFace0
669 <<
"Face:" << meshFace1
680 return baffles.shrink();
695 newMap.insert(newFacei, iter.val());