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

Declarative complex-first operator splitting (substep expansion at plan time). More...

#include "operator.h"
Include dependency graph for operator_split.h:

Go to the source code of this file.

Classes

struct  SimSplitAccess
 Per-substep access to a descriptor port. More...
 
struct  SimSplitSubstep
 One executable step inside a split operator sequence. More...
 
struct  SimSplitPort
 Binding between a split port and a context field. More...
 
struct  SimSplitScratchRequest
 Optional per-thread scratch request for split substeps. More...
 
struct  SimSplitDescriptor
 Full declarative description of a split operator sequence. More...
 

Typedefs

typedef enum SimAccessMode SimAccessMode
 Field access mode declared by a split-operator substep.
 
typedef struct SimSplitAccess SimSplitAccess
 Per-substep access to a descriptor port.
 
typedef struct SimSplitSubstep SimSplitSubstep
 One executable step inside a split operator sequence.
 
typedef struct SimSplitPort SimSplitPort
 Binding between a split port and a context field.
 
typedef struct SimSplitScratchRequest SimSplitScratchRequest
 Optional per-thread scratch request for split substeps.
 
typedef struct SimSplitDescriptor SimSplitDescriptor
 Full declarative description of a split operator sequence.
 

Enumerations

enum  SimAccessMode { SIM_ACCESS_READ = 0 , SIM_ACCESS_WRITE = 1 , SIM_ACCESS_RW = 2 }
 Field access mode declared by a split-operator substep. More...
 

Functions

SimResult sim_split_register (struct SimContext *context, const SimSplitDescriptor *desc, const size_t *dependencies, size_t dependency_count, size_t *out_first, size_t *out_last)
 Register a split operator which expands into sequential substeps.
 
const char * sim_split_symbolic (const struct SimOperator *op)
 Return the symbolic form string for any generated substep operator.
 
void * sim_split_state (struct SimOperator *op)
 Return the shared descriptor state for any generated substep operator.
 
void * sim_operator_state (struct SimOperator *op)
 Return operator state regardless of split or kernel-backed registration.
 

Detailed Description

Declarative complex-first operator splitting (substep expansion at plan time).

A split descriptor registers a sequence of ordinary SimOperator instances that share one user state pointer. Access declarations become read/write hazards for the scheduler, optional scratch is reserved per split operator, and later substeps depend on earlier substeps to preserve sequence order.

Typedef Documentation

◆ SimSplitDescriptor

Full declarative description of a split operator sequence.

The descriptor, port array, substep array, and access arrays are cloned during registration, but the state pointer remains caller-provided shared state. When the registered substep operators are destroyed, the optional destroy callback receives that shared state once.

Enumeration Type Documentation

◆ SimAccessMode

Field access mode declared by a split-operator substep.

Enumerator
SIM_ACCESS_READ 

Substep reads the bound port field.

SIM_ACCESS_WRITE 

Substep writes the bound port field.

SIM_ACCESS_RW 

Substep both reads and writes the bound port field.

Function Documentation

◆ sim_operator_state()

void * sim_operator_state ( struct SimOperator op)

Return operator state regardless of split or kernel-backed registration.

Parameters
opOperator to inspect.
Returns
Split shared state when present, otherwise sim_operator_payload(op).

◆ sim_split_register()

SimResult sim_split_register ( struct SimContext context,
const SimSplitDescriptor desc,
const size_t *  dependencies,
size_t  dependency_count,
size_t *  out_first,
size_t *  out_last 
)

Register a split operator which expands into sequential substeps.

Registers one operator per substep. The first substep depends on the provided dependencies; each subsequent substep depends on the previous substep. Field access declarations are converted into scheduler read/write masks and index arrays. Complex requirements are checked before registration completes.

Parameters
contextTarget simulation context.
descSplit operator description; arrays are copied, state is not copied.
dependenciesOptional dependency list for the first substep.
dependency_countLength of dependencies.
[out]out_firstOptional receiver for the first generated operator index.
[out]out_lastOptional receiver for the final generated operator index.
Returns
SIM_RESULT_OK, SIM_RESULT_INVALID_ARGUMENT, SIM_RESULT_TYPE_MISMATCH, SIM_RESULT_OUT_OF_MEMORY, or a result propagated by operator registration.

◆ sim_split_state()

void * sim_split_state ( struct SimOperator op)

Return the shared descriptor state for any generated substep operator.

Parameters
opGenerated split operator.
Returns
Shared state pointer, or NULL when op is not a split operator.

◆ sim_split_symbolic()

const char * sim_split_symbolic ( const struct SimOperator op)

Return the symbolic form string for any generated substep operator.

Parameters
opGenerated split operator.
Returns
Symbolic string from the descriptor callback, or NULL when unavailable.