44 template<
class AgglomerationType>
48 const AgglomerationType& agglom,
49 const label nLocalCoarse,
68 const label myAgglomOffset = globalAgglom.
localStart(myProci);
72 const label nBoundaryFaces = bndFaceOwner.
size();
74 globalNeighbour.
resize(nBoundaryFaces);
76 for (label bfacei = 0; bfacei < nBoundaryFaces; ++bfacei)
78 label val = agglom[bndFaceOwner[bfacei]];
82 val += myAgglomOffset;
84 globalNeighbour[bfacei] = val;
101 const label own = agglom[faceOwner[facei]];
102 const label nei = agglom[faceNeigh[facei]];
105 if (own < 0 || nei < 0)
continue;
107 ++nFacesPerCell[own];
108 ++nFacesPerCell[nei];
113 if (
pp.coupled() && (parallel || !isA<processorPolyPatch>(
pp)))
117 for (
const label facei :
pp.range())
119 const label own = agglom[faceOwner[facei]];
120 const label globalNei = globalNeighbour[facei-bndOffset];
123 if (own < 0 || globalNei < 0)
continue;
127 !globalAgglom.
isLocal(myProci, globalNei)
128 || globalAgglom.
toLocal(myProci, globalNei) != own
131 ++nFacesPerCell[own];
154 if (cellCellWeightsPtr)
156 cellCellWeightsPtr->
clear();
164 const label own = agglom[faceOwner[facei]];
165 const label nei = agglom[faceNeigh[facei]];
168 if (own < 0 || nei < 0)
continue;
170 const label ownIndex = offsets[own] + nFacesPerCell[own]++;
171 const label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
173 connect[ownIndex] = globalAgglom.
toGlobal(myProci, nei);
174 connect[neiIndex] = globalAgglom.
toGlobal(myProci, own);
176 if (!weights.
empty())
179 weights[neiIndex] = weights[ownIndex];
186 if (
pp.coupled() && (parallel || !isA<processorPolyPatch>(
pp)))
190 for (
const label facei :
pp.range())
192 const label own = agglom[faceOwner[facei]];
193 const label globalNei = globalNeighbour[facei-bndOffset];
196 if (own < 0 || globalNei < 0)
continue;
200 !globalAgglom.
isLocal(myProci, globalNei)
201 || globalAgglom.
toLocal(myProci, globalNei) != own
204 const label ownIndex = offsets[own] + nFacesPerCell[own]++;
206 connect[ownIndex] = globalNei;
208 if (!weights.
empty())
225 if (!cellCells.
empty())
230 label startIndex = offsets[0];
234 const label nCellCells = cellCells.
size();
236 for (label celli = 0; celli < nCellCells; ++celli)
242 const label
self = globalAgglom.
toGlobal(myProci, celli);
247 const label endIndex = offsets[celli+1];
249 for (label i = startIndex; i < endIndex; ++i)
251 if (nbrCells.
insert(connect[i]))
253 connect[newIndex] = connect[i];
255 if (!weights.
empty())
257 weights[newIndex] = weights[i];
263 startIndex = endIndex;
264 offsets[celli+1] = newIndex;
268 if (!weights.
empty())
277 if (cellCellWeightsPtr)
279 cellCellWeightsPtr->offsets() = cellCells.
offsets();
280 cellCellWeightsPtr->values() = std::move(weights);
309 const label nLocalCoarse,
329 const label nLocalCoarse,
370 const bitSet& selectedCells,
382 for (
const label celli : selectedCells)
391 agglom[celli] = celli;
402 for (label& celli : agglom)
406 cellMap[nCompact] = celli;
410 if (nCompact == cellMap.
size())
446 for (
const label celli : selectedCells)
449 if (celli >= 0 && celli < nCells && agglom[celli] < 0)
451 agglom[celli] = celli;
462 for (label& celli : agglom)
466 cellMap[nCompact] = celli;
470 if (nCompact == cellMap.
size())
label toLocal(const label proci, const label i) const
From global to local on proci.
const polyBoundaryMesh & pbm
void size(const label n)
Older name for setAddressableSize.
const labelList & offsets() const noexcept
Return the offset table (= size()+1)
bool empty() const noexcept
True if the number of rows/sublists is zero.
label size() const noexcept
The primary size (the number of rows/sublists)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void resize(const label len)
Adjust allocated size of list.
virtual const labelList & faceNeighbour() const
Return face neighbour.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
bool parallel() const noexcept
Does the mesh contain processor patches? (also valid when not running parallel)
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Can be negative if the process i...
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
A List obtained as a section of another List.
void clear()
Clear the list, i.e. set size to zero.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
void clear()
Remove all entries from table.
virtual const labelList & faceOwner() const
Return face owner.
label nInternalFaces() const noexcept
Number of internal faces.
bool isLocal(const label proci, const label i) const
Is on processor proci.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
A packed storage of objects of type <T> using an offset table for access.
A functor that returns its argument unchanged (cf. C++20 std::identity) Should never be specialized...
label totalSize() const noexcept
The total addressed size, which corresponds to the end (back) offset and also the sum of all localSiz...
label toGlobal(const label proci, const label i) const
From local to global on proci.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
label nCells() const noexcept
Number of mesh cells.
const vectorField & faceAreas() const
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
label localStart(const label proci) const
Start of proci data.
const List< T > & values() const noexcept
Return the packed values.
void resize_nocopy(const label mRows, const label nVals)
Redimension without preserving existing content.
Mesh consisting of general polyhedral cells.
static void calcCellCells(const polyMesh &mesh, const labelUList &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells)
Determine (local or global) cellCells from mesh agglomeration.
static void calcCellCellsImpl(const polyMesh &mesh, const AgglomerationType &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells, CompactListList< scalar > *cellCellWeightsPtr=nullptr)
A patch is a list of labels that address the faces in the global face list.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyMesh & mesh() const noexcept
Return the mesh reference.
const labelList::subList faceOwner() const
Return face owner for the entire boundary.