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

Coordinate/index generator operator. More...

#include "oakfield/operator_split.h"
#include "oakfield/operators/stimulus/coords.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for coordinate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimCoordinateOperatorConfig
 Configuration parameters for the coordinate generator operator. More...
 

Typedefs

typedef enum SimCoordinateMode SimCoordinateMode
 Coordinate source mode.
 
typedef enum SimCoordinateNormalizeMode SimCoordinateNormalizeMode
 Normalization mode for coordinate values.
 
typedef struct SimCoordinateOperatorConfig SimCoordinateOperatorConfig
 Configuration parameters for the coordinate generator operator.
 

Enumerations

enum  SimCoordinateMode { SIM_COORD_MODE_INDEX = 0 , SIM_COORD_MODE_COORD }
 Coordinate source mode. More...
 
enum  SimCoordinateNormalizeMode { SIM_COORD_NORMALIZE_NONE = 0 , SIM_COORD_NORMALIZE_UNIT , SIM_COORD_NORMALIZE_CENTERED , SIM_COORD_NORMALIZE_SIGNED }
 Normalization mode for coordinate values. More...
 

Functions

SimResult sim_add_coordinate_operator (struct SimContext *context, const SimCoordinateOperatorConfig *config, size_t *out_index)
 Register a coordinate generator operator with the provided configuration.
 
SimResult sim_coordinate_config (struct SimContext *context, size_t operator_index, SimCoordinateOperatorConfig *out_config)
 Retrieve the configuration currently bound to a coordinate operator.
 
SimResult sim_coordinate_update (struct SimContext *context, size_t operator_index, const SimCoordinateOperatorConfig *config)
 Update an existing coordinate operator in-place.
 

Detailed Description

Coordinate/index generator operator.

Writes element index or coordinate-based values into a field, with optional normalization and scaling. Coordinates reuse the stimulus coordinate configuration for axis/angle/radial mappings.

Typedef Documentation

◆ SimCoordinateMode

Coordinate source mode.

Index mode writes the linear element index. Coordinate mode evaluates the shared stimulus coordinate mapping at each element position.

Enumeration Type Documentation

◆ SimCoordinateMode

Coordinate source mode.

Index mode writes the linear element index. Coordinate mode evaluates the shared stimulus coordinate mapping at each element position.

Enumerator
SIM_COORD_MODE_INDEX 

Use linear element index (0..N-1).

SIM_COORD_MODE_COORD 

Use coordinate mapping configured in the coord field.

◆ SimCoordinateNormalizeMode

Normalization mode for coordinate values.

Enumerator
SIM_COORD_NORMALIZE_NONE 

No normalization.

SIM_COORD_NORMALIZE_UNIT 

Map to [0, 1].

SIM_COORD_NORMALIZE_CENTERED 

Map to [-0.5, 0.5].

SIM_COORD_NORMALIZE_SIGNED 

Map to [-1, 1].

Function Documentation

◆ sim_add_coordinate_operator()

SimResult sim_add_coordinate_operator ( struct SimContext context,
const SimCoordinateOperatorConfig config,
size_t *  out_index 
)

Register a coordinate generator operator with the provided configuration.

The implementation copies and normalizes config, resolves the default scale-by-dt policy, and validates that the output field is real double, complex double, or an exact-integer domain supported by the exact affine path. Passing NULL selects index mode on field 0 with gain 1 and bias 0.

Parameters
contextSimulation context that will own the operator.
configOptional coordinate-generator configuration.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL context or missing output field, SIM_RESULT_TYPE_MISMATCH for unsupported output domains, SIM_RESULT_OUT_OF_MEMORY on allocation failure, or a split-registration error.

◆ sim_coordinate_config()

SimResult sim_coordinate_config ( struct SimContext context,
size_t  operator_index,
SimCoordinateOperatorConfig out_config 
)

Retrieve the configuration currently bound to a coordinate operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_coordinate_operator().
[out]out_configReceives the operator's normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no coordinate state.

◆ sim_coordinate_update()

SimResult sim_coordinate_update ( struct SimContext context,
size_t  operator_index,
const SimCoordinateOperatorConfig config 
)

Update an existing coordinate operator in-place.

Passing NULL for config keeps the current configuration and reapplies normalization. A successful update refreshes runtime state, exact-integer affine metadata, symbolic state, and the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the coordinate operator to update.
configOptional replacement configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL context or missing output field, SIM_RESULT_NOT_FOUND for a missing operator, SIM_RESULT_INVALID_STATE for missing state, or SIM_RESULT_TYPE_MISMATCH for unsupported output domains.