|
CLASSpp Manual
Cosmology reference and developer manual
|
#include <base_species.h>
Inheritance diagram for BaseSpecies::PerturbScratch:Per-workspace working memory: whatever a species needs to scribble on during a perturbation RHS but must not share.
perturb_init evolves k-modes concurrently, so hot-path scratch kept as a mutable member is a data race — invisible in the physics, and surfacing far from its cause. perturb_workspace is a stack local inside the per-k task, so scratch hung here is private by construction: exactly one per k-mode integration, for the whole integration.
Scope differs from PerturbLayout, which lives on the perturb_vector and is rebuilt at every approximation switch. Scratch survives tca/rsa switches, so a species may cache setup work that does not depend on the vector's shape.
Default: nullptr, for the species that need nothing.