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

Runtime cache and texture-packing state for field-topology extraction. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "field.h"
#include "sim_field_topology.h"
Include dependency graph for sim_field_topology_runtime.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimFieldTopologyWorkspace
 Scratch arrays reserved for topology cache and future graph-style passes. More...
 
struct  SimFieldTopologyRuntimeState
 Reusable runtime state for one field's topology cache. More...
 

Typedefs

typedef struct SimFieldTopologyWorkspace SimFieldTopologyWorkspace
 Scratch arrays reserved for topology cache and future graph-style passes.
 
typedef struct SimFieldTopologyRuntimeState SimFieldTopologyRuntimeState
 Reusable runtime state for one field's topology cache.
 

Functions

void sim_field_topology_runtime_init (SimFieldTopologyRuntimeState *state)
 Initialize runtime topology state with default configuration.
 
void sim_field_topology_runtime_reset (SimFieldTopologyRuntimeState *state)
 Invalidate cached topology while retaining allocated buffers.
 
void sim_field_topology_runtime_mark_dirty (SimFieldTopologyRuntimeState *state)
 Mark cached topology stale.
 
SimResult sim_field_topology_runtime_resize (SimFieldTopologyRuntimeState *state, size_t width, size_t height)
 Ensure cached cell and workspace storage can hold a topology grid.
 
void sim_field_topology_runtime_free (SimFieldTopologyRuntimeState *state)
 Free cached topology buffers and reinitialize the state.
 
bool sim_field_topology_runtime_recompute (SimFieldTopologyRuntimeState *state, const struct SimField *field, size_t step_index)
 Recompute cached topology when enabled, dirty, or past the cadence interval.
 
bool sim_field_topology_runtime_pack_rgba8 (SimFieldTopologyRuntimeState *state, uint8_t *dest, size_t capacity, size_t *out_width, size_t *out_height, size_t *out_bytes)
 Pack cached topology cells into an RGBA8 image.
 

Detailed Description

Runtime cache and texture-packing state for field-topology extraction.

SimFieldTopologyRuntimeState keeps reusable cell storage, scratch arrays, cadence counters, and a packed-summary cache for context-owned fields. Callers mark the state dirty when the source field changes and request recomputation on demand.

Function Documentation

◆ sim_field_topology_runtime_free()

void sim_field_topology_runtime_free ( SimFieldTopologyRuntimeState state)

Free cached topology buffers and reinitialize the state.

Parameters
stateState object to free; ignored when NULL.

◆ sim_field_topology_runtime_init()

void sim_field_topology_runtime_init ( SimFieldTopologyRuntimeState state)

Initialize runtime topology state with default configuration.

Parameters
[out]stateState object to initialize; ignored when NULL.

◆ sim_field_topology_runtime_mark_dirty()

void sim_field_topology_runtime_mark_dirty ( SimFieldTopologyRuntimeState state)

Mark cached topology stale.

Parameters
stateState object to mark; ignored when NULL.

◆ sim_field_topology_runtime_pack_rgba8()

bool sim_field_topology_runtime_pack_rgba8 ( SimFieldTopologyRuntimeState state,
uint8_t *  dest,
size_t  capacity,
size_t *  out_width,
size_t *  out_height,
size_t *  out_bytes 
)

Pack cached topology cells into an RGBA8 image.

Parameters
stateRuntime cache state with valid topology.
[out]destDestination byte buffer.
capacityDestination capacity in bytes.
[out]out_widthOptional packed image width.
[out]out_heightOptional packed image height.
[out]out_bytesOptional number of bytes written.
Returns
true when the cache was valid and dest had enough capacity.

◆ sim_field_topology_runtime_recompute()

bool sim_field_topology_runtime_recompute ( SimFieldTopologyRuntimeState state,
const struct SimField field,
size_t  step_index 
)

Recompute cached topology when enabled, dirty, or past the cadence interval.

Parameters
stateRuntime cache state.
fieldSource field to inspect.
step_indexCurrent simulation step index.
Returns
true when the cache is valid after the request.

◆ sim_field_topology_runtime_reset()

void sim_field_topology_runtime_reset ( SimFieldTopologyRuntimeState state)

Invalidate cached topology while retaining allocated buffers.

Parameters
stateState object to reset; ignored when NULL.

◆ sim_field_topology_runtime_resize()

SimResult sim_field_topology_runtime_resize ( SimFieldTopologyRuntimeState state,
size_t  width,
size_t  height 
)

Ensure cached cell and workspace storage can hold a topology grid.

Parameters
stateState object to resize.
widthRequired topology width.
heightRequired topology height.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL state, or SIM_RESULT_OUT_OF_MEMORY when allocation fails.