45template<
class ConnectionListListType>
48 const ConnectionListListType& cellCellAddressing
53 const label nOldCells(cellCellAddressing.size());
56 bitSet unvisited(nOldCells,
true);
77 label cellInOrder = 0;
85 for (
const label celli : unvisited)
87 const label nbrCount = cellCellAddressing[celli].size();
89 if (minCount > nbrCount)
104 queuedCells.push_back(currCelli);
111 while (!queuedCells.empty())
114 currCelli = queuedCells.front();
115 queuedCells.pop_front();
117 if (unvisited.test(currCelli))
120 unvisited.unset(currCelli);
123 newOrder[cellInOrder] = currCelli;
133 const auto& neighbours = cellCellAddressing[currCelli];
135 for (
const label nbr : neighbours)
137 const label nbrCount = cellCellAddressing[nbr].size();
139 if (unvisited.test(nbr))
154 for (
const label nbrIdx : nbrOrder)
156 queuedCells.push_back(nbrCells[nbrIdx]);
166 Pout<<
"bandCompression: peak-capacity=" << queuedCells.capacity() <<
nl;
189 for (label celli = 0; celli < nOldCells; ++celli)
191 const label beg = offsets[celli];
192 const label
end = offsets[celli+1];
194 for (label idx = beg; idx <
end; ++idx)
197 ++numNbrs[cellCells[idx]];
203 bitSet unvisited(nOldCells,
true);
225 label cellInOrder = 0;
230 label currCelli = -1;
233 for (
const label celli : unvisited)
235 const label nbrCount = numNbrs[celli];
237 if (minCount > nbrCount)
252 queuedCells.push_back(currCelli);
264 while (!queuedCells.empty())
267 currCelli = queuedCells.front();
268 queuedCells.pop_front();
270 if (unvisited.test(currCelli))
273 unvisited.unset(currCelli);
276 newOrder[cellInOrder] = currCelli;
285 const label beg = offsets[currCelli];
286 const label
end = offsets[currCelli+1];
288 for (label idx = beg; idx <
end; ++idx)
290 const label nbr = cellCells[idx];
291 const label nbrCount = numNbrs[nbr];
293 if (unvisited.test(nbr))
308 for (
const label nbrIdx : nbrOrder)
310 queuedCells.push_back(nbrCells[nbrIdx]);
320 Pout<<
"bandCompression: peak-capacity=" << queuedCells.capacity() <<
nl;
336 return cuthill_mckee_algorithm(cellCells);
345 return cuthill_mckee_algorithm(cellCellAddressing);
354 return cuthill_mckee_algorithm(cellCellAddressing);
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
The bandCompression function renumbers the addressing such that the band of the matrix is reduced....
A simple list of objects of type <T> that is intended to be used as a circular buffer (eg,...
void pop_front(label n=1)
Shrink by moving the front of the buffer 1 or more times.
bool empty() const noexcept
Empty or exhausted buffer.
label capacity() const noexcept
Size of the underlying storage.
void push_back(const T &val)
Copy append an element to the end of the buffer.
T & front()
Access the first element (front). Requires !empty().
A packed storage of objects of type <T> using an offset table for access.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
void push_back(const T &val)
Copy append an element to the end of this list.
void size(const label n)
Older name for setAddressableSize.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
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.
Mesh consisting of general polyhedral cells.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).