Skip to content

Partitioner

Generated from engine/collision/partitioner.h at 862e08b. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.

Browse the collision module

#include "engine/collision/partitioner.h" · namespace labrador

Partitioner() = default;
std::vector<std::pair<int, int>>
partition(int num_elements, int num_partitions) const;

Splits [0, num_elements) into at most num_partitions contiguous half-open ranges, [first, second), covering every element exactly once. The remainder is spread one element at a time over the leading ranges rather than piled onto the last, so no range is more than one element longer than any other.

Fewer ranges than asked for when there are fewer elements than partitions: an empty range is work for a worker that has none, so num_elements == 0 returns no ranges at all.

Preconditions, checked: num_partitions >= 1 and num_elements >= 0. num_partitions is a divisor on the first line, and it arrives from ApplicationOptions::max_threads by way of ThreadPool, and unchecked anywhere on that route a zero in a config file is an integer divide-by-zero on the first frame of the first match.

std::vector<std::pair<int, int>>
partition(size_t num_elements, int num_partitions) const;

The files that include this header directly. A file can also reach it through another header.

Development documentation (unreleased). Built from Labrador 862e08b of 2026-10-08.