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

Fractional Brownian motion (fBm) stimulus with Hurst exponent. More...

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

Go to the source code of this file.

Classes

struct  SimStimulusFbmConfig
 Configuration for seeded fractional Brownian motion stimulus noise. More...
 

Typedefs

typedef struct SimStimulusFbmConfig SimStimulusFbmConfig
 Configuration for seeded fractional Brownian motion stimulus noise.
 

Functions

SimResult sim_add_stimulus_fbm_operator (struct SimContext *context, const SimStimulusFbmConfig *config, size_t *out_index)
 Register a fractional Brownian motion stimulus operator.
 
SimResult sim_stimulus_fbm_config (struct SimContext *context, size_t operator_index, SimStimulusFbmConfig *out_config)
 Copy the current fBm configuration from a registered operator.
 
SimResult sim_stimulus_fbm_update (struct SimContext *context, size_t operator_index, const SimStimulusFbmConfig *config)
 Replace or renormalize a registered fBm stimulus configuration.
 

Detailed Description

Fractional Brownian motion (fBm) stimulus with Hurst exponent.

Synthesizes fractal noise fields using a multi-octave cosine basis: f(x) = sum_o A 2^{-H o} cos(2π λ^o x + φ_o).

For complex fields, the sum is written as a complex-valued field with sinusoidal basis per octave.

Function Documentation

◆ sim_add_stimulus_fbm_operator()

SimResult sim_add_stimulus_fbm_operator ( struct SimContext context,
const SimStimulusFbmConfig config,
size_t *  out_index 
)

Register a fractional Brownian motion stimulus operator.

The implementation copies and normalizes config, initializes octave phases from the configured seed, and registers the noise operator on the target field.

Parameters
contextSimulation context that will own the operator.
configOptional fBm 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_fbm_config()

SimResult sim_stimulus_fbm_config ( struct SimContext context,
size_t  operator_index,
SimStimulusFbmConfig out_config 
)

Copy the current fBm configuration from a registered operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_stimulus_fbm_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_fbm_update()

SimResult sim_stimulus_fbm_update ( struct SimContext context,
size_t  operator_index,
const SimStimulusFbmConfig config 
)

Replace or renormalize a registered fBm 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 fBm operator to update.
configOptional replacement configuration.
Returns
SIM_RESULT_OK on success, or an error code if lookup, octave setup, or state validation fails.