43 template<
class ConnectionListListType>
46 const ConnectionListListType& cellCellAddressing
51 const label nOldCells(cellCellAddressing.size());
54 bitSet unvisited(nOldCells,
true);
75 label cellInOrder = 0;
83 for (
const label celli : unvisited)
85 const label nbrCount = cellCellAddressing[celli].size();
87 if (minCount > nbrCount)
102 queuedCells.push_back(currCelli);
109 while (!queuedCells.empty())
112 currCelli = queuedCells.front();
113 queuedCells.pop_front();
115 if (unvisited.test(currCelli))
118 unvisited.unset(currCelli);
121 newOrder[cellInOrder] = currCelli;
131 const auto& neighbours = cellCellAddressing[currCelli];
133 for (
const label nbr : neighbours)
135 const label nbrCount = cellCellAddressing[nbr].size();
137 if (unvisited.test(nbr))
152 for (
const label nbrIdx : nbrOrder)
154 queuedCells.push_back(nbrCells[nbrIdx]);
176 const label nOldCells =
max(0, (offsets.
size()-1));
180 for (label celli = 0; celli < nOldCells; ++celli)
182 const label beg = offsets[celli];
183 const label
end = offsets[celli+1];
185 for (label idx = beg; idx <
end; ++idx)
188 ++numNbrs[cellCells[idx]];
194 bitSet unvisited(nOldCells,
true);
216 label cellInOrder = 0;
221 label currCelli = -1;
224 for (
const label celli : unvisited)
226 const label nbrCount = numNbrs[celli];
228 if (minCount > nbrCount)
255 while (!queuedCells.empty())
258 currCelli = queuedCells.front();
259 queuedCells.pop_front();
261 if (unvisited.test(currCelli))
264 unvisited.unset(currCelli);
267 newOrder[cellInOrder] = currCelli;
276 const label beg = offsets[currCelli];
277 const label
end = offsets[currCelli+1];
279 for (label idx = beg; idx <
end; ++idx)
281 const label nbr = cellCells[idx];
282 const label nbrCount = numNbrs[nbr];
284 if (unvisited.test(nbr))
299 for (
const label nbrIdx : nbrOrder)
301 queuedCells.push_back(nbrCells[nbrIdx]);
320 return cuthill_mckee_algorithm(cellCellAddressing);
329 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.
void push_back(const T &val)
Append an element at the end of the list.
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 unstructured matrix 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...
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
static constexpr const zero Zero
Global zero (0)