Skip to content

Photon

Photon Cell ID Scheme

This document describes the cell ID scheme used for photons in the Thor Monte Carlo radiative transfer code.

Types and Notation

  • IP is the integer type used for cell IDs (32‑bit or 64‑bit, depending on compile‑time options).
  • IPT is a small traits wrapper around IP providing min(), max(), and name().
    In particular, IPT::min() is the smallest representable IP value and is used as the base for reserved negative ranges.

Cell ID Ranges

Valid Cell IDs

  • Range: cell_id >= 0 and cell_id < n_points
  • Meaning: Valid cell indices pointing to actual data cells in the simulation domain.

Boundary Cell IDs

  • Range: IPT::min() to IPT::min() + 31 (32 reserved boundary entries)

Specific cube face boundaries

  • IPT::min() + 0: X-min face (x = 0)
  • IPT::min() + 1: Y-min face (y = 0)
  • IPT::min() + 2: Z-min face (z = 0)
  • IPT::min() + 3: X-max face (x = 1)
  • IPT::min() + 4: Y-max face (y = 1)
  • IPT::min() + 5: Z-max face (z = 1)

Reserved boundary entries

  • IPT::min() + 6 to IPT::min() + 30: Reserved for future boundary types.
  • IPT::min() + 31: Generic boundary neighbor (wildcard wall).

Multi-rank Communication (reserved)

  • Range: IPT::min() + 32 to -1
  • Meaning: Reserved for future multi-rank communication.
    Currently, the point-cloud (Voronoi) dataset treats values in this range as “needs communication”, but the multi-rank Voronoi path is not fully implemented yet.

Special Values

  • -1: Default/uninitialized state or invalid cell after direction changes.

Summary

  • Positive values (>= 0 and < n_points): Valid cell indices.
  • Negative values IPT::min() to IPT::min() + 31: Boundary conditions (32 entries reserved).
  • Negative values IPT::min() + 32 to -1: Reserved for (future) multi-rank communication.
  • -1: Uninitialized or invalid state.