entities
cosmic_warp.core.entities
Shared entity indexing helpers for managers operating on flat (env, body) arrays.
init_mask_kernel
Initialize mask for specific entities.
expand_entity_ids
expand_entity_ids(
num_envs: int,
num_bodies: int,
env_ids: list | None = None,
body_ids: list | None = None,
entity_ids: list | None = None,
) -> list | None
Expand (env_ids, body_ids) selections into flat entity indices.
entity_id = env_id * num_bodies + body_id
Returns entity_ids directly if given (it cannot be combined with env_ids or body_ids). Returns None when no selection is made (callers treat None as "all entities"). Every index must be an integer within range.
Source code in cosmic_warp/core/entities.py
check_ids
Return ids as a list of ints, each in [0, count). ids is a list, tuple or range of integers, or a 1-D integer NumPy array. Booleans (a mask is not a selection), floats, strings, scalars and Warp arrays are rejected.