|
Oakfield API Documentation 1.0.0
Numerical core APIs
|
Operator abstraction, registry, and dependency resolution for libsimcore. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "field.h"#include "oakfield/backend.h"#include "operator_identity.h"

Go to the source code of this file.
Classes | |
| struct | SimOperatorRepresentation |
| Representation metadata attached to an operator. More... | |
| struct | SimOperatorApproximation |
| Approximation metadata describing discretization quality. More... | |
| struct | SimNeuralShapeConstraints |
| Shape and channel constraints used by neural operators. More... | |
| struct | SimOperatorNeuralContract |
| Neural operator contract metadata. More... | |
| struct | SimOperatorInvariant |
| Invariant declaration with tolerance. More... | |
| struct | SimOperatorInfo |
| Metadata describing operator characteristics. More... | |
| struct | SimOperatorConfig |
| Operator runtime configuration shared between descriptors and instances. More... | |
| struct | SimOperator |
| Operator instance stored by the registry. More... | |
| struct | SimOperatorKernelBindingDescriptor |
| Maps an IR field reference to a context field index. More... | |
| struct | SimOperatorKernelOutputDescriptor |
| Describes an output expression emitted by a kernel-backed operator. More... | |
| struct | SimOperatorKernelDescriptor |
| Descriptor for registering a kernel-backed operator. More... | |
| struct | SimOperatorKernel |
| Runtime state for a kernel-backed operator. More... | |
| struct | SimOperatorDescriptor |
| Description used when registering a new operator. More... | |
| struct | SimOperatorRegistry |
| Operator registry storing owned operator instances. More... | |
| struct | SimOperatorPlan |
| Execution plan obtained via dependency resolution. More... | |
Macros | |
| #define | OAKFIELD_ENABLE_SYMBOLIC_KERNELS 1 |
| #define | OAKFIELD_ENABLE_ZETA_CORE 1 |
| #define | SIM_OPERATOR_NAME_MAX 63U |
| #define | SIM_OPERATOR_SCHEMA_KEY_MAX 127U |
| #define | SIM_OPERATOR_MAX_SPACING_DIMS 4U |
| #define | SIM_NEURAL_CHANNEL_AXIS_AUTO 255U |
| #define | SIM_OPERATOR_MAX_INVARIANTS 4U |
Typedefs | |
| typedef void(* | SimOperatorCycleLogFn) (const char *message, void *userdata) |
| Callback used to report dependency-cycle diagnostics. | |
| typedef enum SimOperatorCategory | SimOperatorCategory |
| Operator category for grouping and scheduling hints. | |
| typedef enum SimContinuityMode | SimContinuityMode |
| Numerical continuity and stability policy. | |
| typedef enum SimContinuityLimiterStrategy | SimContinuityLimiterStrategy |
| Limiter/clipper strategies engaged by continuity guards. | |
| typedef enum SimOperatorAlgebraicFlags | SimOperatorAlgebraicFlags |
| Algebraic property bitmask for operators. | |
| typedef struct SimOperatorRepresentation | SimOperatorRepresentation |
| Representation metadata attached to an operator. | |
| typedef struct SimOperatorApproximation | SimOperatorApproximation |
| Approximation metadata describing discretization quality. | |
| typedef enum SimRepresentationMode | SimRepresentationMode |
| Representation mode governing determinism guarantees. | |
| typedef enum SimDeterminismFlags | SimDeterminismFlags |
| Determinism capability flags declared by operators. | |
| typedef enum SimNeuralDeterminismPolicy | SimNeuralDeterminismPolicy |
| Determinism policy for neural inference operators. | |
| typedef enum SimNeuralDeviceRequirement | SimNeuralDeviceRequirement |
| Device placement requirement for neural inference operators. | |
| typedef enum SimNeuralPrecisionMode | SimNeuralPrecisionMode |
| Numeric precision policy for neural inference operators. | |
| typedef struct SimNeuralShapeConstraints | SimNeuralShapeConstraints |
| Shape and channel constraints used by neural operators. | |
| typedef struct SimOperatorNeuralContract | SimOperatorNeuralContract |
| Neural operator contract metadata. | |
| typedef enum SimClockMode | SimClockMode |
| Clock selection for time-sensitive operators. | |
| typedef enum SimOperatorInvariantKind | SimOperatorInvariantKind |
| Supported invariant kinds for bookkeeping/diagnostics. | |
| typedef struct SimOperatorInvariant | SimOperatorInvariant |
| Invariant declaration with tolerance. | |
| typedef struct SimOperatorInfo | SimOperatorInfo |
| Metadata describing operator characteristics. | |
| typedef struct SimOperatorConfig | SimOperatorConfig |
| Operator runtime configuration shared between descriptors and instances. | |
| typedef SimResult(* | SimOperatorEvalFn) (struct SimContext *context, struct SimOperator *self, void *userdata) |
| Function signature for operator evaluation. | |
| typedef void(* | SimOperatorDestroyFn) (void *userdata) |
| Function signature for operator teardown callbacks. | |
| typedef const struct SimGraphIR *(* | SimOperatorGraphIRViewFn) (const struct SimOperator *self, void *userdata) |
| Optional hook exposing a read-only GraphIR lowering view. | |
| typedef struct SimOperator | SimOperator |
| Operator instance stored by the registry. | |
| typedef struct SimOperatorKernelBindingDescriptor | SimOperatorKernelBindingDescriptor |
| Maps an IR field reference to a context field index. | |
| typedef struct SimOperatorKernelOutputDescriptor | SimOperatorKernelOutputDescriptor |
| Describes an output expression emitted by a kernel-backed operator. | |
| typedef struct SimOperatorKernelDescriptor | SimOperatorKernelDescriptor |
| Descriptor for registering a kernel-backed operator. | |
| typedef struct SimOperatorKernel | SimOperatorKernel |
| Runtime state for a kernel-backed operator. | |
| typedef struct SimOperatorDescriptor | SimOperatorDescriptor |
| Description used when registering a new operator. | |
| typedef struct SimOperatorRegistry | SimOperatorRegistry |
| Operator registry storing owned operator instances. | |
| typedef struct SimOperatorPlan | SimOperatorPlan |
| Execution plan obtained via dependency resolution. | |
Functions | |
| const char * | sim_continuity_mode_name (SimContinuityMode mode) |
| bool | sim_continuity_mode_from_string (const char *text, SimContinuityMode *out_mode) |
| const char * | sim_continuity_limiter_name (SimContinuityLimiterStrategy strategy) |
| const char * | sim_boundary_policy_name (SimIRBoundaryPolicy policy) |
| bool | sim_boundary_policy_from_string (const char *text, SimIRBoundaryPolicy *out_policy) |
| void | sim_operator_config_set_spacing (struct SimOperatorConfig *config, const double *spacing, size_t rank) |
| SimResult | sim_operator_registry_init (SimOperatorRegistry *registry) |
| Initialize an empty registry. | |
| void | sim_operator_registry_destroy (SimOperatorRegistry *registry) |
| Release all operators contained in a registry. | |
| SimResult | sim_operator_registry_register (SimOperatorRegistry *registry, const SimOperatorDescriptor *descriptor, size_t *out_index) |
| Register a new operator. | |
| SimOperator * | sim_operator_registry_get (SimOperatorRegistry *registry, size_t index) |
| Lookup an operator by index. | |
| void | sim_operator_dependencies (const SimOperator *op, const size_t **out_deps, size_t *out_count) |
| Access operator dependency list. | |
| SimResult | sim_operator_resolve_plan_with_logger (const SimOperatorRegistry *registry, SimOperatorPlan *plan, SimOperatorCycleLogFn logger, void *logger_userdata) |
| Resolve an execution plan for the registry. | |
| SimResult | sim_operator_resolve_plan (const SimOperatorRegistry *registry, SimOperatorPlan *plan) |
| void | sim_operator_plan_destroy (SimOperatorPlan *plan) |
| Release resources owned by a plan. | |
| void * | sim_operator_payload (SimOperator *op) |
| Retrieve the internal user payload. | |
| const char * | sim_operator_name (const SimOperator *op) |
| Retrieve the operator name. | |
| SimOperatorInfo | sim_operator_info (const SimOperator *op) |
| Retrieve operator metadata. | |
| void | sim_operator_config_normalize (SimOperatorConfig *config) |
| Convenience helpers for working with operator configuration payloads. | |
| SimOperatorConfig | sim_operator_config_defaults (void) |
| SimOperatorInfo | sim_operator_info_defaults (void) |
| void | sim_operator_info_normalize (SimOperatorInfo *info) |
| void | sim_operator_info_set_identity (SimOperatorInfo *info, const char *schema_key, SimIROpcode ir_opcode) |
| void | sim_operator_info_set_schema_identity (SimOperatorInfo *info, const char *schema_key) |
| const char * | sim_operator_abstract_id (const struct SimOperator *op) |
| void | sim_operator_set_schema_key (struct SimOperator *op, const char *schema_key) |
| void | sim_operator_set_catalog_metadata (struct SimOperator *op, const void *metadata) |
| const void * | sim_operator_catalog_metadata (const struct SimOperator *op) |
| const char * | sim_operator_schema_key (const struct SimOperator *op) |
| const char * | sim_operator_schema_key_or (const struct SimOperator *op, const char *fallback) |
| SimIROpcode | sim_operator_ir_opcode (const struct SimOperator *op) |
| const SimOperatorRepresentation * | sim_operator_representation (const struct SimOperator *op) |
| const char * | sim_operator_representation_domain_name (const struct SimOperator *op) |
| const char * | sim_operator_representation_value_kind_name (const struct SimOperator *op) |
| const struct SimGraphIR * | sim_operator_graph_ir (const struct SimOperator *op) |
| bool | sim_operator_config_get (const SimOperator *op, SimOperatorConfig *out_config) |
| void | sim_operator_config_set (struct SimOperator *op, const SimOperatorConfig *config) |
Operator abstraction, registry, and dependency resolution for libsimcore.
Operators are registered into a SimContext with explicit read/write field access, optional dependencies, metadata, and configuration. The scheduler uses those declarations to build deterministic execution order, while operator descriptors keep ownership boundaries clear: descriptors and arrays are copied as needed, but user payload lifetime remains the caller's responsibility unless a concrete operator documents otherwise.
| #define SIM_NEURAL_CHANNEL_AXIS_AUTO 255U |
Automatic channel-axis selection for neural shape constraints.
| #define SIM_OPERATOR_MAX_INVARIANTS 4U |
Maximum invariants tracked inline per operator.
| #define SIM_OPERATOR_MAX_SPACING_DIMS 4U |
Maximum dimensions tracked for spacing metadata.
| #define SIM_OPERATOR_NAME_MAX 63U |
Maximum length for operator identifiers (excluding null terminator).
| #define SIM_OPERATOR_SCHEMA_KEY_MAX 127U |
Maximum length for stable operator schema keys (excluding null terminator).
| typedef enum SimClockMode SimClockMode |
Clock selection for time-sensitive operators.
Pure deterministic time: t = f(params) (rewind-safe, replayable, KernelIR-friendly). True accumulated time: t_{n+1} = t_n + dt_n (requires state, rewind policy-dependent).
CLOCK_FROM_TIME_PARAM: t = time param + offset (pure). CLOCK_FROM_STEP_PURE: t = step_index * nominal_dt + offset (pure). CLOCK_ACCUMULATED_STATEFUL: t accumulates with state (non-replayable).
| typedef enum SimRepresentationMode SimRepresentationMode |
Representation mode governing determinism guarantees.
STRICT: deterministic, snapshot-friendly, IR/CPU parity, rewind-safe. RELAXED: mostly deterministic; permits limited conveniences. EXPLORATION: best-effort; stateful or non-replayable behavior permitted.
| enum SimClockMode |
Clock selection for time-sensitive operators.
Pure deterministic time: t = f(params) (rewind-safe, replayable, KernelIR-friendly). True accumulated time: t_{n+1} = t_n + dt_n (requires state, rewind policy-dependent).
CLOCK_FROM_TIME_PARAM: t = time param + offset (pure). CLOCK_FROM_STEP_PURE: t = step_index * nominal_dt + offset (pure). CLOCK_ACCUMULATED_STATEFUL: t accumulates with state (non-replayable).
Limiter/clipper strategies engaged by continuity guards.
| enum SimContinuityMode |
Numerical continuity and stability policy.
| enum SimDeterminismFlags |
Determinism capability flags declared by operators.
Determinism policy for neural inference operators.
Device placement requirement for neural inference operators.
Numeric precision policy for neural inference operators.
Algebraic property bitmask for operators.
| enum SimOperatorCategory |
Operator category for grouping and scheduling hints.
Supported invariant kinds for bookkeeping/diagnostics.
Representation mode governing determinism guarantees.
STRICT: deterministic, snapshot-friendly, IR/CPU parity, rewind-safe. RELAXED: mostly deterministic; permits limited conveniences. EXPLORATION: best-effort; stateful or non-replayable behavior permitted.
| void sim_operator_dependencies | ( | const SimOperator * | op, |
| const size_t ** | out_deps, | ||
| size_t * | out_count | ||
| ) |
Access operator dependency list.
| op | Operator instance. | |
| [out] | out_deps | Pointer receiving dependency array (owned by op). |
| [out] | out_count | Pointer receiving dependency count. |
| SimOperatorInfo sim_operator_info | ( | const SimOperator * | op | ) |
Retrieve operator metadata.
| op | Operator instance. |
| const char * sim_operator_name | ( | const SimOperator * | op | ) |
Retrieve the operator name.
| op | Operator instance. |
| void * sim_operator_payload | ( | SimOperator * | op | ) |
Retrieve the internal user payload.
| op | Operator instance. |
| void sim_operator_plan_destroy | ( | SimOperatorPlan * | plan | ) |
Release resources owned by a plan.
| plan | Plan to destroy; may be NULL. |
| void sim_operator_registry_destroy | ( | SimOperatorRegistry * | registry | ) |
Release all operators contained in a registry.
| registry | Registry to tear down. |
| SimOperator * sim_operator_registry_get | ( | SimOperatorRegistry * | registry, |
| size_t | index | ||
| ) |
Lookup an operator by index.
| registry | Registry instance. |
| index | Operator index. |
| SimResult sim_operator_registry_init | ( | SimOperatorRegistry * | registry | ) |
Initialize an empty registry.
| [out] | registry | Target registry. |
| SimResult sim_operator_registry_register | ( | SimOperatorRegistry * | registry, |
| const SimOperatorDescriptor * | descriptor, | ||
| size_t * | out_index | ||
| ) |
Register a new operator.
| registry | Target registry. | |
| descriptor | Operator descriptor; all strings are copied. | |
| [out] | out_index | Optional pointer receiving the assigned index. |
| SimResult sim_operator_resolve_plan_with_logger | ( | const SimOperatorRegistry * | registry, |
| SimOperatorPlan * | plan, | ||
| SimOperatorCycleLogFn | logger, | ||
| void * | logger_userdata | ||
| ) |
Resolve an execution plan for the registry.
| registry | Registry instance. | |
| [out] | plan | Execution plan to populate. |
| logger | Optional callback for dependency-cycle diagnostics. | |
| logger_userdata | Opaque pointer forwarded to logger. |