|
Oakfield API Documentation 1.0.0
Numerical core APIs
|
Oakfield is the open-source numerical engine behind the Oakfield Operator Calculus family of applications.
It provides C APIs for multidimensional fields, operator registration, KernelIR evaluation, time integrators, special math helpers, and CPU reference execution.
LICENSE.System requirements for the default CPU build:
Threads::Threads.macOS requirements:
xcode-select --install.CMAKE_OSX_DEPLOYMENT_TARGET to 15.7.OAKFIELD_ENABLE_VDSP=ON. No separate package is needed.-DOAKFIELD_ENABLE_METAL=ON.Linux requirements:
sudo apt install build-essential cmake ninja-build.-DOAKFIELD_ENABLE_CUDA=ON.Optional developer tools:
OAKFIELD_BUILD_DOCS=ON.pkg-config, MPFR, and GMP for OAKFIELD_BUILD_APPROX_TOOLS=ON.OAKFIELD_BUILD_BENCHMARKS=ON.clang-format for the optional public-header formatting check in the test suite.Useful build options:
OAKFIELD_BUILD_TESTS: builds CTest-based tests. Enabled by default.OAKFIELD_BUILD_EXAMPLES: builds small C example programs. Enabled by default.OAKFIELD_BUILD_DOCS: adds the optional oakfield_docs Doxygen target. Disabled by default.OAKFIELD_BUILD_BENCHMARKS: builds opt-in developer benchmark executables. Disabled by default.OAKFIELD_ENABLE_EXTENDED_FEATURES: enables the extended feature set used by the current operator catalogue. Enabled by default.OAKFIELD_ENABLE_FAST_MATH: enables aggressive floating-point optimizations for most engine code. Some special-math sources are built without fast-math.OAKFIELD_ENABLE_SYMBOLIC_KERNELS: enables symbolic KernelIR paths where supported.OAKFIELD_ENABLE_DIAGNOSTICS: enables diagnostic code paths.OAKFIELD_ENABLE_ZETA_CORE: includes Zeta/Xi sources.OAKFIELD_ENABLE_OPENMP: enables OpenMP for CPU paths when available.OAKFIELD_ENABLE_VDSP: enables Accelerate/vDSP on Apple platforms when available.OAKFIELD_ENABLE_CUDA: builds the experimental CUDA backend when CMake can find a CUDA Toolkit with the driver and NVRTC libraries. Disabled by default.OAKFIELD_ENABLE_METAL: builds the experimental Metal backend on Apple platforms. Disabled by default.Generated build directories such as build, build-ci, and other build-* paths are ignored local artifacts and should not be included in source releases.
The CMake project installs the public include tree, simcore, simintegrators, and CMake package metadata for config-mode discovery:
Downstream CMake projects can then consume the installed package without referencing source-tree private paths:
Link oakfield::simintegrators as well when creating integrators directly. Public headers are installed under include/oakfield.
The first test slice lives under tests and covers portable CPU-only field, buffer, patch, scalar-domain, backend support-level, public-header, stable special-math smoke paths, supported Zeta/Xi smoke and regression paths, and labeled experimental q-method smoke paths adapted from the base test suite. Tests are enabled by default:
Most smoke tests are quick; slow-labeled Zeta/Xi visualization checks can take several seconds on a normal developer machine. Failures usually indicate a core ABI/layout regression, a special-function accuracy regression, or a build configuration mismatch.
Experimental q-method tests carry the experimental CTest label and do not represent stable accuracy or performance promises.
Small C examples live under examples and mirror the public workflows used by the Lua and runtime layers: fields, context-owned operators, CPU KernelIR launch, integrators, seeded stochastic stepping, and stable math calls. Examples include public headers rather than private source-tree paths.
Benchmarks are opt-in developer tools and are not registered as CTest correctness checks. Configure a dedicated benchmark build with optional docs, tests, and examples disabled when you only want the benchmark executables:
Run the benchmark executables from the build tree:
benchmark_special_functions auto-detects optional GSL, Boost.Math, and MPFR rows at configure time. Boost.Math detection checks compiler defaults plus common Homebrew include and Cellar paths; if Boost lives somewhere else, add -DOAKFIELD_BENCH_BOOST_INCLUDE_DIR=/path/to/include or point directly at the boost/ directory.
To include experimental GPU backend code in the same build, add -DOAKFIELD_ENABLE_CUDA=ON on hosts with the CUDA Toolkit installed, and add -DOAKFIELD_ENABLE_METAL=ON on Apple platforms with the Metal framework available. CUDA and Metal can be enabled together only on machines that provide both toolchains.
Use benchmark output for local before/after comparisons on the same machine, problem size, iteration count, compiler, and build configuration. Generated timing results should stay out of source releases unless a release process intentionally versions them.
Special-function coefficient work lives behind an opt-in developer build:
build-approx/bin/oakfield_minimax generates MPFR-backed Chebyshev-basis polynomial and rational minimax candidates for functions such as digamma, Airy Ai, and Bessel Jn. Treat emitted coefficients as candidates: validate them against MPFR tests and local benchmarks before moving them into runtime math code.
Public headers contain Doxygen-style docblocks, grouped by module for fields, buffers, contexts, operators, KernelIR, integrators, backends, special functions, Zeta/Xi APIs, and experimental q-method APIs. The build includes an optional Doxygen target that writes generated output to the build tree. The default docs target is focused on public headers and Markdown notes; private implementation docs can be added later as a separate developer-docs mode.
To generate docs when Doxygen is installed:
core/src: core field, buffer, context, operator, KernelIR, runtime, and math implementation.core/src/operators: split-operator catalogue grouped by domain, such as stimulus, diffusion, advection, measurement, coupling, utility, noise, nonlinear, neural, reaction, and thermostat.integrators/src: timestepper APIs, built-in integrator implementations, and the runtime registry.backends/src: backend abstraction plus CPU, CUDA, and Metal implementations.cmake: source inventory used by the CMake build.docs: contributor-facing design notes and generated-doc scaffolding.examples: small buildable programs for fields, contexts, operators, integrators, backends, and stable math calls.tools/approx: opt-in MPFR-backed approximation-generation tooling for special-function coefficient work.include/oakfield: public include tree for downstream users. core/src, integrators/src, and backends/src are private build inputs.Oakfield installs two static libraries and a public include tree. The operator catalogue, CPU backend, special math, field/runtime code, and KernelIR all live in simcore; timestepper implementations live in simintegrators.
| Target / header | Contains | Notes |
|---|---|---|
oakfield::simcore | Fields, buffers, contexts, operator registry, split operators, KernelIR, GraphIR support, runtime state, diagnostics, special math, all operators, and the CPU backend. | Link this for most applications. CUDA and Metal sources are compiled into this target only when their CMake options are enabled. |
oakfield::simintegrators | Integrator, IntegratorConfig, built-in timesteppers, and the integrator registry. | Links against simcore. Built-ins include Euler, Heun, RK4, RKF45, backward Euler, Crank-Nicolson, ETDRK4, and subordination. |
oakfield/core.h | Aggregate header for core fields, contexts, operators, KernelIR, runtime state, and diagnostics. | Good starting include for engine-level code. Include oakfield/backend.h separately when launching kernels directly. |
oakfield/operators/basic.h | Narrow operator include for common Laplacian, noise, copy, phase-rotate, scale, and zero-field workflows. | Prefer this when examples or downstream users only need the basic set. |
oakfield/operators/operators.h | Aggregate header for the full operator catalogue. | Pulls in advection, coupling, diffusion, measurement, neural, noise, nonlinear, reaction, stimulus, thermostat, and utility operators. |
oakfield/math.h | Special-function entry points, including classical helpers, Zeta/Xi, and experimental q-methods. | Classical special functions plus Zeta/Xi are covered by tests and benchmarks; q-method APIs remain experimental. |
The engine is built around a small set of C structs with explicit ownership and runtime contracts.
| Primitive | Public headers | Role |
|---|---|---|
SimField, SimFieldLayout, SimScalarDomain | oakfield/field.h | Own or wrap multidimensional contiguous storage with shape, strides, representation domain, scalar algebra domain, and allocator metadata. |
SimBuffer, SimBufferView | oakfield/sim_buffer.h | Typed scalar allocations for auxiliary data that does not need full field layout metadata. |
SimContext | oakfield/sim_context.h | Owns fields, registered operators, scheduler state, runtime counters, diagnostics, integrator bindings, memory limits, and deterministic seed state. |
SimOperator, SimOperatorDescriptor, SimOperatorInfo | oakfield/operator.h | Declare executable work, read/write fields, dependencies, category metadata, algebraic flags, determinism, representation hints, and optional KernelIR-backed execution. |
SimSplitDescriptor, SimSplitSubstep, SimSplitPort | oakfield/operator_split.h | Expand a higher-level operator into ordered substeps with shared state, field access declarations, scratch requirements, and dependency edges. |
SimIRBuilder, SimIRNode, SimIRType | oakfield/kernel_ir.h | Build typed expression graphs for backend-independent numeric kernels. Builders own node storage and constant pools. |
KernelIR, SimKernelIRBinding, SimKernelIROutput | oakfield/backend.h | Package a builder with runtime field bindings, output expression roots, optional parameters, required backend features, and complex-lane semantics for launch. |
SimBackend | oakfield/backend.h | Initializes and launches CPU, CUDA, or Metal execution engines through a common feature-bit contract. CPU is the correctness reference. |
Integrator, IntegratorConfig, IntegratorRegistry | oakfield/integrator.h, oakfield/integrator_registry.h | Advance fields from drift/noise callbacks, manage adaptive timestep diagnostics, and look up built-in or custom schemes. |
SimFieldPatch, SimPlaneChart, field stats/topology helpers | oakfield/field_patch.h, oakfield/plane_chart.h, oakfield/sim_field_stats*.h, oakfield/sim_field_topology*.h | Support patch iteration, coordinate projections, runtime statistics, topology summaries, and visualization-oriented analysis. |
KernelIR is the pointwise expression layer used by operators and backends to describe numeric work without committing to a concrete execution engine. It is not a full scheduler by itself; a KernelIR package describes one backend launch, while SimContext and the operator scheduler decide when that launch runs.
The core data path is:
SimIRBuilder.SimIRNode records and return SimIRNodeId handles.SimKernelIROutput.SimKernelIRBinding records connect KernelIR field identifiers to runtime SimField storage.KernelIR launch package borrows the builder, bindings, outputs, optional parameter array, feature mask, and complex-lane contract for the duration of backend_launch().Builders own expression storage. Kernel launch packages borrow that storage. This split keeps graph construction reusable while making backend launches cheap to assemble from live context fields. Operators that expose KernelIR usually store an owned SimOperatorKernel wrapper that clones binding/output maps and keeps mutable runtime parameter storage.
| Primitive group | Node types / helpers | Notes |
|---|---|---|
| Literals and constants | SIM_IR_NODE_CONSTANT, sim_ir_builder_constant*, sim_ir_builder_constant_vector*, sim_ir_builder_constant_complex | Scalars, exact signed/unsigned integers, small inline vectors, pooled vector constants, and complex constants. |
| Field, coordinate, and index reads | SIM_IR_NODE_FIELD_REF, SIM_IR_NODE_COORD, SIM_IR_NODE_INDEX | Field references are logical IDs resolved by launch bindings; coordinate/index nodes derive element position from bound field layout. |
| Arithmetic | ADD, SUB, MUL, DIV, POW, sim_ir_builder_binary, sim_ir_builder_pow | Typed scalar/vector arithmetic. Real, complex, integer, and modular legality is controlled by SimScalarDomain. |
| Differential terms | SIM_IR_NODE_DIFF, sim_ir_builder_diff, sim_ir_builder_diff_spec | Carries operand, axis, spacing, scale, derivative order, stencil order, method, consistency constant, and boundary policy. |
| Noise terms | SIM_IR_NODE_NOISE, sim_ir_builder_noise, sim_ir_builder_noise_spec | Seeded stochastic nodes with amplitude, variance, Ito or Stratonovich law, and uniform or Gaussian distribution metadata. |
| Analytic warp | SIM_IR_NODE_WARP, sim_ir_builder_warp, sim_ir_builder_warp_spec | Digamma/trigamma-family warp profiles with bias, symmetric delta, lambda scale, tolerance, warp level, and continuity guards. |
| Runtime parameters | SIM_IR_NODE_PARAM, sim_ir_builder_param | Reads dt, step_index, sqrt_dt, or simulation time from backend/evaluator callbacks. |
| Complex helpers | SIM_IR_NODE_COMPLEX_PACK, SIM_IR_NODE_COMPLEX_ROTATE | Pack real/imag lanes and rotate complex values by a scalar phase. Launches declare true-complex or componentwise lane semantics. |
| Unary and discrete helpers | SIM_IR_NODE_CALL, SIM_IR_NODE_FLOOR, SIM_IR_NODE_MOD | Built-in calls include sin, cos, exp, abs, log, tanh, sinh, and sign, plus floor and modulo. |
| Stateful callback | SIM_IR_NODE_STATEFUL, sim_ir_builder_stateful* | CPU-oriented callback node for exploratory or stateful expressions; strict deterministic paths should avoid it unless the operator documents replay behavior. |
Every node carries a SimIRType, semantic opcode, inferred shape, warp classification, and locality flag. SimIRType separates scalar versus vector values from the scalar algebra domain, so the same expression machinery can reason about real floating-point, complex floating-point, exact integer, and modular values. Operators can tag reachable nodes with SimIROpcode values such as diffuse, warp, noise, or flow so downstream tooling can classify generated kernels.
The CPU backend is the reference evaluator. It walks each output expression for each destination element with memoized recursive node evaluation, resolves fields through launch bindings, evaluates finite differences from bound field layout, samples seeded noise, and dispatches real, complex, vector-lane, and scalar-domain-aware paths as needed. Optional CUDA and Metal backends consume the same KernelIR package when compiled in, but may reject packages whose feature bits or complex semantics are not supported.
kernel_ir_mathview renders KernelIR expressions as canonical strings, JSON, LaTeX outlines, and hashes. This gives tests and external tooling a stable view of the symbolic expression without depending on backend source generation.
GraphIR sits one level above KernelIR. It composes pointwise KernelIR nodes with FFT forward/inverse nodes, real-to-complex promotion, cast/copy nodes, and Hermitian canonicalization. GraphIR validation checks representation and time contracts, and compatible adjacent pointwise KernelIR nodes can be fused before execution.
Operators are registered into a SimContext with sim_add_* helpers, then optionally inspected with sim_*_config(...) and updated with sim_*_update(...). The aggregate oakfield/operators/operators.h exposes the full catalogue. The table tracks public registration surfaces backed by core/src/operators; some rows share the same implementation file because a single source exposes several variants or compatibility wrappers.
| Family | Operator / helper | Source | Purpose |
|---|---|---|---|
| Advection | sim_add_analytic_warp_operator | advection/analytic_warp.c | Smooth nonlinear deformation acting on a single field. |
| Advection | sim_add_curl_operator | advection/curl.c | Finite-difference curl-like scalar from two vector components. |
| Advection | sim_add_divergence_operator | advection/divergence.c | Finite-difference divergence from two vector components. |
| Advection | sim_add_gradient_operator | advection/gradient.c | Finite-difference gradient writing X/Y derivative fields. |
| Advection | sim_add_spatial_derivative_operator | advection/spatial_derivative.c | 1D finite-difference spatial derivative. |
| Coupling | sim_add_mask_operator | coupling/mask_apply.c | Gate a field by a mask, with optional inversion. |
| Coupling | sim_add_metal_mix_operator | coupling/metal_mix.c | Metal-friendly linear/crossfade mixer subset with split fallback. |
| Coupling | sim_add_mixer_operator | coupling/mixer.c | Linear, multiply, crossfade, AM/FM/PM, ring-mod, min/max, and feedback mixing. |
| Coupling | sim_add_segmented_sieve_mark_operator | coupling/segmented_sieve_mark.c | Exact integer segmented-sieve marking. |
| Coupling | sim_add_segmented_sieve_mark_batch_operator | coupling/segmented_sieve_mark_batch.c | Batched exact integer segmented-sieve marking. |
| Diffusion | sim_add_dispersion_operator | diffusion/dispersion.c | Spectral k-dependent phase rotation. |
| Diffusion | sim_add_fractional_memory_operator | diffusion/fractional_memory.c | History-based fractional derivative of order q. |
| Diffusion | sim_add_laplacian_operator | diffusion/laplacian.c | Finite-difference Laplacian for 1D/2D fields. |
| Diffusion | sim_add_linear_dissipative_operator | diffusion/linear_dissipative.c | Fractional Laplacian spectral damping. |
| Diffusion | sim_add_linear_spectral_fusion_operator | diffusion/linear_spectral_fusion.c | Fused spectral dissipation, dispersion, and phase. |
| Measurement | sim_add_minimal_convolution_operator | measurement/minimal_convolution.c | Small odd-length 1D/2D convolution kernels. |
| Measurement | sim_add_phase_feature_operator | measurement/phase_feature.c | Phase-feature extraction for real and complex fields. |
| Measurement | sim_add_sdr_observer_operator | measurement/sdr_observer.c | Experimental SDR observation with RTL-SDR and synthetic fallback status. |
| Measurement | sim_add_sieve_operator | measurement/sieve.c | Discrete filtering with low/high/band-pass and windowed responses. |
| Measurement | sim_add_sound_observation_operator | measurement/sound_observation.c | Map field measurements to audio-control observations. |
| Neural | sim_add_neural_hybrid_operator | neural/neural_hybrid.c | Analytic-plus-residual neural hybrid scaffold. |
| Neural | sim_add_neural_infer_operator | neural/neural_infer.c | Neural inference operator scaffold. |
| Noise | sim_add_ornstein_uhlenbeck_operator | noise/ornstein_uhlenbeck.c | Ornstein-Uhlenbeck stochastic process update. |
| Noise | sim_add_stochastic_noise_operator | noise/stochastic_noise.c | Additive seeded noise with spectral shaping and calculus-law metadata. |
| Nonlinear | sim_add_chaos_map_operator | nonlinear/chaos_map.c | Discrete chaotic maps for real or complex state fields. |
| Nonlinear | sim_add_complex_math_operator | nonlinear/complex_math.c | Elementwise complex math transforms and component extraction. |
| Nonlinear | sim_add_hysteretic_operator | nonlinear/hysteretic.c | Schmitt, play/deadband, and Bouc-Wen hysteresis modes. |
| Nonlinear | sim_add_elementwise_math_operator | nonlinear/math_operator.c | Discrete-friendly elementwise scalar math. |
| Reaction | sim_add_remainder_operator | reaction/remainder.c | Measure f(warped) - f(reference) with optional accumulation. |
| Stimulus | sim_add_stimulus_operator | stimulus/stimulus.c | Legacy single-mode sinusoidal forcing. |
| Stimulus | sim_add_stimulus_airy_beam_operator | stimulus/airy_beam.c | Finite-energy separable Airy beam. |
| Stimulus | sim_add_stimulus_bessel_beam_operator | stimulus/bessel_beam.c | Integer-order cylindrical Bessel beam. |
| Stimulus | sim_add_stimulus_checkerboard_operator | stimulus/checkerboard.c | Checkerboard or stripe pattern writes. |
| Stimulus | sim_add_stimulus_chirp_operator | stimulus/sinusoidal.c | Chirped sinusoidal stimulus. |
| Stimulus | sim_add_stimulus_chladni_operator | stimulus/chladni.c | Chladni nodal-line plate modes. |
| Stimulus | sim_add_stimulus_cylindrical_wave_emitter_operator | stimulus/cylindrical_wave_emitter.c | Regularized cylindrical wave emitter. |
| Stimulus | sim_add_stimulus_digamma_square_operator | stimulus/digamma_square.c | Digamma-square waveform stimulus. |
| Stimulus | sim_add_digamma_square_operator | stimulus/digamma_square.c | Compatibility wrapper for digamma-square stimulus registration. |
| Stimulus | sim_add_stimulus_fbm_operator | stimulus/fbm.c | Fractional Brownian motion stimulus with Hurst exponent. |
| Stimulus | sim_add_stimulus_fourier_operator | stimulus/fourier.c | Bandlimited saw, square, and triangle waveform stimulus. |
| Stimulus | sim_add_stimulus_gabor_operator | stimulus/gabor.c | Gaussian-windowed sinusoidal Gabor kernel. |
| Stimulus | sim_add_stimulus_gaussian_operator | stimulus/gaussian.c | Traveling Gaussian envelope modulation. |
| Stimulus | sim_add_stimulus_heat_kernel_operator | stimulus/heat_kernel.c | Diffusive Gaussian heat-kernel broadening. |
| Stimulus | sim_add_stimulus_hermite_gaussian_beam_operator | stimulus/hermite_gaussian_beam.c | Hermite-Gaussian beam with separable transverse modes. |
| Stimulus | sim_add_stimulus_hybrid_fbm_operator | stimulus/hybrid_fbm.c | Hybrid fBm with octave-to-octave cascade weighting. |
| Stimulus | sim_add_stimulus_laplace_beltrami_operator | stimulus/laplace_beltrami.c | Analytic Laplace-Beltrami eigenmodes on simple manifolds. |
| Stimulus | sim_add_stimulus_lissajous_operator | stimulus/lissajous.c | Lissajous ridge with Gaussian band shaping. |
| Stimulus | sim_add_stimulus_log_polar_operator | stimulus/log_polar.c | Log-polar interference with optional spiral phase drift. |
| Stimulus | sim_add_stimulus_log_spectral_grid_operator | stimulus/log_spectral_grid.c | Log-frequency spectral grid with coordinate controls. |
| Stimulus | sim_add_stimulus_moire_operator | stimulus/moire.c | Moire interference in 1D/2D coordinate systems. |
| Stimulus | sim_add_stimulus_morlet_field_operator | stimulus/morlet_field.c | Multi-scale Morlet wavelet field stimulus. |
| Stimulus | sim_add_stimulus_multifractal_operator | stimulus/multifractal.c | Multiplicative multifractal from centered octave products. |
| Stimulus | sim_add_stimulus_optical_vortex_operator | stimulus/optical_vortex.c | Optical vortex beam with phase winding. |
| Stimulus | sim_add_stimulus_posenc_operator | stimulus/posenc.c | NeRF-style positional encoding field. |
| Stimulus | sim_add_stimulus_random_fourier_operator | stimulus/random_fourier.c | Seeded random Fourier feature fields. |
| Stimulus | sim_add_stimulus_rd_seed_operator | stimulus/rd_seed.c | Reaction-diffusion seed patterns. |
| Stimulus | sim_add_stimulus_ridged_noise_operator | stimulus/ridged_noise.c | Ridged fractal noise from a squared ridge profile. |
| Stimulus | sim_add_stimulus_sine_operator | stimulus/sinusoidal.c | Traveling-wave sinusoidal stimulus. |
| Stimulus | sim_add_stimulus_spectral_lines_operator | stimulus/spectral_lines.c | Pure frequency spikes and multi-line harmonics. |
| Stimulus | sim_add_stimulus_spectral_shells_operator | stimulus/spectral_shells.c | Random annular bands in k-space. |
| Stimulus | sim_add_stimulus_standing_operator | stimulus/sinusoidal.c | Standing-wave sinusoidal stimulus. |
| Stimulus | sim_add_stimulus_steerable_wavelet_operator | stimulus/steerable_wavelet.c | Simoncelli/Riesz-style steerable wavelet stimulus. |
| Stimulus | sim_add_stimulus_traveling_wave_packet_operator | stimulus/traveling_wave_packet.c | Gaussian-envelope traveling wave packet. |
| Stimulus | sim_add_stimulus_turbulence_operator | stimulus/turbulence.c | Turbulence stimulus from centered absolute-value fractal basis. |
| Stimulus | sim_add_stimulus_wave_modes_operator | stimulus/wave_modes.c | Rectangular wave-equation standing modes. |
| Stimulus | sim_add_stimulus_white_noise_operator | stimulus/white_noise.c | Seeded Gaussian white-noise injection. |
| Stimulus | sim_add_stimulus_worley_noise_operator | stimulus/worley_noise.c | Worley/cellular noise with selectable distance metrics. |
| Stimulus | sim_add_stimulus_zeta_plane_slice_operator | stimulus/zeta_plane_slice.c | Zeta/Xi complex-plane slice visualization. |
| Stimulus | sim_add_stimulus_zone_plate_operator | stimulus/zone_plate.c | Fresnel-style zone plate with quadratic radial phase. |
| Thermostat | sim_add_thermostat_operator | thermostat/thermostat.c | Soft energy/lambda regulation. |
| Utility | sim_add_coordinate_operator | utility/coordinate.c | Coordinate or linear-index field generation. |
| Utility | sim_add_copy_operator | utility/copy.c | Copy one compatible field into another. |
| Utility | sim_add_fft_convert | utility/fft_convert.c | Allocate FFT conversion output and transition physical/spectral domains. |
| Utility | sim_add_phase_rotate_operator | utility/phase_rotate.c | Advance field phase by rate times timestep. |
| Utility | sim_add_scale_operator | utility/scale.c | Write a scaled copy of one field to another. |
| Utility | sim_add_zero_field_operator | utility/zero_field.c | Clear a real or complex field in place. |
Most built-in operators follow the same shape: fill a config struct, register it into a SimContext, keep the returned operator index if you want to inspect or update it later, then execute the context. These snippets assume ctx is an initialized SimContext, the named field indices already came from sim_context_add_field(), and production code checks every SimResult.
*_internal.h and private backend headers as implementation details.