Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
turbulence.h File Reference

Turbulence stimulus built from a centered absolute-value fractal basis. More...

#include "coords.h"
#include "oakfield/operator_split.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for turbulence.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimStimulusTurbulenceConfig
 Configuration for seeded billowy turbulence stimulus noise. More...
 

Typedefs

typedef struct SimStimulusTurbulenceConfig SimStimulusTurbulenceConfig
 Configuration for seeded billowy turbulence stimulus noise.
 

Functions

SimResult sim_add_stimulus_turbulence_operator (struct SimContext *context, const SimStimulusTurbulenceConfig *config, size_t *out_index)
 Register a billowy turbulence stimulus operator.
 
SimResult sim_stimulus_turbulence_config (struct SimContext *context, size_t operator_index, SimStimulusTurbulenceConfig *out_config)
 Copy the current turbulence configuration from a registered operator.
 
SimResult sim_stimulus_turbulence_update (struct SimContext *context, size_t operator_index, const SimStimulusTurbulenceConfig *config)
 Replace or renormalize a registered turbulence stimulus configuration.
 

Detailed Description

Turbulence stimulus built from a centered absolute-value fractal basis.

Synthesizes billowy multi-octave turbulence using T(x) = sum_o A 2^{-H o} (|cos(2π λ^o x + φ_o)| - 2/π).

For complex fields, the imaginary channel uses the corresponding centered absolute sine basis.

Function Documentation

◆ sim_add_stimulus_turbulence_operator()

SimResult sim_add_stimulus_turbulence_operator ( struct SimContext context,
const SimStimulusTurbulenceConfig config,
size_t *  out_index 
)

Register a billowy turbulence stimulus operator.

The implementation copies and normalizes config, initializes octave phases from the configured seed, and registers the turbulence operator.

Parameters
contextSimulation context that will own the operator.
configOptional turbulence configuration; NULL selects normalized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, or an error code from validation, allocation, octave setup, or split-operator registration.

◆ sim_stimulus_turbulence_config()

SimResult sim_stimulus_turbulence_config ( struct SimContext context,
size_t  operator_index,
SimStimulusTurbulenceConfig out_config 
)

Copy the current turbulence configuration from a registered operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_stimulus_turbulence_operator().
[out]out_configReceives the operator's normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no stimulus state.

◆ sim_stimulus_turbulence_update()

SimResult sim_stimulus_turbulence_update ( struct SimContext context,
size_t  operator_index,
const SimStimulusTurbulenceConfig config 
)

Replace or renormalize a registered turbulence stimulus configuration.

Passing NULL for config keeps the existing configuration and reapplies normalization. A successful update refreshes octave data and invalidates the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the turbulence operator to update.
configOptional replacement configuration.
Returns
SIM_RESULT_OK on success, or an error code if lookup, octave setup, or state validation fails.