Skip to content

Partitioner

Generated from engine/collision/partitioner.h at 0f4f503. 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

Audience: game code.

#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.

No guide or concept page links to this header yet.

Documentation for Labrador v0.3.0. Built from Labrador 0f4f503 of 2026-11-03.

All documentation versions