|
| | NNCellBudget (const int a_uniform) noexcept |
| | Construct a uniform budget. Deliberately implicit – a bare count is the common case.
|
| |
| void | reserveOne (const int a_level, const IntVect &a_cell) |
| | Reserve one slot in a cell, lowering that cell's budget by one.
|
| |
| void | reserveOne (const int a_level, const RealVect &a_position, const RealVect &a_probLo, const RealVect &a_dx) |
| | Reserve one slot in the cell a position falls in.
|
| |
| int | operator() (const detail::NNCellKey &a_key) const noexcept |
| | The budget for one cell: the uniform count less that cell's reservations, floored at 0.
|
| |
| int | minimum () const noexcept |
| | The smallest budget any cell has.
|
| |
The per-cell particle count this merge drains each cell down to.
Every crowding decision in this algorithm asks the same question – "does this cell hold
more particles than it is allowed to?" – so this type is the single place that answers it. The plain case is one uniform count for every cell, and an implicit constructor from int provides it, so a caller with nothing special to say simply passes the count.
A caller may additionally RESERVE slots in individual cells. A reserved slot is one already spoken for by particles this call cannot see, which must nonetheless count against the cell's total. The budget such a cell is drained to is the uniform count minus its reservations, floored at zero. The motivating case is a two-container merge in which one container has already been reduced and its results must still occupy room in the shared per-cell target.
Reservations are keyed by (level, cell), not by cell alone, for the reason given in detail::NNCellKey: a coarse and a fine cell can share a bare IntVect.
- Note
- Lookup is a single branch when nothing is reserved, so the uniform case costs no more than the bare integer it replaces.