47 label nGlobalInsert = 0;
71 for (
const label elem : listA)
73 if (elem != global0 && elem != global1)
90 result[resultI++] = global0;
94 result[resultI++] = global1;
99 for (
const label elem : listB)
101 if (elem != global0 && elem != global1)
103 result[resultI++] = elem;
109 for (
const label elem : listA)
111 if (elem != global0 && elem != global1)
115 result[resultI++] = elem;
120 if (resultI != result.size())
126 listB.transfer(result);
140 if (cCells[i] != globalI)
142 set.insert(cCells[i]);
148 if (pGlobals[i] != globalI)
150 set.insert(pGlobals[i]);
154 cCells.setSize(
set.size()+1);
156 cCells[
n++] = globalI;
158 for (
const label seti :
set)
169 isValidBFace.
setSize(
mesh().nBoundaryFaces(),
true);
173 const polyPatch& pp =
patches[patchi];
175 if (pp.coupled() || isA<emptyPolyPatch>(pp))
180 isValidBFace[bFacei++] =
false;
196 const polyPatch& pp =
patches[patchi];
200 nCoupled += pp.
size();
208 const polyPatch& pp =
patches[patchi];
212 label facei = pp.
start();
216 coupledFaces[nCoupled++] = facei++;
235 const label exclude0,
236 const label exclude1,
247 label facei = faceLabels[i];
249 label globalOwn = globalNumbering().toGlobal(own[facei]);
250 if (globalOwn != exclude0 && globalOwn != exclude1)
252 globals.
insert(globalOwn);
255 if (
mesh().isInternalFace(facei))
257 label globalNei = globalNumbering().toGlobal(nei[facei]);
258 if (globalNei != exclude0 && globalNei != exclude1)
260 globals.
insert(globalNei);
267 if (isValidBFace[bFacei])
269 label globalI = globalNumbering().toGlobal
275 if (globalI != exclude0 && globalI != exclude1)
303 return globals.
toc();
316 const label nBnd = mesh_.nBoundaryFaces();
317 const labelList& own = mesh_.faceOwner();
318 const labelList& nei = mesh_.faceNeighbour();
331 label facei = pp.
start();
335 neiGlobalCellCells[facei-mesh_.nInternalFaces()] =
336 globalCellCells[own[facei]];
355 faceStencil.
setSize(mesh_.nFaces());
359 for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
361 faceStencilSet.
clear();
363 const labelList& ownCCells = globalCellCells[own[facei]];
364 label globalOwn = ownCCells[0];
365 faceStencilSet.insert(ownCCells);
367 const labelList& neiCCells = globalCellCells[nei[facei]];
368 label globalNei = neiCCells[0];
369 faceStencilSet.insert(neiCCells);
372 faceStencil[facei].
setSize(faceStencilSet.size());
374 faceStencil[facei][
n++] = globalOwn;
375 faceStencil[facei][
n++] = globalNei;
376 for (
const label stencili : faceStencilSet)
378 if (stencili != globalOwn && stencili != globalNei)
380 faceStencil[facei][
n++] = stencili;
388 const polyPatch& pp =
patches[patchi];
389 label facei = pp.
start();
395 faceStencilSet.clear();
397 const labelList& ownCCells = globalCellCells[own[facei]];
398 label globalOwn = ownCCells[0];
399 faceStencilSet.insert(ownCCells);
403 neiGlobalCellCells[facei-mesh_.nInternalFaces()];
404 label globalNei = neiCCells[0];
405 faceStencilSet.insert(neiCCells);
408 faceStencil[facei].
setSize(faceStencilSet.size());
410 faceStencil[facei][
n++] = globalOwn;
411 faceStencil[facei][
n++] = globalNei;
412 for (
const label stencili : faceStencilSet)
414 if (stencili != globalOwn && stencili != globalNei)
416 faceStencil[facei][
n++] = stencili;
427 else if (!isA<emptyPolyPatch>(pp))
431 faceStencilSet.clear();
433 const labelList& ownCCells = globalCellCells[own[facei]];
434 label globalOwn = ownCCells[0];
435 faceStencilSet.insert(ownCCells);
438 faceStencil[facei].
setSize(faceStencilSet.size());
440 faceStencil[facei][
n++] = globalOwn;
441 for (
const label stencili : faceStencilSet)
443 if (stencili != globalOwn)
445 faceStencil[facei][
n++] = stencili;
465 globalNumbering_(mesh_.nCells()+mesh_.nBoundaryFaces())
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
cellToFaceStencil(const polyMesh &)
Construct from mesh.
void size(const label n)
Older name for setAddressableSize.
void insertFaceCells(const label exclude0, const label exclude1, const boolList &nonEmptyFace, const labelList &faceLabels, labelHashSet &globals) const
Collect cell neighbours of faces in global numbering.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
label findSortedIndex(const ListType &input, typename ListType::const_reference val, const label start=0)
Binary search to find the index of the last element in a sorted list that is less than value...
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
#define forAll(list, i)
Loop across all elements in list.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
void setSize(const label n)
Alias for resize()
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
void clear()
Clear the list, i.e. set size to zero.
void sort(UList< T > &list)
Sort the list.
void clear()
Clear all entries from table.
label size() const noexcept
The number of elements in the list.
virtual const labelList & faceOwner() const
Return face owner.
label nInternalFaces() const noexcept
Number of internal faces.
errorManip< error > abort(error &err)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
void setSize(const label newLen)
Same as resize()
label start() const
Return start label of this patch in the polyMesh face list.
const polyBoundaryMesh & patches
void calcFaceStencil(const labelListList &globalCellCells, labelListList &faceStencil) const
Collect cell neighbours into extended stencil.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
List< Key > toc() const
The table of contents (the keys) in unsorted order.
List< label > labelList
A List of labels.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A patch is a list of labels that address the faces in the global face list.
void validBoundaryFaces(boolList &isValidBFace) const
Valid boundary faces (not empty and not coupled)
List< bool > boolList
A List of bools.
labelList calcFaceCells(const boolList &nonEmptyFace, const labelList &faceLabels, labelHashSet &globals) const
Collect cell neighbours of faces in global numbering.
static void merge(const label global0, const label global1, const labelList &listA, labelList &listB)
Merge two lists.
autoPtr< indirectPrimitivePatch > allCoupledFacesPatch() const
Return patch of all coupled faces.