Module API patterns: init, free, and interpolation
masterEach functional module in CLASS (e.g., background.c, thermodynamics.c) follows a consistent API pattern consisting of three types of functions:
module_init(...): Allocates and fills the module's specific structure. This must be called in the order of the seven-module hierarchy (Background $\rightarrow$ Thermodynamics $\rightarrow$ ... $\rightarrow$ Harmonic), as each subsequent module requires the data from the previous one.module_free(): Deallocates the fields of the structure. Crucial for samplers: If embedding CLASS in a parameter sampler, you must callmodule_free()between executions and before callingmodule_init()again with new parameters to prevent memory leaks.module_something_at_somevalue(...): Provides interpolation for the pre-computed tables. For example,background_at_eta(eta, * values)allows you to retrieve background quantities for any arbitrary conformal time $\eta$ from the tabulated values generated duringbackground_init().