45 template<
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;
334 globalMeshData::calcCellCells(
mesh, cellCells);
336 return cuthill_mckee_algorithm(cellCells);
345 return cuthill_mckee_algorithm(cellCellAddressing);
354 return cuthill_mckee_algorithm(cellCellAddressing);
void size(const label n)
Older name for setAddressableSize.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
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...
A packed storage of objects of type <T> using an offset table for access.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void push_back(const T &val)
Copy append an element to the end of this list.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
Mesh consisting of general polyhedral cells.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.