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

Runtime selection utilities for libsimintegrators. More...

#include "integrator.h"
Include dependency graph for integrator_registry.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IntegratorRegistryEntry
 Entry stored by the registry. More...
 
struct  IntegratorRegistry
 Registry container for integrator factories. More...
 

Typedefs

typedef SimResult(* IntegratorCreateFn) (const IntegratorConfig *config, Integrator *out)
 Factory function creating an integrator instance.
 
typedef struct IntegratorRegistryEntry IntegratorRegistryEntry
 Entry stored by the registry.
 
typedef struct IntegratorRegistry IntegratorRegistry
 Registry container for integrator factories.
 

Functions

SimResult integrator_registry_init (IntegratorRegistry *registry)
 Initialize a registry and register built-in integrator factories.
 
void integrator_registry_destroy (IntegratorRegistry *registry)
 Release registry storage.
 
SimResult integrator_registry_register (IntegratorRegistry *registry, const char *name, IntegratorCreateFn create_fn)
 Add or replace a factory under a registry name.
 
IntegratorCreateFn integrator_registry_lookup (const IntegratorRegistry *registry, const char *name)
 Look up a factory by registry name.
 
SimResult integrator_registry_create (const IntegratorRegistry *registry, const char *name, const IntegratorConfig *config, Integrator *out)
 Create an integrator from a registered factory.
 
SimResult integrator_registry_register_builtin (IntegratorRegistry *registry)
 Register the built-in integrator factory set.
 

Detailed Description

Runtime selection utilities for libsimintegrators.

The registry maps stable textual integrator names such as "rk4" and "etdrk4" to factory callbacks. Registry storage is owned by the registry; created Integrator instances are written into caller-provided memory and must later be passed to integrator_destroy().

Typedef Documentation

◆ IntegratorCreateFn

typedef SimResult(* IntegratorCreateFn) (const IntegratorConfig *config, Integrator *out)

Factory function creating an integrator instance.

Parameters
configOptional configuration forwarded to the concrete factory.
[out]outCaller-owned integrator storage populated on success.
Returns
SIM_RESULT_OK on success, or an error from validation, allocation, or concrete integrator setup.

◆ IntegratorRegistry

Registry container for integrator factories.

The entry array is heap-owned after initialization and must be released with integrator_registry_destroy().

◆ IntegratorRegistryEntry

Entry stored by the registry.

Names are copied into fixed-size storage and compared by their stored byte sequence. Registering an existing name replaces its factory.

Function Documentation

◆ integrator_registry_create()

SimResult integrator_registry_create ( const IntegratorRegistry registry,
const char *  name,
const IntegratorConfig config,
Integrator out 
)

Create an integrator from a registered factory.

Parameters
registryRegistry to inspect.
nameNull-terminated integrator name.
configOptional configuration forwarded to the factory.
[out]outCaller-owned integrator storage populated on success.
Returns
SIM_RESULT_OK, SIM_RESULT_INVALID_ARGUMENT, SIM_RESULT_NOT_FOUND, or an error returned by the selected factory.

◆ integrator_registry_destroy()

void integrator_registry_destroy ( IntegratorRegistry registry)

Release registry storage.

Parameters
registryRegistry to destroy; NULL is ignored.

◆ integrator_registry_init()

SimResult integrator_registry_init ( IntegratorRegistry registry)

Initialize a registry and register built-in integrator factories.

Parameters
[out]registryRegistry storage to initialize.
Returns
SIM_RESULT_OK, SIM_RESULT_INVALID_ARGUMENT, or SIM_RESULT_OUT_OF_MEMORY.

◆ integrator_registry_lookup()

IntegratorCreateFn integrator_registry_lookup ( const IntegratorRegistry registry,
const char *  name 
)

Look up a factory by registry name.

Parameters
registryRegistry to inspect.
nameNull-terminated integrator name.
Returns
Factory callback, or NULL when the name is absent or inputs are invalid.

◆ integrator_registry_register()

SimResult integrator_registry_register ( IntegratorRegistry registry,
const char *  name,
IntegratorCreateFn  create_fn 
)

Add or replace a factory under a registry name.

Parameters
registryRegistry to mutate.
nameNull-terminated integrator name copied into the registry.
create_fnFactory callback for the name.
Returns
SIM_RESULT_OK, SIM_RESULT_INVALID_ARGUMENT, or SIM_RESULT_OUT_OF_MEMORY.

◆ integrator_registry_register_builtin()

SimResult integrator_registry_register_builtin ( IntegratorRegistry registry)

Register the built-in integrator factory set.

Built-ins currently include euler, heun, rk4, rkf45, backward_euler, crank_nicolson, etdrk4, and subordination.

Parameters
registryRegistry to mutate.
Returns
SIM_RESULT_OK, SIM_RESULT_INVALID_ARGUMENT, or SIM_RESULT_OUT_OF_MEMORY.